How does one get $\int_{-\pi}^{\pi} \sin(nx) \cos(nx) dx = \frac{\sin^2(nx)}{2n} |_{-\pi}^{\pi}$?

59 Views Asked by At

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}$?

2

There are 2 best solutions below

2
On

$$\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.

0
On

What happens to $\frac1{2n}$? - it disappears, because your question is about a definite integral. We have $$\eqalign{-\frac{1}{2n} \bigg( 1-\sin^2(nx) \bigg)\bigg|_{-\pi}^\pi &=\biggl(-\frac1{2n}+\frac1{2n}\sin^2n\pi\biggr) -\biggl(-\frac1{2n}+\frac1{2n}\sin^2(-n\pi)\biggr)\cr &=\frac1{2n}\sin^2n\pi-\frac1{2n}\sin^2(-n\pi)\cr}$$ which is the same as your first expression. (Also, though not relevant to this question, it simplifies to zero.)