Evaluate $\int_{0}^{\pi} \frac{d\theta}{(2+\cos\theta)^2}$ How can one evaluate $\displaystyle\int_{0}^{\pi} \frac{d\theta}{(2+\cos\theta)^2}$?
My attempt:
$$\int_{0}^{\pi} \frac{d\theta}{(2+\cos\theta)^2} =  \frac{1}{2}\int_{0}^{2\pi} \frac{d\theta}{(2+\cos\theta)^2}$$
To find the singularity, I solve:
$ (2+\cos\theta)^2 = 0 $ and therefore, $\cos\theta =  -2$.
Substituting: $\cos z = \frac{e^{iz} + e^{-iz}}{2} = \frac{z + \frac{1}{z}}{2}$,
I find that $z = -2 + \sqrt{3} $ is the singular point that lies in the unit circle $|z| = 1$.
From this point, I have little idea how to go about solving this problem. I know I have to find the residue and then just sum them but to get the expression that would cancel out the pole is where I am currently stuck.
 A: I will start from the point where you left off.  The integral may be written as, upon substitution of $z=e^{i \theta}$:
$$\begin{align}\frac{1}{2} \int_0^{2 \pi} \frac{d\theta}{(2+\cos{\theta})^2} &= -i 2 \oint_{|z|=1} dz \frac{z}{(z^2+4 z+1)^2}\\ &= -i 2 \oint_{|z|=1} dz \frac{z}{(z+2-\sqrt{3})^2 (z+2+\sqrt{3})^2}\end{align}$$
after a bit of algebra.  This integral is $i 2 \pi$ times the sum of the residues of the poles within the integration contour.  The only pole inside this contour, as you point out, is the pole at $z=-2+\sqrt{3}$.  The other pole at $z=-2-\sqrt{3}$ is outside this contour and is not counted.  
To compute the residue at this pole, note that we have double roots.  For such roots, we have to take a derivative:
$$\mathrm{Res}_{z=-2+\sqrt{3}} \frac{-i 2 z}{(z+2-\sqrt{3})^2 (z+2+\sqrt{3})^2} = \lim_{z \rightarrow -2+\sqrt{3}} \left [\frac{d}{dz} \frac{-i 2 z}{(z+2+\sqrt{3})^2} \right ]$$
I will leave the algebra to the reader; the result is $-i \sqrt{3}/9$.  The integral is then
$$\int_0^{\pi} \frac{d\theta}{(2+\cos{\theta})^2} = i 2 \pi \frac{-i \sqrt{3}}{9} = \frac{2 \sqrt{3}}{9} \pi$$
A: Trigonometric substitution:
$$x=\tan\frac{\theta}{2}\Longrightarrow d\theta=\frac{2}{x^2+1}dx\;\;,\;\;\cos\theta=\frac{1-x^2}{1+x^2}\Longrightarrow$$
$$\int\limits_0^\pi\frac{d\theta}{(2+\cos\theta)^2}=\int\limits_0^\infty\frac{2\,dx}{1+x^2}\frac{1}{\left(2+\frac{1-x^2}{1+x^2}\right)^2}=2\int\limits_0^\infty\frac{x^2+1}{(x^2+3)^2}dx=$$
$$2\int\limits_0^\infty\left(\frac{1}{3+x^2}-\frac{2}{(3+x^2)^2}\right)=\left.\frac{2}{\sqrt 3}\arctan\frac{x}{\sqrt 3}\right|_0^\infty-\left.4\left(\frac{x}{6(3+x^2)}+\frac{1}{6\sqrt 3}\arctan\frac{x}{\sqrt 3}\right)\right|_0^\infty=$$
$$=\frac{4}{3\sqrt 3}\frac{\pi}{2}=\frac{2\pi}{3\sqrt 3}$$
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[10px,#ffd]{\int_{0}^{\pi}{\dd\theta \over \bracks{2 + \cos\pars{\theta}}^{\,2}}} =
\left.-\,\totald{}{\mu}\int_{0}^{\pi}{\dd\theta \over \mu + \cos\pars{\theta}}
\right\vert_{\ \mu\ =\ 2}
\\[5mm] = &\
-\,\totald{}{\mu}\braces{\int_{0}^{\pi/2}{\dd\theta \over \mu + \cos\pars{\theta}} +
\int_{-\pi/2}^{0}{\dd\theta \over \mu - \cos\pars{\theta}}}_{\mu\ =\ 2}
\\[5mm] = &\
\left.-\,\totald{}{\mu}\int_{0}^{\pi/2}{2\mu \over
\mu^{2} - \cos^{2}\pars{\theta}}\,\dd\theta\,\right\vert_{\ \mu\ =\ 2}
\\[5mm] = &\
\left.-2\,\totald{}{\mu}\int_{0}^{\pi/2}{\mu \over
\mu^{2}\sec^{2}\pars{\theta} - 1}
\,\sec^{2}\pars{\theta}\,\dd\theta\,\right\vert_{\ \mu\ =\ 2}
\\[5mm] = &\
\left.-2\,\totald{}{\mu}\int_{0}^{\infty}{\mu \over
\mu^{2}t^{2} + \mu^{2} - 1}
\,\dd t\,\right\vert_{\ \mu\ =\ 2}
\\[5mm] = &
\left.-\pi\,\totald{}{\mu}{1 \over \root{\mu^{2} - 1}}\right\vert_{\ \mu\ =\ 2} =
\bbx{\ds{{2\root{3} \over 9}\,\pi}}
\end{align}
