Need help proving this integration If $a>b>0$, prove that :

$$\int_0^{2\pi} \frac{\sin^2\theta}{a+b\cos\theta}\ d\theta = \frac{2\pi}{b^2} \left(a-\sqrt{a^2-b^2} \right) $$


First step: $\cos(\theta+\pi)=-\cos(\theta)$ and $\sin^2(\theta+\pi)=\sin^2(\theta)$ hence the integral $I$ to be computed is
$$
I=\int_0^\pi\frac{\sin^2\theta}{a+b\cos\theta}\mathrm d\theta+\int_0^\pi\frac{\sin^2\theta}{a-b\cos\theta}\mathrm d\theta=2aJ,
$$
with
$$
J=\int_0^\pi\frac{\sin^2\theta}{a^2-b^2\cos^2\theta}\mathrm d\theta.
$$
Second step: the transformation $\theta\to\theta+\pi$ leaves the integrand unchanged hence one uses the change of variable $t=\tan\theta$, $\mathrm dt=(1+t^2)\mathrm d\theta$, which yields
$$
J=\int_{-\infty}^{+\infty}\frac{t^2}{a^2(1+t^2)-b^2}\frac{\mathrm dt}{1+t^2}.
$$
Third step: the fraction with argument $t^2$ can be decomposed as
$$
\frac{x}{(a^2(1+x)-b^2)(1+x)}=\frac1{b^2}\left(\frac{1}{1+x}-\frac{a^2-b^2}{a^2(1+x)-b^2}\right),
$$
hence
$b^2J=K-(a^2-b^2)L$ with
$$
K=\int_{-\infty}^{+\infty}\frac{\mathrm dt}{1+t^2},\qquad L=\int_{-\infty}^{+\infty}\frac{\mathrm dt}{a^2t^2+a^2-b^2}.
$$
Fourth step:  the change of variable $at=\sqrt{a^2-b^2}s$ yields
$$
L=\frac{\sqrt{a^2-b^2}}a\int_{-\infty}^{+\infty}\frac{\mathrm ds}{(a^2-b^2)(1+s^2)}=\frac{K}{a\sqrt{a^2-b^2}},
$$
and the integral $K$ is classical, its value is $K=\pi$.
Conclusion:
$$
I=2aJ=\frac{2a}{b^2}\left(K-(a^2-b^2)\frac{K}{a\sqrt{a^2-b^2}}\right)=\frac{2\pi}{b^2}\left(a-\sqrt{a^2-b^2}\right)
$$
