This is supposed to be a very easy integral, however I cannot get around.
Evaluate:
$$\int_0^{2\pi} \frac{1}{\cos x + \sin x +2}\, dx$$
What I did is:
$$\int_{0}^{2\pi}\frac{dx}{\cos x + \sin x +2} = \int_{0}^{2\pi} \frac{dx}{\left ( \frac{e^{ix}-e^{-ix}}{2i}+ \frac{e^{ix}+e^{-ix}}{2} +2\right )}= \oint_{|z|=1} \frac{dz}{iz \left ( \frac{z-z^{-1}}{2i} + \frac{z+z^{-1}}{2}+2 \right )}$$
Although the transformation is correct I cannot go on from the last equation. After calculations in the denominator there still appears $i$ and other equations of that. How can I proceed?
Via corindo's rearrangement: we have $$ I = \int_0^{2 \pi} \frac{1}{\sqrt{2}\cos(x - \pi/4) + 2}\,dx =\\ \frac 1{\sqrt{2}} \int_0^{2 \pi} \frac{1}{\cos(x - \pi/4) + \sqrt{2}}\,dx = \\ \frac 1{\sqrt{2}} \int_0^{2 \pi} \frac{1}{\cos(x) + \sqrt{2}}\,dx =\\ \frac 1{\sqrt{2}} \oint_{|z| = 1} \frac{1}{iz((z + z^{-1})/2 + \sqrt{2})}\,dx = \\ \frac {\sqrt{2}}{i} \oint_{|z| = 1} \frac{1}{(z^2 + 2\sqrt{2}z + 1)}\,dz $$ Note the integrand has one pole inside the unit circle, namely $$ z_{0} = 1-\sqrt{2} $$