How do I evaluate this integral $\int_0^\pi{\frac{{{x^2}}}{{\sqrt 5-2\cos x}}}\operatorname d\!x$? 
Show that $$\int\limits_0^\pi{\frac{{{x^2}}}{{\sqrt 5-2\cos x}}}\operatorname d\!x =\frac{{{\pi^3}}}{{15}}+2\pi \ln^2 \left({\frac{{1+\sqrt 5 }}{2}}\right).$$

I don't have any idea how to start, but maybe I could use the Polylogarithm.
 A: This is a more difficult integral than it appears.  Let's define 
$$J(a) = \int_{-\pi}^{\pi} dx \frac{e^{i a x}}{\sqrt{5}-2 \cos{x}}$$
Then the integral we seek is
$$-\frac12 J''(0) = \int_0^{\pi} dx \frac{x^2}{\sqrt{5}-2 \cos{x}}$$  
To evaluate $J(a)$, consider the following contour integral in the complex plane:
$$\oint_C dz \frac{z^a}{z^2-\sqrt{5} z+1}$$
where $C$ is a "keyhole" unit circle, with the keyhole being about the negative real axis, as pictured below.  

By the residue theorem, this contour integral is equal to 
$$-i 2 \pi \phi^a$$
where $\phi = (\sqrt{5}-1)/2$ is the golden ratio.  On the other hand, the integral is also equal to
$$-i J(a) + i 2 \sin{\pi a} \, \int_0^1 dx \frac{x^a}{x^2+\sqrt{5} x+1}$$
Note that the portion of the integral that goes about the center goes to zero.  Therefore we have
$$J(a) = 2 \pi \phi^a + 2 \sin{\pi a} \, \int_0^1 dx \frac{x^a}{x^2+\sqrt{5} x+1}$$
With some quick work, the integral we seek is then
$$-\frac12 J''(0) = -\pi \log^2{\phi} - 2 \pi \int_0^1 dx \frac{\log{x}}{x^2+\sqrt{5} x+1} $$
Using the fact that
$$\frac{1}{x^2+\sqrt{5} x+1} = \frac{1}{x+\phi}-\frac{1}{x+1/\phi}$$
$$\int_0^1 dx \frac{\log{x}}{x+a} = \text{Li}_2{\left ( -\frac{1}{a}\right)}$$
$$\text{Li}_2{\left ( -\frac{1}{\phi}\right)} = -\frac{\pi^2}{10} - \log^2{\phi}$$
$$\text{Li}_2{\left ( -\phi\right)} = -\frac{\pi^2}{15} +\frac12 \log^2{\phi}$$
We finally have
$$-\frac12 J''(0) = -\pi \log^2{\phi} - 2 \pi \left [\left ( -\frac{\pi^2}{10} - \log^2{\phi} \right ) - \left ( -\frac{\pi^2}{15} +\frac12 \log^2{\phi} \right ) \right ]$$
or
$$ \int_0^{\pi} dx \frac{x^2}{\sqrt{5}-2 \cos{x}} = 2 \pi \log^2{\phi} + \frac{\pi^3}{15}$$
as was to be shown.
A: Using the identity $$ \sum_{k=0}^{\infty} a^{k} \cos(kx) = \frac{1- a \cos x}{1-2a \cos x + a^{2}} \ \  ( |a| <1) ,$$
one finds that  $$ 1 + 2 \sum_{k=1}^{\infty} a^{k} \cos(kx) = \frac{1-a^{2}}{1-2a \cos x +a^{2}}.$$
Therefore
$$ \begin{align} \int_{0}^{\pi} \frac{x^{2}}{1-2a \cos x+a^{2}} \ dx &= \frac{1}{1-a^{2}} \Big( \int_{0}^{\pi} x^{2} \ dx + 2 \int_{0}^{\pi}x^{2} \sum_{k=1}^{\pi} a^{k} \cos (kx) \ dx \Big) \\ &= \frac{1}{1-a^{2}} \Big(\frac{\pi^{3}}{3} + 2 \sum_{k=1}^{\infty} a^{k} \int_{0}^{\pi} x^{2} \cos(kx) \ dx \Big) \\ &=\frac{1}{1-a^{2}} \Big( \frac{\pi^{3}}{3} + 2 \sum_{k=1}^{\infty}a^{k} \frac{2 \pi (-1)^{k}}{k^{2}} \Big) \\ &= \frac{1}{1-a^{2}} \Big( \frac{\pi^{3}}{3} +4 \pi \sum_{k=1}^{\infty}\frac{(-a)^{k}}{k^{2}} \Big) \\ &= \frac{1}{1-a^{2}} \Big(\frac{\pi^{3}}{3} + 4 \pi \ \text{Li}_{2}(-a) \Big) . \end{align}$$
Now express the integral as $$  \frac{1}{1+a^{2}} \int_{0}^{\pi} \frac{x^{2}}{1- \frac{2a}{1+a^{2}} \cos x} \ dx$$
and let  $ \displaystyle a = \frac{1}{\varphi}$ where $\varphi$ is the golden ratio.
Then we have$$ \begin{align} \frac{1}{1+\varphi^{-2}} \int_{0}^{\pi} \frac{x^{2}}{1-\frac{2 \varphi^{-1}}{1+\varphi^{-2}} \cos x} \ dx &= \frac{1}{1+\varphi^{-2}} \int_{0}^{\pi} \frac{x^{2}}{1-\frac{2}{\sqrt{5}} \cos x} \ dx \\ &=\frac{\sqrt{5}}{1+\varphi^{-2}} \int_{0}^{\pi} \frac{x^{2}}{\sqrt{5}-2 \cos x} \ dx \\ &= \frac{1}{1-\varphi^{-2}} \Big(\frac{\pi^{3}}{3} + 4 \pi \ \text{Li}_{2} (- \frac{1}{\varphi}) \Big) \\ &= \frac{1}{1-\varphi^{-2}} \Big(\frac{\pi^{3}}{15} + 2 \pi \ln^{2} (\varphi) \Big) \end{align} $$ 
which implies $$ \begin{align} \int_{0}^{\pi} \frac{x^{2}}{\sqrt{5}-2 \cos x} \ dx &= \frac{1}{\sqrt{5}} \frac{1+\varphi^{-2}}{1- \varphi^{-2}} \Big(\frac{\pi^{3}}{15} + 2 \pi \ln^{2} (\varphi) \Big) \\ & = \frac{1}{\sqrt{5}} \sqrt{5}\Big(\frac{\pi^{3}}{15} + 2 \pi \ln^{2} (\varphi) \Big) \\ &= \frac{\pi^{3}}{15} + 2 \pi \ln^{2} (\varphi) . \end{align} $$
