# Integrate $\int_0^{2\pi}\frac{dx}{(2+\cos(x))}$ using complex integral theorem [closed]

Would someone help me to integrate

$$\int_0^{2\pi}\frac{dx}{(2+\cos(x))}$$

by means of residue theorem?

## closed as off-topic by Watson, Davide Giraudo, Cyclohexanol., Shailesh, user223391 Sep 20 '16 at 19:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Watson, Davide Giraudo, Cyclohexanol., Shailesh, Community
If this question can be reworded to fit the rules in the help center, please edit the question.

Use $z=e^{ix}$, then \begin{align} \int_0^{2\pi}\frac1{2+\cos(x)}\,\mathrm{d}x &=\oint_{|z|=1}\frac1{2+\frac{z+\frac1z}2}\frac{\mathrm{d}z}{iz}\\ &=\frac2i\oint_{|z|=1}\frac{\mathrm{d}z}{z^2+4z+1}\\ &=\frac1{i\sqrt3}\oint_{|z|=1}\left(\frac1{z+2-\sqrt3}-\frac1{z+2+\sqrt3}\right)\mathrm{d}z\\ &=\frac1{i\sqrt3}(2\pi i-0)\\[3pt] &=\frac{2\pi}{\sqrt3} \end{align}

Hint. Use the substitution $z=e^{ix}$. Then $2\cos(x)=z+\frac{1}{z}$, $dz=iz\cdot dx$ and $$I:=\int_0^{2\pi}\frac{dx}{(2+\cos(x))}=\int_{|z|=1}\frac{1}{2+\frac{z+\frac{1}{z}}{2}}\cdot \frac{dz}{iz}.$$ Then apply Residue Theorem: $$I=\frac2i\int_{|z|=1}\frac{dz}{z^2+4z+1}=4\pi \cdot\mbox{Res}\left(\frac{1}{z^2+4z+1},\sqrt{3}-2\right) =\frac{4\pi}{2(\sqrt{3}-2)+4}=\frac{2\pi}{\sqrt{3}}.$$

• @Danijel Keno You are welcome again. Don't forget to accept and/or vote one of the answers! math.stackexchange.com/tour – Robert Z Sep 18 '16 at 11:36

Passing into the complex plane with the substitution

$$\cos x \to \cos z = \frac{\left(z + z^{-1}\right)}{2} ~~~~~~~ \text{d}x = \frac{\text{d}z}{iz}$$

an you get:

$$\int_{|z| = 1} -i \frac{\text{d}z}{z\left(2 + \frac{z + z^{-1}}{2}\right)} = \int_{|z| = 1} -2i \frac{\text{d}z}{z\left(4 + \frac{z^2 + 1}{z}\right)}$$

Arrange the terms:

$$\int_{|z| = 1} -2i \frac{\text{d}z}{4z + z^2 + 1}$$

Now calculate the poles, solving $z^2 + 4z +1 = 0$

The first pole (solution) is $z = -2+\sqrt{3}$ inside the unit circle and it's ok.

The second one is $z = -2-\sqrt{3}$ outside the unit circle so it's not ok.

Result:

$$2\pi i\ \text{Res}_{z = -2+\sqrt{3}}\ (z - 2-\sqrt{3})\frac{-2i}{(z-2-\sqrt{3})(z-2+\sqrt{3})} = \frac{2\pi}{\sqrt{3}}$$

• Thank you very much for the answer and editting the question :) – Danijel Keno Sep 18 '16 at 11:43
• @DanijelKeno Yuo're welcome! In that way your answer is clearer and cleaner :D – Von Neumann Sep 18 '16 at 11:51

A real-analytic alternative:

$$I = \int_{0}^{\pi}\frac{d\theta}{2+\cos\theta}+\int_{0}^{\pi}\frac{d\theta}{2-\cos\theta} = 4\int_{0}^{\pi}\frac{d\theta}{4-\cos^2\theta}=8\int_{0}^{\pi/2}\frac{d\theta}{4-\cos^2\theta}$$ and by substituting $\theta=\arctan t$ $$I = 8 \int_{0}^{+\infty}\frac{dt}{4t^2+3}=\color{red}{\frac{2\pi}{\sqrt{3}}}.$$