# Math Help - absolute trig integral

1. ## absolute trig integral

Hi, I'm getting really weird answers for the answer of this integral

$\int_{0}^{\pi}|\frac{1}{2}+cosx|~dx$

2. Originally Posted by akhayoon
Hi, I'm getting really weird answers for the answer of this integral

$\int_{0}^{\pi}|\frac{1}{2}+cosx|~dx$
$\int_{0}^{\pi} \left | \frac{1}{2}+cosx \right | ~dx = \int_0^{2\pi/3}\left ( \frac{1}{2} + cos(x) \right )~dx - \int_{2\pi/3}^{\pi} \left ( \frac{1}{2} + cos(x) \right )~dx$

I get $\sqrt{3} + \frac{\pi}{6}$.

-Dan

3. Originally Posted by akhayoon
Hi, I'm getting really weird answers for the answer of this integral

$\int_{0}^{\pi}|\frac{1}{2}+cosx|~dx$
remember what absolute values mean. $|x| = \left \{ \begin{array}{cc} x & \mbox{ if } x \ge 0 \\ & \\ -x & \mbox{ if } x < 0 \end{array} \right.$

thus we need to find where our function (without absolute values) is negative, and negate its integral on that region. we can find that 1/2 + cos(x) is negative for [2pi/3, pi], thus:

$\int_0^{\pi} \left| \frac 12 + \cos x \right|~dx = \int_0^{\frac {2 \pi}3} \left( \frac 12 + \cos x \right)~dx - \int_{\frac {2 \pi}3}^{\pi} \left( \frac 12 + \cos x \right)~dx$

4. oh so does the whole 1/2+cosx change to -1/2-cosx?

or does just cosx change to -cosx

5. Originally Posted by akhayoon
oh so does the whole 1/2+cosx change to -1/2-cosx?

or does just cosx change to -cosx
notice that we have 1/2 + cos(x) in brackets with a minus sign in front of it. what does that mean?

6. Hello, akhayoon!

Did you make a sketch?

$\int_{0}^{\pi}\left|\frac{1}{2}+\cos x\right|\,dx$

It is the cosine curve raised a half-unit.
Code:
        |
*
|:::*
|:::::*
|::::::*
|:::::::
|:::::::*
|::::::::       π
---+--------o------+---
|        ↑*::::::
|        ↑  *::::
|       2π/3    *
|

I totally agree with Dan's integrals and his final answer.