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) $$


I'll do this one $$\int_{0}^{2\pi}\frac{cos(2\theta)}{a+bcos(\theta)}d\theta$$if we know how to do tis one you can replace $sin^{2}(\theta)$ by $\frac{1}{2}(1-cos(2\theta))$ and do the same thing.  if we ae on the unit circle we know that $cos(\theta)=\frac{e^{i\theta}+e^{-i\theta}}{2}$ so by letting $z=e^{i\theta}$ we wil get$$cos(\theta)=\frac{z+\frac{1}{z}}{2}=\frac{z^2+1}{2z}$$and$$cos(2\theta)=\frac{z^2+\frac{1}{z^2}}{2}=\frac{z^4+1}{2z^2}$$ thus, if$\gamma: |z|=1$ the integral becomes $$\int_{\gamma}\frac{\frac{z^4+1}{2z^2}}{a+b\frac{z^2+1}{2z}}\frac{1}{iz}dz=\int_{\gamma}\frac{-i(z^4+1)}{2z^2(bz^2+2az+b)}dz$$now the roots of $bz^2+2az+b$ are $z=\frac{-2a\pm \sqrt{4a^2-4b^2}}{2b}=\frac{-a}{b}\pm\frac{\sqrt{a^2-b^2}}{b}$, you can check that the only root inside $|z|=1$ is $z_1=\frac{-a}{b}+\frac{\sqrt{a^2-b^2}}{b}$ so the only singularities of the function that we want to integrate inside $\gamma$ are $z_0=0$ and $z_1$ both are poles. find the resudies and sum them to get the answer.Notice that this will only give youe "half" the answer you still have to do$$\frac{1}{2}\int_{\gamma}\frac{d\theta}{a+bcos(\theta)}$$ in the same way to get the full answer.
