A little integration paradox The following integral can be obtained using the online Wolfram integrator: 
$$\int \frac{dx}{1+\cos^2 x} = \frac{\tan^{-1}(\frac{\tan x}{\sqrt{2}})}{\sqrt{2}}$$
Now assume we are performing this integration between $0$ and $2\pi$. Hence the result of the integration is zero.
On the other hand when looking at the integrand, $\displaystyle \frac{1}{1+\cos^2 x}$, we see that it is a periodic function that is never negative. The fact that it is never negative guarantees that the result of the integration will never be zero (i.e., intuitively there is a positive area under the curve).
What is going on here?

An unusual substitution, the "$\tan(z/2)$"substitution, is being done here. You must take a careful look at what you are integrating.  Here is a reference on this substitution.
