<s>[INST] Find $\int_0^{2\pi} \frac{1}{3 + \cos x} dx$. I have to find the integral
$$\int_0^{2\pi} \dfrac{1}{3 + \cos x} dx$$
I tried using the Weierstrass subtitution, but replacing the bounds, I get:
$$t_1 = \tan \dfrac{0}{2} = \tan 0 = 0$$
$$t_2 = \tan \dfrac{2 \pi}{2} = \tan \pi = 0$$
Resulting in the integral:
$$\int_0^0 \dfrac{1}{3 + \dfrac{1 - t^2}{1 + t^2}} \cdot \dfrac{2}{1 + t^2} dt$$
which obviously equals $0$ since the bounds are the same. Is this correct? It feels wrong.
 [/INST] By the tangent half-angle substitution we obtain: 
\begin{align}2\int_0^{\pi} \dfrac{1}{3 + \cos x} \,dx&=2\int_0^{\infty}\frac{1}{3+\frac{1-t^2}{1+t^2}}\frac{2}{1+t^2}\,dt\\&=
2\int_0^{\infty}\frac{1}{t^2+2}\,dt\\&=
2\left(\frac{1}{\sqrt{2}}\arctan\left(\frac{x}{\sqrt2{}}\right)\right)\Bigg|_0^{\infty}
\\&=2\left(\frac{1}{\sqrt{2}}\frac{\pi}{2}-0\right)\\&=
\frac{\pi}{\sqrt{2}}
\end{align}
</s>