# Computing $\int_{0}^{2\pi}\frac{\sin(nx)}{\sin(x)} \mathrm dx$

I would like to compute:

$$\int_{0}^{2\pi}\frac{\sin(nx)}{\sin(x)} \mathrm dx$$

We have:

$$\int_{0}^{2\pi}\frac{\sin(nx)}{\sin(x)}\mathrm dx=2\int_{0}^{\pi}\frac{\sin(nx)}{\sin(x)}\mathrm dx$$

So: $n \geq 2$ $$\int_{0}^{\pi}\frac{\sin((n+1)x)}{\sin(x)}\mathrm dx= \ln(\sin(x))\sin(nx)\vert_0^{\pi}-n\int_{0}^{\pi} \ln(\sin(x))\cos(nx)\mathrm dx$$

$$=-n\int_{0}^{\pi} \ln(\sin(x))\cos(nx)\mathrm dx$$

...

-
Am I the only one lost as to what he did? –  Mike Feb 26 '12 at 20:51
It's not true for even $n\ge 4$, I think. –  draks ... Feb 26 '12 at 21:14
@draks: You're right, see my answer. –  Michalis Feb 26 '12 at 21:21
@draks: it is not true of $n$ even. –  Fabian Feb 26 '12 at 21:23
@Chon : It looks to me as if you may be attempting to integrate by parts, and possibly you're under an impression that $(d/dx)\ln\sin x = 1/\sin x$, and that $(d/dx)\sin(nx) = \cos(nx)$. But it's hard to tell what you actually did, so I can only venture guesses like this. At any rate, but identities are wrong since they neglect the chain rule. –  Michael Hardy Feb 27 '12 at 1:25

Use the identity $$\sin((n+1)x)-\sin((n-1) x)=2\cos(nx)\sin(x).$$

So it is an induction like the one you attempted. But instead of incrementing exponents by $1$, which creates a bit of a mess, we increment by $2$. Start with the cases $n=1$ and $n=2$, and treat the even and odd cases separately. Dividing the right-hand side by $\sin x$ leaves something very pleasant, whose integral is even more pleasant!

Remark: Note that for $n=2$, we are integrating $\frac{\sin 2x}{x}$. Since $\sin 2x=2\sin x\cos x$, our integral is $0$. So the odd and even cases yield quite different answers. If you ask a graphing program to graph $\frac{\sin nx}{x}$ for a few even $n$, you will see why. The cancellation is also visualizable without electronic aids. And you can prove directly that the integral is $0$, by breaking up the interval of integration into $0$ to $\pi$, and $\pi$ to $2\pi$. For even $n$, a suitable change of variable transforms the second integral into the negative of the first.

-
Just a small remark : one can notice that the integrand for $N = 2n+1$ odd is the Dirichlet kernel. Precisely we have $$\sum_{k = -n}^ n e^{2ikx} = \frac{\sin((2n+1)x)}{\sin(x)}$$. So the integral is easily computed in that case. –  Joel Cohen Feb 26 '12 at 22:40
@Joel Cohen: I wanted to do the calculation with minimal machinery, expecting (and hoping) that answers at various levels would be posted. –  André Nicolas Feb 26 '12 at 22:47

$$\sin(nx) = \sin x \cos(n-1)x + \cos x \sin(n-1)x$$

$\\$ $$\int\frac{\sin x \cos((n-1)x) + \cos x \sin((n-1)x)}{\sin x} \text{d}x$$

or:

$$\int (\cos((n-1)x) + \frac{\cos x \sin((n-1)x)}{\sin x})\text{d}x$$

Which equals to:

$$\frac{\sin((n-1)x)}{n-1}+\int\frac{\cos x \sin((n-1)x)}{\sin x}\text{d}x$$

So, the problem is evaluating,

$$\int\frac{\cos x \sin((n-1)x)}{\sin x})\text{d}x$$

From some trig identities, we will get that,

$$\cos x \sin((n-1)x) = \frac{1}{2}(\sin(nx) + \sin((n-2)x)$$

Hence our "problematic" integral becomes to:

$$\int\frac{\frac{1}{2}(\sin(nx) + \sin((n-2)x)}{\sin x}$$

Or:

$$\frac{1}{2}\int\frac{\sin(nx)}{\sin x}+\frac{1}{2}\int\frac{\sin(n-2)x}{\sin x}$$

And if we go back and say note our original integral as:

$$I_n=\int\frac{\sin(nx)}{\sin x}\text{d}x$$

by our above observation, we can conclude:

$$I_n=\frac{\sin((n-1)x}{n-1}+\frac{1}{2}I_n+\frac{1}{2}I_{n-2}$$

or:

$$I_n=2 \frac{\sin((n-1)x)}{n-1}+I_{n-2}$$

Could you proceed?

-

Note: We are going to prove that for odd $n$ the expression indeed equals $2\pi$. For even $n$ we want to prove it equals $0$.

We want to use induction. Prove it for $n=1,2,3,4$ and assume $n\geq 4$. Apply the addition theorem $\sin(nx)=\sin((n-1)x)\cos(x)+\cos((n-1)x)\sin(x)$ twice to obtain $$\frac{\sin(nx)}{\sin(x)}=\frac{\sin((n-2)x)}{\sin(x)}-\sin((n-2)x)\sin(x)+\cos((n-2)x)\cos(x)+\cos((n-1)x)=\frac{\sin((n-2)x)}{\sin(x)}+2cos((n-1)x)$$ If you integrate this from $0$ to $2\pi$ the second term will give $0$. Now use the induction hypothesis!

Sorry I realised too late that this is actually exactly what André is suggesting.

-

$$\sin((n+2)x)-\sin(nx)=2\sin(x)\cos((n+1)x)$$

$$\int_{0}^{2\pi}\frac{\sin((n+2)x)}{\sin(x)}\mathrm dx-\int_{0}^{2\pi}\frac{\sin(nx)}{\sin(x)}\mathrm dx=2\int_{0}^{2\pi} \cos((n+1)x)\mathrm dx=0$$

$$\int_{0}^{2\pi}\frac{\sin((n+2)x)}{\sin(x)}\mathrm dx=\int_{0}^{2\pi}\frac{\sin(nx)}{\sin(x)}\mathrm dx$$

If n is odd:

$$\int_{0}^{2\pi}\frac{\sin(nx)}{\sin(x)}\mathrm dx=\int_{0}^{2\pi}\frac{\sin(x)}{\sin(x)}\mathrm dx=2\pi$$

If n is even:

$$\int_{0}^{2\pi}\frac{\sin(nx)}{\sin(x)}\mathrm dx=\int_0^{2\pi}0 \; \mathrm dx=0$$

-