TITLE: Evaluate $\int\limits_0^\pi \frac{\sin^2x}{2-\cos x}\ \mathrm dx$ by complex methods
QUESTION [6 upvotes]: find integral $$\int\limits_0^\pi  \frac{\sin^2x}{2-\cos x}dx$$
what I had in mind is to use Euler formula, to turn it into a complex integral and change the limits of integration from $ -\pi$  to  $\pi$ so that any odd parts of the integrand would go to zero. But does not seem to make problem easier. Substitution of $u=\tan(x/2)$ would work but the computation is very tedious. Any suggestions for a nicer approach?

REPLY [2 votes]: $\newcommand{\+}{^{\dagger}}%
 \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{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert #1 \right\vert}%
 \newcommand{\yy}{\Longleftrightarrow}$
$\ds{\int_{0}^{\pi}{\sin^{2}\pars{x} \over 2-\cos\pars{x}}\,\dd x:\ {\large ?}}$

\begin{align}
&\int_{0}^{\pi}{\sin^{2}\pars{x} \over 2 - \cos\pars{x}}\,\dd x
=
\int_{0}^{\pi}{\sin^{2}\pars{x}\bracks{2 + \cos\pars{x}}
               \over
               4 - \cos^{2}\pars{x}}\,\dd x
=
\int_{0}^{\pi}{\sin^{2}\pars{x}\bracks{2 + \cos\pars{x}}
               \over
               3 + \sin^{2}\pars{x}}\,\dd x
\\[3mm]&=
2\int_{0}^{\pi}{3 + \sin^{2}\pars{x} - 3 \over 3 + \sin^{2}\pars{x}}\,\dd x
+
\overbrace{\int_{-\pi/2}^{\pi/2}
{\cos\pars{x + \pi/2} \over 3 + \sin^{2}\pars{x + \pi/2}}\,\dd x}^{\ds{=\ 0}}
=
2\pi - 6\int_{0}^{\pi}{\dd x \over 3 + \sin^{2}\pars{x}}
\\[3mm]&=
2\pi - 6\int_{0}^{\pi}{\dd x \over 3 + \bracks{1 - \cos\pars{2x}}/2}
=
2\pi - 12\int_{0}^{\pi}{\dd x \over 7 - \cos\pars{2x}}
=
2\pi - 6\int_{0}^{2\pi}{\dd x \over 7 - \cos\pars{x}}
\\[3mm]&=
2\pi - 6\oint_{\verts{z} = 1}{1 \over 7 - \pars{z + 1/z}/2}
\pars{-\ic\,{\dd z \over z}}
=
2\pi - 12\ic\oint_{\verts{z} = 1}{\dd z \over z^{2} - 14z + 1}
\end{align}

The roots $z_{\pm}$ of $z^{2} - 14z + 1 = 0$ are given by
$z_{\pm} = \pars{14 \pm \root{196 - 4}}/2 = 7 \pm 4\root{3}$ where
$\verts{z_{+}} > 1$ and $\verts{z_{-}} < 1$.
Then,

\begin{align}
&\int_{0}^{\pi}{\sin^{2}\pars{x} \over 2 - \cos\pars{x}}\,\dd x
=
2\pi - 12\ic\pars{2\pi\ic}\lim_{z \to z_{-}}\pars{z - z_{-} \over z^{2} - 14z + 1}
=
2\pi + 24\pi\,{1 \over 2z_{-} - 14}
\\[3mm]&=
2\pi + 24\pi\,{1 \over 2\pars{7 - 4\root{3}} - 14}
=
2\pi - {3\pi \over  \root{3}}
\end{align}

$$\color{#0000ff}{\large%
\int_{0}^{\pi}{\sin^{2}\pars{x} \over 2 - \cos\pars{x}}\,\dd x
=
\pars{2 - \root{3}}\pi}\quad \approx\quad 0.8418
$$