How do I integrate :$\int_{0}^\pi \frac{\sin(n\theta)}{\sin \theta} d\theta $
I did the following: $\int_{0}^\pi \frac{\sin(n \theta)}{\sin \theta}d\theta = \mbox{Im} \int_{0}^{\pi} \frac{e^{i n \theta}}{\sin \theta} d\theta = \mbox{Im} \int_{0}^{\pi} 2i \frac{e^{i n \theta}}{e^{i \theta}-e^{- i \theta}} d\theta$
Put $ z=e^{i \theta}$ then
$ \mbox{Im} \int_{|z|=1} \frac{z^n}{(z^2-1)} dz$
Now I have problem , because the function $f(z)= \frac{z^n}{(z^2-1)}$ is not analytic on the boundary of the unit disk. Now I can not use the Cauchy Residue Theorem.
The answer is $0$ if $n$ is even and $ \pi$ if $n$ is odd.
I stuck:
Any suggestions ?
You certainly can use Cauchy's theorem here.
The integral is equal to
$$\begin{align}-\frac{i}{2} \oint_{|z|=1} \frac{dz}{z^n} \frac{z^{2 n}-1}{z^2-1} &= \frac{\pi}{(n-1)!} \frac{d^{n-1}}{dz^{n-1}}\left [ 1+z^2+z^4+\cdots+z^{2 n-2}\right ]_{z=0}\end{align}$$
The poles at $z=\pm 1$ cancel out, so the only pole is at $z=0$. When $n$ is even, the derivative term is clearly zero, as an odd derivative evaluated at zero is zero. When $n$ is odd, however, say $n=2 k+1$, then the result is
$$\frac{\pi}{(2 k)!} \frac{d^{2 k}}{dz^{2 k}} \left [ 1+z^2+z^4+\cdots+z^{4 k}\right ]_{z=0}$$
which is indeed $\pi$, as the only surviving derivative is attached to the $z^{2 k}$ term.