Why is $$ \int_{-\pi}^\pi\sin^2nx\;\mathrm{d}x = \int_{-\pi}^\pi\cos^2nx\;\mathrm{d}x =\pi\,? $$
I'm trying to understand a proof about Fourier series, and in my maths textbook, they do not explain how to solve this integral. Is there an explanation for this?
Note that we can write
$$\sin^2(nx)=\frac 12 -\frac 12 \cos(2nx)\\\\ $$
and
$$\cos^2(nx)=\frac12 +\frac12 \cos(2nx)$$
In addition, for $n\ge 1$,
$$\int_{-\pi}^{\pi}\cos(2nx)\,dx=0$$
Thus, we see immediately that
$$\int_{-\pi}^{\pi}\sin^2(nx)\,dx =\int_{-\pi}^{\pi}\cos^2(nx)\,dx=\pi$$