<s>[INST] Evaluate $\int\frac{dx}{(a+b\cos(x))^2},(a>b)$ Evaluate $$\int\frac{dx}{(a+b\cos(x))^2},(a>b)$$

I tried to write 1 in numerator as $p'(x)(a+b\cos(x))-p(x)(a+b \cos(x))'$,making something like quotient rule but did not get after that.

 [/INST] $$I=\int \frac{dx}{(a+b\cos x)^2} \\=\int\frac{dx}{\left(a+b\cdot \frac{1-\tan^2 \frac x2}{1+\tan^2 \frac x2} \right)^2}\\=\int\frac{1+\tan^2 \frac x2}{\left(a(1+\tan^2 \frac x2) +b(1-\tan^2\frac x2)\right)^2} \sec^2\frac x2 \ dx \\ \overset{t=\tan \frac x2}=2\int\frac{1+t^2}{\left[(a-b)t^2 +a+b\right]^2} dt$$ Use partial fractions to break this down into $$ \underbrace{\frac{1}{a-b}\int \frac{dt}{(a-b)t^2 +a+b} }_{I_1} -\underbrace{\frac{2b}{a-b}\int\frac{dt}{\left((a-b)t^2 +a+b\right)^2}}_{I_2}$$ $I_1$ is easy to evaluate (use the arctan function). For $I_2$, substitute $t^2=\frac{a+b}{a-b}\tan^2y$, which results in a massive simplification: $$I_2 =\frac{1}{(a+b)\sqrt{a^2-b^2}}\int \cos^2y \ dy $$ Hopefully you can take it from here.
</s>