How many methods are there to find $\int_{0}^{\pi} \frac{d \theta}{a+b \cos \theta}, \textrm{ where }a>b>0$ When I deal with this simple integral, I found there are several methods. Now I share one of them.
Letting $x\mapsto \pi-x $ yields $$I=\int_{0}^{\pi} \frac{d \theta}{a+b \cos \theta}=\int_{0}^{\pi} \frac{d \theta}{a-b \cos \theta}$$
Adding two versions together yields
$$
\begin{aligned}
2 I &=2 a \int_{0}^{\pi} \frac{d \theta}{a^{2}-b^{2} \cos ^{2} \theta} \\
&=4 a\int_0^{\frac{\pi}{2}} \frac{\sec ^{2} \theta}{a^{2} \sec ^{2} \theta-b^{2}} d \theta \quad \textrm{( By symmetry )}\\
&=4 a{\int_{0}^{\infty}} \frac{d t}{\left(a^{2}-b^{2}\right)+a^{2} t^{2}} \\
&=\frac{4}{\sqrt{a^{2}-b^{2}}}\left[\tan^{-1} \left(\frac{at}{\sqrt{a^{2}-b^{2}}}\right)\right]_{0}^{\infty} \\
&=\frac{2 \pi}{\sqrt{a^{2}-b^{2}}}
\end{aligned}
$$
We can now conclude that $$
\boxed{I=\frac{\pi}{\sqrt{a^{2}-b^{2}}}}
$$
Are there any other methods to deal with the integral?
 A: Here's an interesting geometric approach I read in one of Jack D' Aurizio's answers (and have never forgotten). It's not as efficient as using a Weierstrass substitution but I believe the geometric interpretation itself merits some sort of recognition.
For a closed and continuous curve $r(\theta)$ where $0\leq\theta\leq2\pi$, then the area of the region bounded by $r$ can be expressed as
$$A=\frac 12\int\limits_0^{2\pi}r^2(\theta)\,\mathrm d\theta$$
In this problem's case, we can transform the integral into the form above by observing that
$$I=\int\limits_0^{\pi}\frac {\mathrm d\theta}{\left(a+b\cos\theta\right)^2}=\frac 12\int\limits_0^{2\pi}\frac {\mathrm d\theta}{(a+b\cos\theta)^2}$$
Therefore, when
$$r=\frac 1{a+b\cos\theta}$$
the integral $I$ describes the area of an ellipse, which is equal to $\pi$ times the product of the semi-axis. Converting to rectangular coordinates, then we get
$$\frac {\left(a^2-b^2\right)^2}{a^2}\left(x+\frac b{a^2-b^2}\right)^2+\left(a^2-b^2\right)y^2=1$$
Thus, the area is then
$$\int\limits_0^{\pi}\frac {\mathrm d\theta}{(a+b\cos\theta)^2}=\pi\cdot\frac a{a^2-b^2}\cdot\frac 1{\sqrt{a^2-b^2}}=\frac {\pi a}{\left(a^2-b^2\right)^{3/2}}$$
Now, integrate both sides with respect to $a$ to see that
$$\int\limits_0^{\pi}\frac {\mathrm d\theta}{a+b\cos\theta}\color{blue}{=\frac {\pi}{\sqrt{a^2-b^2}}}$$
A: One more
$$I=\int_{0}^{\pi} \frac{dx}{a+b \cos x}=\int_{0}^{\pi}\frac{dx}{a+b(2\cos^2(x/2)-1)}, a>b.$$
Use $t=x/2$, then
$$I=\int_{0}^{\pi/2} \frac{2dt}{a-b+2b \cos^2 t}=\int_{0}^{\pi/2} \frac{2\sec^2t ~dt}{(a-b)\sec^2 t+2b}=2\int_{0}^{\pi/2} \frac{\sec^2 t~dt}{(a+b)+(a-b)\tan^2 t}$$
Let $\tan t=u$, then
$$I=\frac{2}{a-b}\int_{0}^{\infty}\frac{du}{u^2+\frac{a+b}{a-b}}=\frac{2}{\sqrt{a^2-b^2}} \tan^{-1} u|_{0}^{\infty}=\frac{\pi}{\sqrt{a^2-b^2}}.$$
A: By Weierstrass substitution
Letting $t=\tan \frac{\theta}{2}$ transforms the integral
$$
\begin{aligned}
I&=\int_{0}^{\pi} \frac{1}{a+\frac{b\left(1-t^{2}\right)}{1+t^{2}}} \frac{2 d t}{1+t^{2}}\\
&=2 \int_{0}^{\infty} \frac{d t}{(a+b)+(a-b) t^{2}}\\
&=\frac{2}{\sqrt{a-b} \sqrt{a+b}} \left[\tan ^{-1}\left(\frac{\sqrt{a-b}t}{\sqrt{a+b}}\right)\right]_{0}^{\infty}\\
&=\frac{\pi}{\sqrt{a^{2}-b^{2}}}
\end{aligned}
$$
A: By Contour Integration
Considering the integral
$$
J=\int_{0}^{2 \pi} \frac{d \theta}{a+b \cos \theta}.
$$
Let $z=e^{\theta i}$, then $\cos \theta=\frac{1}{2}\left(y+\frac{1}{z}\right)$ and $d z =i e^{\theta i} d \theta=i z d \theta .$
$$
\begin{aligned}
\\
J &=\int_{K(0,1)} \frac{1}{a+\frac{b}{2}\left(z+\frac{1}{z}\right)} \cdot \frac{d z}{i z} \\
&=-2 i \int_{K(0,1)} \frac{1}{b z^{2}+2 a z+b} d z \\
&=-2 i \int_{K(0,1)} \frac{1}{b(z-\alpha)(z-\beta)} d z
\end{aligned}
$$
where K(0,1) is the unit circle with centre O,  $\alpha=\frac{-a-\sqrt{a^{2}-b^{2}}}{b}$ and $\beta=\frac{-a+\sqrt{a^{2}-b^{2}}}{b}$.
Noting that $|\alpha|>1$ and $|\beta |<1$, therefore $\beta$ is only one residue in $K(0,1).$
$$
\begin{aligned}
J &=-2 i\left[2 \pi i \operatorname{Res}\left(\frac{1}{b(z-\alpha)(z-\beta)}, \alpha\right)\right] \\
&=4 \pi \lim _{z \rightarrow \beta}(z-\beta) \frac{1}{b(z-\alpha)(z-\beta)} \\
&=4 \pi \frac{1}{b(\beta-\alpha)} \\
&=4 \pi \frac{1}{2 \sqrt{a^{2}-b^{2}}} \\
&=\frac{2 \pi}{\sqrt{a^{2}-b^{2}}}
\end{aligned}
$$
By symmetry, \begin{equation}
I=\frac{1}{2} J=\frac{\pi}{\sqrt{a^{2}-b^{2}}}
\end{equation}
A: Here is a rather convoluted way to deal with it.....
$$\int_{0}^{\pi}{d\theta\over a+b\space cos(\theta)}$$
$${1\over a}\int_{0}^{\pi}{d\theta\over 1 + {b\over a}cos(\theta)}={1\over a}\sum_{n=0}^{\infty}(-{b\over a})^n\int_{0}^{\pi}cos^n(\theta)d\theta$$
Leveraging the symmetry of $cos^n(\theta)$ over the interval $[0,\pi]$ yields;
$${1\over a}\sum_{n=0}^{\infty}({b\over a})^{2n}\space[2\int_{0}^{\pi/2}cos^{2n}(\theta)d\theta]$$
The integral is now in the form of the "Beta Function" which is defined as;
$$B(x,y)=2\int_{0}^{\pi\over 2}(cos^{2x-1}(\theta))(sin^{2y-1}(\theta))d\theta = {\Gamma(x)\Gamma(y)\over\Gamma(x+y)}$$
So we have;
$${1\over a}\sum_{n=0}^{\infty}({b\over a})^{2n}\space[2\int_{0}^{\pi/2}cos^{2n}(\theta)d\theta]={1\over a}{\sum_{n=0}^{\infty}{({b\over a})^{2n}}}B({2n+1\over 2},{1\over2})={1\over a}{\sum_{n=0}^{\infty}{({b\over a})^{2n}}}{\Gamma({2n+1\over 2})\Gamma({1\over2})\over\Gamma({2n+2\over2})}$$
Utilizing a few known values and properties of the Gamma Function gives us;
$${\pi\over a}{\sum_{n=0}^{\infty}{({b\over a})^{2n}}}{(2n)!\over 2^{2n}(n!)^{2}}$$
Which yields;
$${\pi\over a}{\sum_{n=0}^{\infty}{1\over4^n}{2n \choose n}{({b\over a})^{2n}}}={\pi\over a}{\sum_{n=0}^{\infty}{(-1)^{n}}{1\over4^n}{2n \choose n}{({-b^2\over a^2})^{n}}}$$
$$={\pi\over a}(1-{({-b^2\over a^2})^1\over2}+{3({-b^2\over a^2})^2\over 8}-{5({-b^2\over a^2})^3\over16}+...)$$
This sum is just the binomial expansion of $1\over\sqrt{1-{b^2\over a^2}}$...
$$\therefore {\pi\over a}(1-{({-b^2\over a^2})^1\over2}+{3({-b^2\over a^2})^2\over 8}-{5({-b^2\over a^2})^3\over16}+...) = {\pi\over\sqrt{a^2-b^2}}_{\square}$$
A: Given $I(a)=\int_{0}^{\pi} \ln (a+b \cos x)dx
=\pi \ln\frac{a+\sqrt{a^2-b^2}}2$
$$\int_{0}^{\pi} \frac{1}{a+b \cos \theta}d\theta
=\frac{dI(a)}{da}=\frac{\pi}{\sqrt{a^{2}-b^{2}}}
$$
