Why is $\int_{0}^{2\pi} |\sin x| dx = 4$ I can't understand why $$\int_{0}^{2\pi} |\sin x| dx = 4$$while
$$\int_{0}^{2\pi} \sin x dx = 0$$
I did the calculus for the second varian but I can't reach result $4$ for the first integral. Thank you for helping.
It's simple: $\sin x$ on a single period has a "hill" between $0$ and $\pi$ and symmetrically, a "valley" between $\pi$ and $2\pi$. So the integrals cancel out. On the other hand, integration of $|\sin x|$ has to be split to a sum of integrals, where on the second part, the sign is reversed to produce two "hills". Because of symmetry, the integrals over half periods are the same:

$$\int_0^{2\pi} |sin x|{\,\rm d}x=2\int_0^\pi \sin x{\,\rm d}x$$
$$ \int^{2 \pi}_0 |\sin(x)|\,dx = 4 \int^{\frac{\pi}{2}}_0 |\sin(x)|\, dx = 4 \int^{\frac{\pi}{2}}_0 \sin(x)\, dx = 4 [ -\cos(x) ]^{ \frac{\pi}{2} }_0 = 4 $$