Evaluate the definite-integrals $\int_0^{\pi} \frac{\sin nx}{\sin x}dx$ Evaluate the definite-integrals $\int_0^{\pi} \dfrac{\sin nx}{\sin x}dx$
my teacher say that, using the formula : $\sin nt=\dfrac{e^{ni}-e^{-ni}}{2i}$, but i can't :(.
 A: If $n$ is even then the function $f(z)=\frac{\sin(nz)}{\sin(z)}$ is symmetric around $z=\frac{\pi}{2}$, so the integral is simply zero. On the other hand, if $n=2k+1$ we have:
$$\frac{\sin((2k+1)z)}{\sin z} = \frac{e^{(2k+1)iz}-e^{-(2k+1)iz}}{e^{iz}-e^{-iz}} \\= e^{2kiz}+e^{(2k-2)iz}+\ldots+e^{2iz}+1+e^{-2iz}+\ldots+e^{-2kiz}$$
and all the terms of the previous sum vanish when integrated between $0$ and $\pi$, except $1$. 
This gives:
$$ \int_{0}^{\pi}\frac{\sin(nz)}{\sin z}\,dx = \frac{1-(-1)^n}{2} \pi.$$
A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,{\rm Li}_{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
\begin{align}&\color{#66f}{\large
\int_{0}^{\pi}\frac{\sin\pars{nx}}{\sin\pars{x}}\,\dd x}
=\,{\rm sgn}\pars{n}\Im\int_{0}^{\pi}
\frac{\exp\pars{\ic\verts{n}x} - 1 - x\bracks{\pars{-1}^{n} - 1}/\pi}{\sin\pars{x}}\,\dd x
\\[5mm]&=\left.\,{\rm sgn}\pars{n}\,\Im\oint_{\verts{z}=1}
\frac{z^{\verts{n}} - 1 + \ic\bracks{\pars{-1}^{n} - 1}\ln\pars{z}/\pi}
{\pars{z^{2} - 1}/\pars{2\ic z}}\,\frac{\dd z}{\ic z}
\,\right\vert_{\, 0< \,{\rm Arg}\pars{z} < \pi}
\\[5mm]&=\left.2\,{\rm sgn}\pars{n}\,\Im\oint_{\verts{z}=1}
\frac{z^{\verts{n}} - 1 + \ic\bracks{\pars{-1}^{n} - 1}\ln\pars{z}/\pi}{z^{2} - 1}
\,\dd z\,\right\vert_{\, 0< \,{\rm Arg}\pars{z} < \pi}
\\[1cm]&=-2\,{\rm sgn}\pars{n}\,\Im\int_{-1}^{0}
\frac{\pars{-x}^{\verts{n}}\expo{\ic\pi\verts{n}} - 1
+ \ic\bracks{\pars{-1}^{n} - 1}\bracks{\ln\pars{-x} + \ic\pi}/\pi}{x^{2} - 1}
\,\dd x
\\[5mm]&\phantom{=}-2\,{\rm sgn}\pars{n}\,\Im\int_{0}^{1}
\frac{x^{\verts{n}} - 1
+ \ic\bracks{\pars{-1}^{n} - 1}\ln\pars{x}/\pi}{x^{2} - 1}\,\dd x
\\[5mm]&=-\,\frac{4}{\pi}\,\,{\rm sgn}\pars{n}\bracks{\pars{-1}^{n} - 1}\
\underbrace{\int_{0}^{1}\frac{\ln\pars{x}}{x^{2} - 1}\,\dd x}
_{\dsc{\frac{\pi^{2}}{8}}}
=\color{#66f}{\large%
\,{\rm sgn}\pars{n}\bracks{1 - \pars{-1}^{n}}\frac{\pi}{2}}
\end{align}
We set the $\ds{\ln}$-branch cut:
$$
\ln\pars{z}=\ln\pars{\verts{z}} + \,{\rm Arg}\pars{z}\ic\,;\qquad
-\,\frac{\pi}{2} < \,{\rm Arg}\pars{z} < \frac{3\pi}{2}\,,\quad z \not=0.
$$

The last integral $\ds{\pars{~\mbox{the logarithmic one}~}}$ is easily evaluated as
follows:
\begin{align}&\dsc{\int_{0}^{1}\frac{\ln\pars{x}}{x^{2} - 1}\,\dd x}
=-\,\half\int_{0}^{1}\frac{\ln\pars{x}}{1 - x}\,\dd x
-\half\int_{0}^{1}\frac{\ln\pars{x}}{1 + x}\,\dd x
\\[5mm]&=-\,\half\int_{0}^{1}\frac{\ln\pars{1 - x}}{x}\,\dd x
+\half\int_{0}^{-1}\frac{\ln\pars{-x}}{1 - x}\,\dd x
\\[5mm]&=-\,\half\int_{0}^{1}\frac{\ln\pars{1 - x}}{x}\,\dd x
+\half\int_{0}^{-1}\frac{\ln\pars{1 - x}}{x}\,\dd x
=-\,\half\int_{-1}^{1}\frac{\ln\pars{1 - x}}{x}\,\dd x
\\[5mm]&=\half\int_{-1}^{1}\Li{2}'\pars{x}\,\dd x
=\frac{\Li{2}\pars{1} - \Li{2}\pars{-1}}{2}
=\frac{\pi^{2}/6 - \pars{-\pi^{2}/12}}{2}=\dsc{\frac{\pi^{2}}{8}}
\end{align}
