What is the simplest way to compute :$\int^{\pi}_0\bigl(\frac{\sin(x)}{5-4\cos(x)}\bigr)^2dx=\frac{\pi}{24}$ I am trying to compute the following integral.
$$\int^{\pi}_0\biggl(\frac{\sin(x)}{5-4\cos(x)}\biggr)^2dx$$
My attempt was to expand the integrand and make use of the standard change of variables $t =\tan x/2$. But it turns out to be a lengthy and exhausting computations. I can put all details here since it is not pleasant.
at the end I got the answer: 
$$\int^{\pi}_0\biggl(\frac{\sin(x)}{5-4\cos(x)}\biggr)^2dx =\frac{\pi}{24}$$
Maybe it is not correct so do not trust this result at 100%

I would like to know if there is an easiest way or trick that quickly leads to the answer?

 A: Let $z=e^{ix}$ and then
\begin{eqnarray}
&&\int^{\pi}_0\bigg(\frac{\sin(x)}{5-4\cos(x)}\bigg)^2dx\\
&=&\frac12\int^{\pi}_{-\pi}\bigg(\frac{\sin(x)}{5-4\cos(x)}\bigg)^2dx\\
&=&\frac12\int_{|z|=1}\bigg(\frac{\frac{z-\frac1z}{2i}}{5-4\frac{z+\frac1z}{2}}\bigg)^2\frac{dz}{iz}\\
&=&\frac12\int_{|z|=1}\bigg(\frac{z^2-1}{2i(5z-2z^2-2)}\bigg)^2\frac{dz}{iz}\\
&=&-\frac1{8i}\int_{|z|=1}\bigg(\frac{z^2-1}{2z^2-5z+2}\bigg)^2\frac{dz}{z}\\
&=&-\frac1{8i}\int_{|z|=1}\frac{(z^2-1)^2}{z(2z-1)^2(z-2)^2}dz\\
&=&-\frac1{32i}\int_{|z|=1}\frac{(z^2-1)^2}{z(z-\frac{1}{2})^2(z-2)^2}dz\\
&=&-\frac1{32i}\cdot2\pi i\left(\text{Res}\bigg(\frac{(z^2-1)^2}{z(z-\frac{1}{2})^2(z-2)^2},z=0\bigg)+\text{Res}\bigg(\frac{(z^2-1)^2}{z(z-\frac{1}{2})^2(z-2)^2},z=\frac12\bigg)\right)\\
&=&-\frac\pi{16}(1-\frac{5}{3})\\
&=&\frac{\pi}{24}.
\end{eqnarray}
A: Here you seemed pretty sure of your (fine) proof of
$$ \sum_{n\geq 1}\frac{\sin(nx)}{2^n} = \frac{2\sin x}{5-4\cos x} \tag{A}$$
so I wonder how you can be uncertain of the mentioned equality. Given $(A)$, by Parseval's identity
$$ \int_{0}^{\pi}\left(\frac{\sin x}{5-4\cos x}\right)^2\,dx =\frac{1}{8}\sum_{n\geq 1}\frac{\pi}{4^n}=\frac{\pi}{24}\tag{B}$$
nice and easy.
A: The following approach does not use anything beyond the material available in a first course in calculus.

Note that $$\frac{d} {dx} \frac{1}{5-4\cos x} =-\frac{4\sin x} {(5-4\cos x) ^{2}}$$ and hence using integration by parts we have $$I=\left.-\frac{\sin x}{4(5-4\cos x)}\right|_{x=0}^{x=\pi}+\frac{1}{4}\int_{0}^{\pi}\frac{\cos x} {5-4\cos x}\, dx$$ The first term vanishes and the second term can be written as $$-\frac{1}{16}\int_{0}^{\pi}\left(1-\frac{5}{5-4\cos x} \right) \, dx$$ and this evaluates to $$-\frac{\pi} {16}+\frac{5}{16}\frac{\pi}{3}=\frac{\pi}{24}$$ Here we have used the formula $$\int_{0}^{\pi}\frac{dx}{a + b\cos x} =\frac{\pi} {\sqrt{a^{2}-b^{2}}},\, a>|b|$$ which is (not so) easily proved via the substitution $$(a+b\cos x) (a-b\cos y) =a^{2}-b^{2}$$
A: A slight improvement in the complex method - doing it this way you only have to calculate one residue instead of two.  Noting that
$$\int_{-\pi}^\pi \frac{\sin2x}{(5-4\cos x)^2}\,dx=0$$
because the integrand is odd, your integral $I$ is given by
$$\eqalign{I
  &=\frac12\int_{-\pi}^\pi \frac{\sin^2x}{(5-4\cos x)^2}\,dx\cr
  &=\frac14\int_{-\pi}^\pi \frac{1-\cos2x}{(5-4\cos x)^2}\,dx\cr
  &=\frac14\int_{-\pi}^\pi \frac{1-\cos2x-i\sin2x}{(5-4\cos x)^2}\,dx\cr
  &=\frac14\int_{\rm unit\ circle}
    \frac{1-z^2}{(5-2(z+\frac1z))^2}\,\frac{dz}{iz}\cr
  &=\frac1{4i}\int_{\rm uc} \frac{z(1-z^2)}{(2z^2-5z+2)^2}\,dz\cr
  &=\frac\pi2\,{\rm Res}\Bigl(\frac{z(1-z^2)}{(2z^2-5z+2)^2},z=\frac12\Bigr)\cr}$$
and I'll leave you to show that the residue is $\frac1{12}$.
A: Tha tangent half-angle substitution is not so bad since using $t=\tan(\frac x2)$
$$I=\int\biggl(\frac{\sin(x)}{5-4\cos(x)}\biggr)^2dx=\int\frac{8 t^2}{\left(t^2+1\right) \left(9 t^2+1\right)^2}\,dt$$ Using partial fractions
$$\frac{8 t^2}{\left(t^2+1\right) \left(9 t^2+1\right)^2}=\frac{9}{8 \left(9 t^2+1\right)}-\frac{1}{\left(9 t^2+1\right)^2}-\frac{1}{8
   \left(t^2+1\right)}$$ The second term needs to be integrated by parts. So, we have
$$\int\frac{dt}{\left(9 t^2+1\right)}=\frac{1}{3} \tan ^{-1}(3 t)$$
$$\int\frac{dt}{\left(9 t^2+1\right)^2}=\frac{t}{2 \left(9 t^2+1\right)}+\frac{1}{6} \tan ^{-1}(3 t)$$
$$\int\frac{dt}{
   \left(t^2+1\right)}=\tan ^{-1}( t)$$ making
$$I=-\frac{t}{2 \left(9 t^2+1\right)}-\frac{1}{8} \tan ^{-1}(t)+\frac{5}{24} \tan ^{-1}(3 t)$$ Integrating between $0$ and $\infty$, the first term is $0$ and you are left with $$\frac 5 {24}\frac \pi 2-\frac 1 {8}\frac \pi 2=\frac \pi {24}$$
