Why does $\int_0^{2\pi} (1+2\cos(x))/(5+4\cos(x))\,dx$ vanish? The standard substitution $y=\tan(x/2)$ shows that 
  $$ \int_0^{2\pi} \frac{1+2\cos(x)}{5+4\cos(x)}\,dx = 0. $$
What is the "real explanation" for this fact? My guess is that the "book proof" involves contour integration; is this correct? Is there an elegant "calculus proof" avoiding technical computations?
Thanks!   
 A: We have, changing the domain of integration, $$\int_{0}^{2\pi}\frac{1+2\cos\left(x\right)}{5+4\cos\left(x\right)}dx=\int_{-\pi}^{\pi}\frac{1+2\cos\left(x\right)}{5+4\cos\left(x\right)}dx.
 $$ Now if we put $u=\tan\left(x/2\right)
 $ we have $$=\int_{-\infty}^{\infty}\frac{6-2u^{2}}{u^{4}+10u^{2}+9}du=2\int_{0}^{\infty}\frac{6-2u^{2}}{u^{4}+10u^{2}+9}du=-4\int_{0}^{\infty}\frac{u^{2}-3}{u^{4}+10u^{2}+9}du
 $$ and now using partial fractions we have $$=-6\int_{0}^{\infty}\frac{1}{u^{2}+9}du+2\int_{0}^{\infty}\frac{1}{u^{2}+1}du=-\frac{2}{3}\int_{0}^{\infty}\frac{1}{\left(u/3\right)^{2}+1}du+2\int_{0}^{\infty}\frac{1}{u^{2}+1}du
 $$ hence, if we put $u/3=v
 $ we have $$=-2\int_{0}^{\infty}\frac{1}{v^{2}+1}dv+2\int_{0}^{\infty}\frac{1}{u^{2}+1}du=0.
 $$
A: Here is a Fourier series-type argument. We have the identity
$$ 1+2r\cos{x}+2r^2\cos{2x}+\dotsb = \frac{1-r^2}{1-2r\cos{x}+r^2}, $$
and we also know that
$$ \int_0^{2\pi} \cos{mx} \cos{nx} \, dx = \pi \delta_{mn}, $$
unless $m=n=0$ in which case the integral is equal to $2\pi$. As a result,
$$ (1-r^2)\int_0^{2\pi} \frac{a+b\cos{x}}{1+r^2 -2r\cos{x}} \, dx 
  = \int_0^{2\pi} (a+b\cos{x})({1+2r\cos{x}}) \, dx = 2\pi(a+br). $$
Choosing here $r=-1/2$, $a=1$, and $b=2$ yields the result.
A: Here is the desired elementary calculus argument. Note first that 
$$
\int_0^{2\pi} \frac{1+2\cos x}{5+4\cos x}\,dx \;=\; 2\int_0^\pi \frac{1+2\cos x}{5+4\cos x}\,dx.
$$
Let $u = \arccos\left(-\dfrac{4+5\cos x}{5+4\cos x}\right)$.  Note that $u$ decreases continuously from $\pi$ to $0$ as $x$ goes from $0$ to $\pi$.  It is easy to check that
$$
1 + 2\cos x\;=\; -3\,\frac{1+2\cos u}{5+4\cos u}\qquad\text{and}\qquad du = \dfrac{-3\,dx}{5+4\cos x},
$$
so
$$
\int_0^\pi \frac{1+2\cos x}{5+4\cos x}\,dx \;=\; \int_\pi^0 \frac{1+2\cos u}{5+4\cos u}\,du \;=\; -\int_0^\pi \frac{1+2\cos u}{5+4\cos u}\,du,
$$
and thus $\displaystyle\int_0^\pi \frac{1+2\cos x}{5+4\cos x}\,dx=0$.

Edit: By the way, the "best" way to evaluate this integral is indeed contour integration.  In particular,
$$
\int_0^{2\pi} \frac{1+2\cos x}{5+4\cos x}\,dx \;=\; \oint_C \frac{1+z+z^{-1}}{5+2z+2z^{-1}}\,\frac{dz}{iz} \;=\; \oint_C \frac{z^2+z+1}{iz(z+2)(2z+1)}\,dz,
$$
where $C$ is the unit circle, and the result follows immediately from the residue theorem (since the residue is $-i/2$ at $0$ and $i/2$ at $-1/2$).

Edit 2: The same argument shows in general that
$$
\int_0^\pi \frac{b+(a+c)\cos x}{c + b \cos x}\,dx \;=\; 0.
$$
whenever $a^2+b^2 = c^2$ and $a$, $b$, and $c$ are all positive.  The given integral is the case where $a=3$, $b=4$, and $c=5$.
A: Let $$f(x)=\frac{1+2\cos x}{5+4\cos x}$$
Firstly you can show that $f(\pi-x)=f(\pi+x)$, so that the function has reflection symmetry in the line $x=\pi$, and therefore we can change the upper limit to $\pi$ and double the answer.
Secondly you can show by substitution that $$\int_0^{\frac{2\pi}{3}}f(x) \, dx=-\int_{\frac{2\pi}{3}}^{\pi}f(x) \, dx$$
Hence the required integral is zero
A: Consider the more general integral, where $d \neq 0$,
\begin{align}\tag{1}
I = \int_{0}^{2 \pi} \frac{a + b \cos x}{c + d \cos x} \, dx.
\end{align}
Now by splitting the integral into two regions, $[0, \pi)$ and $(\pi, 2 \pi]$, then in the second integral let the variable be shifted by $\pi$. This is seen by:
\begin{align}
I &= \int_{0}^{\pi} \frac{a + b \cos x}{c + d \cos x} \, dx + \int_{\pi}^{2 \pi} \frac{a + b \cos x}{c + d \cos x} \, dx \\
&= \int_{0}^{\pi} \frac{a + b \cos x}{c + d \cos x} \, dx + \int_{0}^{\pi} \frac{a - b \cos x}{c - d \cos x} \, dx. \tag{2}
\end{align}
The general form of the integrals is
\begin{align}
\int_{0}^{\pi} \frac{a + b \cos x}{c + d \cos x} \, dx &= \left[ \frac{b x}{d} + \frac{2(bc - ad)}{d \sqrt{d^2 - c^2}} \, \tanh^{-1}\left( \frac{(c-d)}{\sqrt{d^2 - c^2}} \, \tan\left(\frac{x}{2}\right) \right) \right]_{0}^{\pi} \\
&= \frac{b \pi}{d} - \frac{i \, \pi (bc-ad)}{d \sqrt{d^2 - c^2}}. \tag{3}
\end{align}
and, upon letting $(b,d) \to (-b , -d)$,
\begin{align}
\int_{0}^{\pi} \frac{a - b \cos x}{c - d \cos x} \, dx = \frac{b \pi}{d} - \frac{i \, \pi(bc-ad)}{d \sqrt{d^2 - c^2}}. \tag{4}
\end{align}
Using (3) and (4) in (2) yields
\begin{align} \tag{5}
I = \frac{2 \pi }{d} \, \left( b - \frac{i \, (bc-ad)}{\sqrt{d^2 - c^2}} \right).
\end{align}
From (1) and (5) the integral is
\begin{align}\tag{6}
\int_{0}^{2 \pi} \frac{a + b \cos x}{c + d \cos x} \, dx = \frac{2 \pi }{d} \, \left( b - \frac{i \, (bc-ad)}{\sqrt{d^2 - c^2}} \right).
\end{align}
In order to remove the factor of $i$ it is required that $c > d$, $d \neq 0$. This leads to
\begin{align}\tag{7}
\int_{0}^{2 \pi} \frac{a + b \cos x}{c + d \cos x} \, dx = \frac{2 \pi }{d} \, \left( b - \frac{bc-ad}{\sqrt{c^2 - d^2}} \right).
\end{align}
The problem asked has the values $(a,b,c,d) = (1,2,5,4)$ for which it is quickly determined that
\begin{align}\tag{6}
\int_{0}^{2 \pi} \frac{1 + 2 \cos x}{5 + 4 \cos x} \, dx = 0.
\end{align}
Another example is $(a,b,c,d) = (\beta^{2}, 1, 6, 4)$, where $2 \beta = 1 - \sqrt{5}$, which yields the result
\begin{align}
\int_{0}^{2 \pi} \frac{\beta^{2} + \cos x}{6 + 4 \cos x} \, dx = 0.
\end{align}
