How does one get $\int_{-\pi}^{\pi} \sin(nx) \cos(nx) dx = \frac{\sin^2(nx)}{2n} |_{-\pi}^{\pi}$?
Running through Symbolab gives:
$$\frac{-\cos ^2\left(\pi n\right)+\cos ^2\left(-\pi n\right)}{2n}$$
Which due to $\cos(x)=\cos(-x)$ should equal $0$.
Although Symbolab also gives
$$-\frac{1}{2n} \cos^2(nx)$$
But since $\sin^2(x)+\cos^2(x)=1$, then this would be
$$-\frac{1}{2n} \bigg( 1-\sin^2(nx) \bigg)$$
Is this it?
But what happens to $\frac{1}{2n}$?
$$\int_{-\pi}^{\pi} \sin(nx) \cos(nx) dx = \frac{\sin^2(nx)}{2n} |_{-\pi}^{\pi}=0$$
Also $$\int_{-\pi}^{\pi} \sin(nx) \cos(nx) dx= -\frac{1}{2n} \bigg( \cos^2(nx) \bigg)|_{- \pi}^{\pi}=-\frac{1}{2n} \bigg( 1-\sin^2(nx) \bigg)|_{-\pi}^{\pi} =0$$
There is not conflict.