18
$\begingroup$

The following is the graph of the $\tan(x)$ function:

enter image description here

We can clearly see there how it’s undefined at $\frac \pi 2$.

Now, what if we wanted to find the area between the tangent function and the x-axis in the interval $[0, 2]$?

The following happens:

$$\int \tan(x) dx = -\ln|\sec(x)| + c, \quad c\in\mathbb{R}$$

$$\implies \int_{0}^{2} \tan(x) = (-\ln|\sec(2)|) - (-\ln|\sec(0)|)$$

$$\implies (-\ln|\sec(2)|) - (-\ln(1)) = (-\ln|\sec(2)|) + \ln(1)$$

$$ |\sec(2)| = 2.40299796…$$

So what we end up getting is something in the form

$$\int_{0}^{2} \tan(x) dx = -\ln(2.40299..) + \ln(1)$$

Which ends up giving us

$$-0.87671710853 + 0$$

Which is definitely a finite value!

However, when you look at the above graph, you clearly see that there should be infinite area there, as the tangent is asymptotic one unit before there.

What’s going on here?

$\endgroup$
10
  • 20
    $\begingroup$ $\tan x$ does not have an anti-derivative everywhere. You cannot use $-\ln |\sec x|$ as an anti-derivative in intervals that contain odd multiples of $\frac {\pi} 2$. $\endgroup$ Feb 9 at 6:05
  • 27
    $\begingroup$ This is the same mistake as saying $$\int_{-2}^1\frac{dx}{x^2} = -\frac{1}{x}\Biggr|_{-2}^1 = - \frac{3}{2}$$ which you should recognize as immediately being wrong because a nonnegative function produced a negative integral. $\endgroup$ Feb 9 at 6:12
  • 25
    $\begingroup$ "...you clearly see that there should be infinite area there..." Incorrect. A vertical asymptote does not necessarily mean the area is infinite. For example, $\int\limits_0^1 (-\log x)\,dx = 1$. $\endgroup$
    – MPW
    Feb 9 at 14:54
  • 14
    $\begingroup$ "Thanks everyone for making me look stupid" -- Don't hate on yourself for making an easy mistake that many people here themselves probably made when first learning calculus. The only way to learn is to make mistakes and learn from them. $\endgroup$ Feb 9 at 21:14
  • 8
    $\begingroup$ It's not stupid -- it's learning. Now you know it, and some day you will teach it to someone else. $\endgroup$
    – MPW
    Feb 9 at 22:35

5 Answers 5

38
$\begingroup$

Your calculation has used the Fundamental Theorem of Calculus, but that theorem has an assumption that needs to be satisfied: the integrand must be continuous on the entire domain of integration. Yet $\tan x$ is not continuous on $[0,2]$.

This is a good reminder that theorems have hypotheses and we must always verify the hypotheses before applying the theorem.

$\endgroup$
2
  • 1
    $\begingroup$ The tangent function is undefined at $\pi/2$, so not even defined over $[0,2]$. This is the main problem, not “lack of continuity”. $\endgroup$
    – egreg
    Feb 10 at 15:47
  • 2
    $\begingroup$ @egreg : Yes, continuity is only really needed to ensure integrability; with the Henstock–Kurzweil integral, as long as $ f ( x ) = F ' ( x ) $ holds for all $ x \in [ a , b ] $, then $ \int _ a ^ b f ( x ) \, \mathrm d x = F ( b ) - F ( a ) $, and so the same result holds for the Riemann or Lebesgue integral if the integral exists. But in this example, we don't have $ \tan x = \frac { \mathrm d } { \mathrm d x } ( - \ln \sec x ) $ when $ x = \pi / 2 $, because at least one of these (in fact both) is undefined then. $\endgroup$ Feb 10 at 16:13
8
$\begingroup$

Another thing is that infinite-looking areas can still have finite integrals.

For example, consider the function $1/x^2$ (start from $x=1$ but extending to infty):

enter image description here

Despite having infinite domain, the integral is finite:

$$ \displaystyle \int_{1}^{\infty} \dfrac{1}{x^2} dx = \left[ \dfrac{-1}{x} \right]_1^{\infty} = 1 $$

$\endgroup$
6
$\begingroup$

I disagree with Greg Martin that the central issue is that it's discontinuous. The central issue is with this claim: "$\int \tan(x) dx = -\ln|\sec(x)| $." By this, you presumably mean "For all $x$, $\frac {d}{dx} (-\ln|\sec(x)|)= \tan(x)$." However, the actual statement is "For all $x$ where $-\ln|\sec(x)|$ is defined, its derivative is $\tan(x)$." $\sec(x)$ isn't defined for $x=\frac{\pi}2+n\pi$, and its derivative doesn't exist there either, and so its derivative can't be equal to $\tan(x)$ (which also doesn't exist there). Now, the fact that it's not continuous there does indeed flow from the fact that it doesn't exist, so Greg Martin is correct in noting that it's not continuous and the Fundamental Theorem of Calculus doesn't apply, but the fact that the function doesn't exist is the primary issue.

When dealing with identities, especially with trigometric identities, you need to take care that you're taking into account for what values it applies.

$\endgroup$
1
  • 1
    $\begingroup$ Indeed, if you use the Henstock–Kurzweil integral, then continuity is irrelevant to the FTC; as long as $ f ( x ) = F ' ( x ) $ holds for all $ x \in [ a , b ] $, then $ \int _ a ^ b f ( x ) \, \mathrm d x = F ( b ) - F ( a ) $ (and so the same result holds for the Riemann or Lebesgue integral if the integral exists). $\endgroup$ Feb 10 at 16:16
5
$\begingroup$

In order to consider $$ \int_a^b f(x)\thinspace dx $$ you first of all need that the function $f$ is defined over $[a,b]$.

Now $f(x)=\tan x$ is not defined over $[0,2]$, because $\pi/2\in[0,2]$. OK, we can decide that $f(x)=\tan x$ for $x\in[0,2]$, $x\ne\pi/2$ and $f(\pi/2)=0$.

This might be done, but you cannot apply the fundamental theorem of calculus, which requires the integrand to be continuous over the interval the integration is carried on.

It is possible to extend the notion of integral to noncontinuous function, but this requires limits: you may interpret $$ \int_0^2 \tan x\thinspace dx=\lim_{a\to\pi/2^-}\int_0^a \tan x\thinspace dx+\lim_{b\to\pi/2^+}\int_b^2 \tan x\thinspace dx $$ provided both limits exist finite. Neither does: the first one is $\infty$, the second one is $-\infty$.

$\endgroup$
2
  • $\begingroup$ Dear @egreg, shouldn't that be studied as an indeterminate form $\infty - \infty$? $\endgroup$
    – rafaeldf
    Mar 8 at 8:22
  • $\begingroup$ @rafaeldf No, why should it be? $\endgroup$
    – egreg
    Mar 8 at 8:30
2
$\begingroup$

Multiple other people have answered why this integration isn't safe, but we do actually find that if we do it carefully it does work here.

However before we can do the integral we must first fix the error in the question. In the question you state that $$\int \tan(x) = -\log\left|\sec(x)\right|$$ but this is wrong and instead the integral is given by $$\int \tan(x) = \log\left|\sec(x)\right| = -\log\left|\cos(x)\right|$$

When you use the correct anti-derivative you get a positive area and in fact the correct area.

However we have to be careful to show that this is the correct area. While the function is discontinuous/not defined at $\pi/2$, it is well defined and continuous arbitrarily close to $\pi/2$ so we can define the integral to be the limit as we allow the range to be close and closer to including $\pi/2$.

As the discontinuity is in the middle of the range we will split the integral into two and take the limits to be $\delta$ away from $\pi/2$ which gives $$\int_0^2 \tan(x) = \lim_{\delta\to 0}\left(\int_0^{\pi/2-\delta} \tan(x) + \int_{\pi/2+\delta}^2 \tan(x)\right)$$ $$=\lim_{\delta\to 0}\left(\left.\log\left|\sec(x)\right|\right|_0^{\pi/2-\delta}+\left.\log\left|\sec(x)\right|\right|_{\pi/2+\delta}^2\right)$$ $$=\lim_{\delta\to 0}\left(\log\left|\sec\left(\pi/2-\delta\right)\right|-\log\left|\sec(0)\right|+\log\left|\sec(2)\right|-\log\left|\sec\left(\pi/2+\delta\right)\right|\right)$$ $$=\log\left|\sec(2)\right|-\log\left|\sec(0)\right|+\lim_{\delta\to 0}\left(\log\left|\sec\left(\pi/2-\delta\right)\right|-\log\left|\sec\left(\pi/2+\delta\right)\right|\right)$$ We will now use translation and reflection identities on the terms still in the limit to get $$=\log\left|\sec(2)\right|-\log\left|\sec(0)\right|+\lim_{\delta\to 0}\left(\log\left|\csc\left(\delta\right)\right|-\log\left|\csc\left(\delta\right)\right|\right)$$ Both terms in the limit are the same and as such cancel to give $$=\log\left|\sec(2)\right|-\log\left|\sec(0)\right|+\lim_{\delta\to 0}0$$ $$=\log\left|\sec(2)\right|-\log\left|\sec(0)\right|$$ Which is the same answer obtained by using the anti-derivative and ignoring the discontinuity.

Note however that while it works this time, some times the limit doesn't cancel and can either give a finite or infinite contribution.

$\endgroup$
4
  • 2
    $\begingroup$ You should mention that the way you stepped back $\delta$ from the discontinuity in both integrals, added then together, and then took the limit gives you the (Cauchy) principle value, which is considered to be a weaker thing than the usual integral over a discontinuity. $\endgroup$
    – JonathanZ
    Feb 10 at 16:24
  • 2
    $\begingroup$ @JonathanZ: +1, but "principal". $\endgroup$ Feb 10 at 21:53
  • $\begingroup$ @MartinArgerami - Oy. I'm pretty sure this is the second time I've used the wrong spelling of that word in a math.SE comment, and had someone have to point it out. :-/ $\endgroup$
    – JonathanZ
    Feb 10 at 22:18
  • $\begingroup$ :D $\ \ \ \ \ \ $ $\endgroup$ Feb 10 at 22:42

You must log in to answer this question.