# Trig Integration with Absolute Value

• Sep 12th 2008, 11:00 AM
MagicS06
Trig Integration with Absolute Value
Hi, I don't know where to start on this problem:

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

Any hints will be appreciated, thanks.
• Sep 12th 2008, 11:03 AM
InfinitePartsInHarmony
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.
• Sep 12th 2008, 11:16 AM
Plato
$\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.$
• Sep 12th 2008, 11:17 AM
Moo
Hello,

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

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

$\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 $|x|=\left\{\begin{array}{ll} -x \quad if~x<0 \\ x \quad if~x\ge 0 \end{array} \right.$

This gives $\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$
• Sep 12th 2008, 11:24 AM
Soroban
Hello, MagicS06!

Quote:

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

$\text{Graph }\sin x \text{ and }\cos x\text{ on that interval.}$
Code:

        |         * *  * *         |  *  :         | * : * :         |*  :  *:         |  :  :       - * - + - * - -         0  ¼π  ½π         |

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

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

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

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

Go for it!