# How do I prove $\int_0^\pi\frac{(\sin nx)^2}{(\sin x)^2}dx = n\pi$?

I need to show that the following integral:

$$\int_0^\pi\frac{(\sin nx)^2}{(\sin x)^2}dx$$ = $n\pi$, for all natural numbers $n$. What is the method to evaluate the above?

I initially thought of the Leibniz rule, but that wouldn't work as the result only holds for positive integers, meaning the integral would not be a continuous function in $n$. Is there some other way to prove it?

• You could try induction. Commented Nov 10, 2016 at 14:29
• try some examples at first Commented Nov 10, 2016 at 14:37
• contour integration will work Commented Nov 10, 2016 at 14:44
• Commented Nov 10, 2016 at 15:00
• this is related to the Fejér kernel. Commented Nov 18, 2023 at 3:59

If $I_n=\int_0^\pi\dfrac{\sin^2nx}{\sin^2x}dx$

$I_0=0,I_1=\pi$

$$I_{m+1}-I_m=\int_0^\pi\dfrac{\sin^2(m+1)x-\sin^2mx}{\sin^2x}dx=\int_0^\pi\dfrac{\sin(2m+1)x}{\sin x}dx=J_m\text{(say)}$$

Now $$J_{r+1}-J_r=\int_0^\pi\dfrac{\sin(2r+3)x-\sin(2r+1)x}{\sin x}dx=2\int_0^\pi\cos2(r+1)\ dx$$

For $r+1\ne0,$ $$J_{r+1}-J_r=\cdots=0$$

For $r\ge0,$ $$\implies J_r=J_0$$

$$J_0=I_1-I_0=\pi$$

For $m\ge0,$ $$I_{m+1}-I_m=J_0=\pi$$ Can you take it from here?

• nice one (+1)  Commented Nov 10, 2016 at 14:49
• Nice proof. Thanks for that! Commented Nov 10, 2016 at 14:53

Here's another way. Recall that $\sin(x) =\frac{e^{i x}-e^{-i x}}{2i}$. Therefore $$I = \int_0^{\pi} \frac{\sin^2(nx)}{\sin^2(x)}\mathrm{d}x = \int_0^{\pi} \frac{\left(\frac{e^{inx}-e^{-inx}}{2i}\right)^2}{\left(\frac{e^{ix}-e^{-ix}}{2i}\right)^2} \mathrm{d}x = \int_0^{\pi} \frac{e^{-i2nx}(e^{i2nx}-1)^2}{e^{-i2x}(e^{i2x}-1)^2} \mathrm{d}x = \int_0^{\pi} e^{-i2 (n-1)x}\frac{(e^{i2nx}-1)^2}{(e^{i2x}-1)^2} \mathrm{d}x$$ For the next step, recall that $(t^n-1)/(t-1) = 1+t+\ldots+t^{n-1}$. Using $t=e^{i2x}$ we get: $$I = \int_0^{\pi} e^{-i2(n-1)x}(1+e^{i2x}+\ldots+e^{i2(n-1)x})^2\mathrm{d}x$$ Then we multiply out to see that $(1+t+\ldots+t^{n-1})^2 = 1+2t+3t^2+\ldots nt^{n-1}+(n-1)t^{n+1}+\ldots+t^{2n-1}$ to see that the integral is $$I = \int_0^{\pi} e^{-i2(n-1)x}(1+\ldots+ne^{i2(n-1)x}+\ldots +e^{i2(2n-2)x})\mathrm{d}x$$ Finally we note that if $n\neq 0$ then $$\int_0^\pi e^{i2nx}\mathrm{d}x = \left.\frac{1}{i2n}e^{i2nx}\right|_0^{\pi} = \frac{(-1)^{2n}-1}{i2n}=0$$ whereas for $n=0$ we get $$\int_0^\pi e^{i2nx}\mathrm{d}x = \int_0^\pi 1\mathrm{d}x = \pi$$ Plugging into our expression from the integral we get $$I = n\pi.$$

• Cool! I never thought complex numbers could be used to integrate real valued functions though. Commented Nov 10, 2016 at 16:48
• You can; I usually use this method for integrating $P(x)\sin kx$ or $P(x)\cos kx$ where $P$ is a polynomial. Commented Nov 10, 2016 at 18:14
• @Kalyan IMO, complex numbers can really change the way you think about real integrals. Wait till you get to contour integrals for real integrals. Commented Nov 10, 2016 at 19:30

HINT.-A third quite different way (no greater details for short).

$$I_n=\int_0^\pi\frac{(\sin nx)^2}{(\sin x)^2}dx=\int_0^\pi(\sin nx)^2)d(-\cot x)=n\pi$$ $$I_n=\left[(\sin nx)^2)(-\cot x)\right]_0^{\pi}+\int_0^\pi\frac{\sin 2nx(n\cos x)}{\sin x} =n\pi$$ The first term in RHS is equal to $0$ hence we can prove as equivalent statement that for all $n$ $$J_n=\int_0^\pi\frac{\sin 2nx\cos x}{\sin x} =\pi$$

It is verified that that $$J_1=\int_0^\pi\frac{\sin 2x\cos x}{\sin x} =\left[(x+\sin x\cos x\right]_0^{\pi}=\pi$$ so for finish we prove that $$J_{n+1}-J_n=0\qquad(*)$$ (the equality $(*)$ implies immediately that $J_2=J_3=\cdots J_n=\pi$)

We have the trigonometric identities

$$\begin{cases}\sin(2n+1)x\cos x=\frac 12\left[\sin(2n+2)x+\sin 2nx\right]\\\sin(2n)x\cos x=\frac 12[\sin(2n+1)x+\sin (2n-1)x]\end{cases}$$ It follows $$I_{n+1}-I_n=\frac 12\int_0^{\pi}\frac{(\sin(2n+2)x+\sin 2nx)-(\sin(2n+1)x+\sin (2n-1)x)}{\sin x}dx$$

We have here elementary integrals allow us to verify that $(*)$ is true.

$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} &\bbox[#ffd,10px]{\ds{\left.\int_{0}^{\pi}{\sin^{2}\pars{nx} \over \sin^{2}\pars{x}}\,\dd x\,\right\vert_{\ n\ \in\ \mathbb{Z}}}} = {1 \over 2}\int_{-\pi}^{\pi}{\sin^{2}\pars{\verts{n}x} \over \sin^{2}\pars{x}}\,\dd x \\[5mm] & = {1 \over 2}\oint_{\verts{z}\ =\ 1^{-}}{\bracks{% \pars{z^{\verts{n}} - z^{-\verts{n}}}/\pars{2\ic}}^{2} \over \bracks{\pars{z - z^{-1}}/\pars{2\ic}}^{\,2}}\,{\dd z \over \ic z} = {1 \over 2\ic}\oint_{\verts{z}\ =\ 1^{-}}{1 \over z^{2\verts{n} - 1}} {\pars{1 - z^{2\verts{n}}}^{2} \over\pars{1 - z^{2}}^{\,2}}\,\dd z \\[5mm] = &\ {1 \over 2\ic}\oint_{\verts{z}\ =\ 1^{-}}{1 \over z^{2\verts{n} - 1}} \pars{1 - 2z^{2\verts{n}} + z^{4\verts{n}}} \sum_{k = 0}^{\infty}\ \overbrace{{-2 \choose k}}^{\ds{\pars{k + 1}\pars{-1}^{k}}}\ \pars{-z^{2}}^{k}\,\dd z \\[5mm] & = \sum_{k = 0}^{\infty}\pars{k + 1}\bracks{% \underbrace{{1 \over 2\ic}\oint_{\verts{z}\ =\ 1^{-}}{\dd z \over z^{2\verts{n} - 2k - 1}}}_{\ds{\pi\,\delta_{2\verts{n} - 2k - 1,1}}} - {1 \over 2\ic}\oint_{\verts{z}\ =\ 1^{-}}z^{2k + 1}\,\dd z + {1 \over 2\ic}\oint_{\verts{z}\ =\ 1^{-}}z^{2\verts{n} + 2k + 1}\,\dd z} \end{align}

The last two integrals vanish out.

Then, $$\bbx{\bbox[#ffd,10px]{\ds{\left.\int_{0}^{\pi}{\sin^{2}\pars{nx} \over \sin^{2}\pars{x}}\,\dd x\,\right\vert_{\ n\ \in\ \mathbb{Z}}}} = \verts{n}\pi}$$