<s>[INST] Integral of quotients of $\sin$ function I am trying to calculate the definite integral
$$\int_0^\pi \frac{\sin(\frac{21}{2}x)}{\sin(\frac{1}{2}x)} dx.$$
Wolfram Alpha says here that the answer is $\pi$. I replaced 21 by other constants and think that in general, $\int_0^\pi \frac{\sin(\frac{n}{2}x)}{\sin(\frac{1}{2}x)} dx = \pi$ for all odd $n \in \mathbb Z$.
However I have no idea how to approach this problem. I tried substituting $u = x/2$ to simplify the integral a bit to
$$2\int_0^{\pi/2} \frac{\sin(nu)}{\sin(u)}.$$
Then I thought that I could maybe use the identity $\sin(nx) = \sin(x)\cos( (n-1)x) + \sin((n-1)x)\cos(x)$. For instance, since
\begin{align*}
\sin(3x) &= \sin(2x)\cos(x) + \cos(2x)\sin(x) \\
&= 2\sin(x) \cos^2(x) + \cos^2(x)\sin(x) - \sin^3(x) \\
&= \sin(x)(3\cos^2(x) - \sin^2(x))
\end{align*}
the integral would become
$$ 2\int_0^{\pi/2} 3\cos^2(x) -\sin^2(x) dx $$
which I am able to solve:
\begin{align*}
2\int_0^{\pi/2} 3\cos^2(x) -\sin^2(x) dx &= 2[\frac{3}{2}(x+\sin(x)\cos(x)) - \frac{1}{2}(x - \sin(x)\cos(x))]^{\pi/2}_0 \\
&= [2x + 4\sin(x)\cos(x)]^{\pi/2}_0 \\
&= \pi.
\end{align*}
However I don't know how to generalize this approach because the expansion for $\sin(21x)$ would have lots of unwieldy terms. Is there another way to do this problem that I am missing?
 [/INST] This is exactly the closed form of the Dirichlet's Kernel when N = 10.
$\sum _{n=-N}^{N} $ $e^{-inx}$ = $\frac{sin(\frac{(2N+1)x}{2})}{sin(\frac{x}{2})}$
Integration the series term by term, the terms with positive values of n will cancel the terms with negative ones, and the value of the integral when $n=0$ is $ \int_0 ^\pi e^{0ix} = \pi $, thus $ \int _0 ^{\pi} \frac{sin(\frac{(2N+1)x}{2})}{sin(\frac{x}{2})} dx = \pi $ for any integer value of N.
</s>