Calculation of $\int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x} dx\;,$

Calculate the definite integral

I=\int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x}\;dx

given that $a>b>0$

My Attempt:

If we replace $x$ by $C$, then

I = \int_{0}^{\pi}\frac{\sin^2 C}{a^2+b^2-2ab\cos C}\;dC

Now we can use the Cosine Formula ($A+B+C=\pi$). Applying the formula gives

\cos C &= \frac{a^2+b^2-c^2}{2ab}\\
a^2+b^2-2ab\cos C &= c^2

From here we can use the formula $\frac{\sin A}{a} = \frac{\sin B}{b} = \frac{\sin C}{c}$ to transform the integral to

I &= \int_{0}^{\pi}\frac{\sin^2 C}{c^2}\;dC\\
&= \int_{0}^{\pi}\frac{\sin^2A}{a^2}\;dC\\
&= \int_{0}^{\pi}\frac{\sin^2 B}{b^2}\;dC

Is my process right? If not, how can I calculate the above integral?

Solutions Collecting From Web of "Calculation of $\int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x} dx\;,$"

We have
\int_0^\pi\frac{\cos(mx)}{a^2-2ab\cos x+b^2}dx
Proof can be seen here. Hence
\int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x}\, dx&=\frac{1}{2}\int_0^{\pi} \frac{1-\cos2 x}{a^2+b^2-2ab \cos x}\, dx\\
&=\frac{\pi}{2 a^2}

Such integral is related with the topological degree of a closed curve. We have:

$$ I = \frac{1}{2}\int_{0}^{2\pi}\frac{\sin^2 x}{\|a-be^{ix}\|^2}\,dx = -\frac{i}{2}\oint_{\|z\|=1}\frac{\left(\frac{z-z^{-1}}{2}\right)^2}{(a-bz)(az-b)}\,dz$$
hence we just have to consider the residues of the last integrand function in $z=0$ and $z=\frac{b}{a}$ (since $a>b>0$). That just leads to:
$$ I = \frac{\pi}{2a^2}.$$

Using the formula $$a^2+b^2-ab\cos C = c^2\;,$$ Now If $C\leftrightarrow x\;,$ Then $a^2+b^2-2ab\cos x= c^2$

So Integral Convert into $$\displaystyle I = \int_{0}^{\pi}\frac{\sin^2 C}{c^2}dC\;,$$ Now Using Sin formula $\displaystyle \frac{\sin C}{c} = \frac{\sin A}{a}.$

So $$\displaystyle I = \int_{0}^{\pi}\frac{\sin^2 A}{a^2}dC\;,$$ Now $A+B+C = \pi\;,$ Then $dC = 0-dA-dB$

Now when $C\rightarrow 0,$ Then $A\rightarrow \pi$ and $B\rightarrow 0$

When $C\rightarrow 0,$ Then $A\rightarrow 0$ and $B\rightarrow 0$

So $$\displaystyle I = \int_{\pi}^{0}\frac{\sin^2 A}{a^2}(-dA)+\int_{0}^{0}\frac{\sin^2 A}{a^2}(-dB)$$

So $$\displaystyle I = \int_{0}^{\pi}\frac{\sin^2 A}{a^2}dA = \frac{2}{2a^2}\int_{0}^{\frac{\pi}{2}}\left[1-\cos 2A\right]dA = \frac{\pi}{2a^2}$$

Can anyone explain me is my Solution is Right or not,