<s>[INST] Contour Integral of $\int\limits_0^{2\pi}\frac{d\theta}{1+a\cos\theta}$ for $a^2<1$ (textbook wrong?) My book is telling me that the answer is $\frac{2\pi}{\sqrt{1-a^2}}$. I'm getting an extra a on the numerator. Could somebody verify if I'm wrong, or if it's my book (it has been wrong numerous times).
 [/INST] Contour Integration
$$
\begin{align}
\int_0^{2\pi}\frac{\mathrm{d}\theta}{1+a\cos(\theta)}
&=\oint\frac{2\,\mathrm{d}z}{iz\left(2+az+\frac az\right)}\tag{1}\\
&=-\frac{2i}a\oint\frac{\mathrm{d}z}{z^2+\frac2az+1}\tag{2}\\
&=-\frac{2i}a\oint\frac{\mathrm{d}z}{\left(z+\frac1a+\sqrt{\frac1{a^2}-1}\right)\left(z+\frac1a-\sqrt{\frac1{a^2}-1}\right)}\tag{3}\\
&=\frac{2\pi}{\sqrt{1-a^2}}\tag{4}
\end{align}
$$
Explanation:
$(1)$: $z=e^{i\theta}$
$(2)$: algebra
$(3)$: factor the denominator
$(4)$: the residue of the integrand at $z=-\frac1a+\sqrt{\frac1{a^2}-1}$ is $\frac1{2\sqrt{\frac1{a^2}-1}}$
$\phantom{(4)\text{:}}$ the singularity at $z=-\frac1a-\sqrt{\frac1{a^2}-1}$ is outside the unit circle

Weierstrass Substitution
$$
\begin{align}
\int_0^{2\pi}\frac{\mathrm{d}\theta}{1+a\cos(\theta)}
&=2\int_0^{\pi}\frac{\mathrm{d}\theta}{1+a\cos(\theta)}\tag{5}\\
&=2\int_0^\infty\frac{\frac{2\,\mathrm{d}z}{1+z^2}}{1+a\frac{1-z^2}{1+z^2}}\tag{6}\\
&=4\int_0^\infty\frac{\mathrm{d}z}{(1+a)+(1-a)z^2}\tag{7}\\
&=\frac4{1+a}\sqrt{\frac{1+a}{1-a}}\int_0^\infty\frac{\mathrm{d}z}{1+z^2}\tag{8}\\
&=\frac{2\pi}{\sqrt{1-a^2}}\tag{9}
\end{align}
$$
Explanation:
$(5)$: periodicity and evenness of $\cos(x)$
$(6)$: Weierstrass substitution
$(7)$: algebra
$(8)$: substitute $z\mapsto\sqrt{\frac{1+a}{1-a}}\,z$
</s>