[Math] How to evaluate integrals that involve the signum ($\text{sgn}$) function

calculusdefinite integralsfunctionsintegrationtrigonometry

For example, I want to evaluate $$ \displaystyle \int_{0}^{2\pi} \left| \sin x \right| \text{ d}x $$ and I already know that: $$ \displaystyle \begin{aligned} \int \left| \sin x \right| \text{ d}x & = \int \sin x \text{ sgn}\left( \sin x \right) \text{ d}x \\ & = -\cos x \text{ sgn}\left( \sin x \right) + \mathcal{C} \end{aligned}$$ How would I evaluate the definite integral involving the signum function?

Best Answer

Hint: Instead of trying to use the sign function, break up the integral into intervals where $\sin x \geq 0$ and $\sin x < 0$. On such intervals, $|\sin x|$ is particularly simple and easier to integrate.