11
$\begingroup$

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?

  • 4
    No paradox here, simply the fact that one applies a result out of its applicability range. To wit, the RHS is not continuous on $(0,2\pi)$ but jumps at points $\pi/2$ and $3\pi/2$. Since the size of each jump is $\pi/\sqrt2$ and there are two jumps, one can even use this very formula to get the correct value of the LHS, namely $\pi\sqrt2$.2012-07-14
  • 1
    It's a pretty common problem with things like Wolfram Alpha. See [this](http://blog.wolfram.com/2008/01/19/mathematica-and-the-fundamental-theorem-of-calculus/) and [this](http://dx.doi.org/10.1145/174603.174409) for instance.2012-07-15
  • 0
    [A related question.](http://math.stackexchange.com/questions/62567)2012-07-16

6 Answers 6

1

The problem here is not with the integrand; instead, it is with the antiderivative of the integrand on the interval of integration $(0,2\pi)$, where the antiderivative of the integrand is discontinuous at $\pi/2$ and $3\pi/2$. This suggests that we split the interval of integration to three intervals; namely, $(0,\pi/2)$, $(\pi/2,3\pi/2)$, and $(3\pi/2,2\pi)$. Doing that, we get the right answer $\sqrt 2 \pi$.

15

(This is an expansion of my earlier comment.)

Consider the function

$$f_c(x)=\frac{x}{\sqrt 2}-\frac1{\sqrt 2}\arctan\left(\frac{\sin\,2x}{3+2\sqrt{2}+\cos\,2x}\right)$$

You can check that the derivative of $f_c(x)$ is $\dfrac1{1+\cos^2 x}$. The relevance of this function is that $f_c(x)$, unlike the function $f(x)=\dfrac1{\sqrt 2}\arctan\left(\dfrac{\tan\,x}{\sqrt 2}\right)$ given in the OP, has no discontinuities within the integration interval $[0,2\pi]$:

plot of two antiderivatives

Thus,

$$\int_0^{2\pi}\frac{\mathrm dx}{1+\cos^2 x}=\left.\frac{x}{\sqrt 2}-\frac1{\sqrt 2}\arctan\left(\frac{\sin\,2x}{3+2\sqrt{2}+\cos\,2x}\right)\right|_0^{2\pi}=\pi\sqrt 2$$

One wonders how the two functions $f(x)$ and $f_c(x)$ could look so different and yet have the same derivative. A plot of $f_c(x)-f(x)$ shows the difference:

f_c(x)-f(x)

Here, we see that the two functions differ not by a constant, but by a piecewise constant function (i.e., a step function). In fact, the Fundamental Theorem of the Calculus can be stated a bit more generally than is usual in textbooks. To quote Oleksandr Pavlyk's blog entry on this subject,

Every calculus student knows that antiderivatives can contain an arbitrary additive constant. But in fact, there’s more arbitrariness than that: one can add different constants on different parts of the interval.

As already mentioned in the previous answers, the trouble lies in the use of the Weierstrass substitution; the source of the problem, simply put, is that the substitution function used happens to be discontinuous within the interval of integration. Thus, to properly evaluate definite integrals of rational functions of sine and cosine, one has to be careful in using the Weierstrass substitution, and must pay attention to the behavior near the singularities.

Jeffrey and Rich, in their paper, discuss methods for computer algebra systems to cope with this particular weakness of the Weierstrass substitution.


For the sake of completeness, here's a general formula for an antiderivative of $\dfrac1{p+q\cos^2 x}$ that is continuous over the real line:

$$\int\frac{\mathrm dx}{p+q\cos^2 x}=\frac1{\sqrt{p(p+q)}}\left(x-\arctan\left(\frac{q\sin\,2x}{2p+q+2\sqrt{p(p+q)}+q\cos\,2x}\right)\right)$$

  • 3
    the [paper](http://www.apmaths.uwo.ca/~djeffrey/Offprints/toms1994.pdf) is available at Jeffrey's [homepage](http://www.apmaths.uwo.ca/~djeffr) ('Offprint service').2012-07-15
3

If $\tan(y)=a\tan(x)$, then $\tan(y-x)=\frac{(a-1)\tan(x)}{1+a\tan^2(x)}$, and therefore, $$ y=x+\tan^{-1}\left(\frac{(a-1)\tan(x)}{1+a\tan^2(x)}\right)\tag{1} $$ Since $\left|\frac{(a-1)\tan(x)}{1+a\tan^2(x)}\right|\le\frac{\left|a-1\right|}{2\sqrt{a}}$, $(1)$ is a nice continuous function of $x$.

In this question, $a=\frac1{\sqrt2}$, so we get $$ \int\frac{\mathrm{d}x}{1+\cos^2(x)}=\frac{x-\tan^{-1}\left(\frac{(\sqrt2-1)\tan(x)}{\sqrt2+\tan^2(x)}\right)}{\sqrt2}\tag{2} $$

  • 0
    This is nice. But isn't it covered in the answer of J.M. above, in particular in the link in the comment by Raymond Manzoni?2016-06-18
  • 0
    I haven't dug into those links. In any case, I think having a local derivation is good. This is how I dealt with a similar problem when handling Kepler's Equation.2016-06-19
2

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.

  • 1
    In your case, integrate on $[0,\pi/2]$ and multiply by 4. You can do this because of symmetries.2012-07-14
  • 1
    Yeah got it thanks. So the antiderivative must be continuous across the domain of integration to be able to substitute with the integral limits, right?2012-07-14
  • 0
    Yes. You have to watch out for that.2012-07-14
  • 0
    Interesting. I do not remember that is written in my calculus books, not even a warning :(2012-07-14
  • 2
    @Revo If $F$ is an antiderivative of $f$, this means that $F' = f$ so in particular $F$ must be continuous. (Otherwise $F$ can't be differentiable.)2012-07-14
  • 2
    @Revo: "Every calculus student knows that antiderivatives can contain an arbitrary additive constant. But in fact, there’s more arbitrariness than that: one can add different constants on different parts of the interval."2012-07-15
2

Quite simple: the $\arctan$ function is multivalued, so you have to add the appropriate multiples of $\pi$ to the function to get at the right result; i.e., $\sqrt{2}\pi$

1

The antiderivative you are using is not continuous from $0$ to $2\pi$. Ask Wolfram to graph it. Then try to see if you can adjust it by constants on various intervals to make it continuous, and you will see that the integral is quite far from $0$.