# Thread: Trig Integration with Absolute Value

1. ## Trig Integration with Absolute Value

Hi, I don't know where to start on this problem:

$\displaystyle \int_0^{\frac{\pi}{2}} |\sin{x} -\cos{x}| \ dx$

Any hints will be appreciated, thanks.

2. Start by eliminating the absolute value. Do this by deducing all the places between the upper and lower bounds of integration where sin x - cos x is negative. Split the question up into separate integrals summed for each region, using multiplication by -1 to make the negative sections positive.

Then integrate as per normal.

3. $\displaystyle \left| {\sin (t) - \cos (t)} \right| = \left\{ \begin{gathered} \cos (t) - \sin (t),\,t \in \left[ {0,\pi /4} \right] \hfill \\ \sin (t) - \cos (t),\,t \in \left[ {\pi /4,\pi /2} \right] \hfill \\ \end{gathered} \right.$

4. Hello,

$\displaystyle \sin \frac \pi 4=\cos \frac \pi 4=\frac{\sqrt{2}}{2}$

Before this point, cos decreases and sin increases.
So before $\displaystyle \frac \pi 4$, cos > sin --> sin - cos < 0

$\displaystyle \int_{0}^{\frac \pi 2} |\sin(x)-\cos(x)| ~dx=\int_{0}^{\frac \pi 4} |\underbrace{\sin(x)-\cos(x)}_{\text{negative}}| ~dx+\int_{\frac \pi 4}^{\frac \pi 2} |\underbrace{\sin(x)-\cos(x)}_{\text{positive}}| ~dx$

Recall that $\displaystyle |x|=\left\{\begin{array}{ll} -x \quad if~x<0 \\ x \quad if~x\ge 0 \end{array} \right.$

This gives $\displaystyle \int_{0}^{\frac \pi 2} |\sin(x)-\cos(x)| ~dx=\int_{0}^{\frac \pi 4} -(\sin(x)-\cos(x)) ~dx+\int_{\frac \pi 4}^{\frac \pi 2} \sin(x)-\cos(x) ~dx$

5. Hello, MagicS06!

$\displaystyle \int_0^{\frac{\pi}{2}} |\sin{x} -\cos{x}| \ dx$

$\displaystyle \text{Graph }\sin x \text{ and }\cos x\text{ on that interval.}$
Code:
        |
* *   * *
|   *   :
| * : * :
|*  :  *:
|   :   :
- * - + - * - -
0   ¼π  ½π
|

On $\displaystyle \left[0,\frac{\pi}{4}\right]\!:\;\;\sin x < \cos x$

. . The area is: .$\displaystyle \int^{\frac{\pi}{4}}_0\bigg(\cos x - \sin x\bigg)\,dx$

On $\displaystyle \left[\frac{\pi}{4},\:\frac{\pi}{2}\right]\!:\;\;\sin x > \cos x$

. . The area is: .$\displaystyle \int^{\frac{\pi}{2}}_{\frac{\pi}{4}} \bigg(\sin x - \cos x\bigg)\,dx$

Go for it!