After trying, I realized that I can't evaluate this using the usual simple integration:
$\int_{0}^{\pi} \frac{d\theta}{(a+cos\theta)^2}, a>1$
I was given the hint that:
$\int_{0}^{\pi} \frac{d\theta}{(a+cos\theta)^2}, a>1 = -\frac{d}{da} \int_{0}^{\pi} \frac{d\theta}{(a+cos\theta)}$
Although, I have not yet figured out why they are equal. But after that, what do I do next? Possibly contour integration or Weierstrass/tangent half-angle substitution but I'm having difficulty understanding how to do that. Any help to clear this out or teach me how to do it. Any help would be appreciated! Thank you in advance!
According to Leibniz's integral rule, since $f(a,\theta) = 1/(a+\cos\theta)$ and $f_{a}$ are continuous in both $a$ and $\theta$, we can interchange the integral and derivative as follows.
$$ \begin{aligned} \dfrac{\text{d}}{\text{d}a} \color{red}{\int_{0}^{\pi} \dfrac{1}{a + \cos \theta} \text{ d}\theta} \ & = \int_{0}^{\pi} \dfrac{\partial}{\partial a} \left( \dfrac{1}{a + \cos \theta} \right) \text{ d}\theta \\[5pt] & = - \color{blue}{\int_{0}^{\pi} \dfrac{1}{\left(a + \cos \theta \right)^2} \text{ d}\theta} \end{aligned}$$
Thus, we've simplified $\color{blue}{\text{the}}$ $\color{blue}{\text{integral}}$ $\color{blue}{\text{we're}}$ $\color{blue}{\text{interested}}$ $\color{blue}{\text{in}}$ to the derivative of $\color{red}{\text{an}}$ $\color{red}{\text{integral}}$ $\color{red}{\text{we}}$ $\color{red}{\text{can}}$ $\color{red}{\text{compute}}$. The Weierstrass substitution turns rational functions of trigonometric functions into rational functions we can evaluate more easily. Let $t = \tan \theta/2$ and draw the corresponding triangle with $t$ as the opposite and $1$ as the adjacent.
The hypotenuse can be found using Pythagoras' theorem and the double angle formula gives us an expression for $\cos \theta$ in terms of $t$. $$ \implies \cos \theta/2 = 1/\sqrt{1+t^2} \implies \cos \theta = \frac{1-t^2}{1+t^2}$$
The final step to transforming the integral from $\theta$ to $t$ is to deal with the differential. $$\begin{aligned} t = \tan \frac{\theta}{2} \ \implies \ \text{dt} & = \frac{1}{2} \sec^2 \frac{\theta}{2} \text{ d}\theta \\[3pt] & = \frac{1}{2}\left(1 + \tan^2 \frac{\theta}{2}\right) \text{ d}\theta \\[3pt] & = \frac{1}{2}(1+t^2) \text{ d}\theta \end{aligned} $$ $$ \therefore \dfrac{2}{1+t^2} \text{ d}t = \text{d}\theta $$ From here on out, it's a partial fraction decomposition of the integrand and fun stuff.