# Why doesn't this trigonometric integral evaluate?

I'm trying to follow this Wolfram Alpha derivation (click "Show steps"...) of an integral question I posted earlier. My question is specifically, the second last line (before they use "an equivalent for restricted t values") is:

$$\left. -\frac{2}{3} \sqrt{ 1 - \cos{3\theta} }\,\, \right|_0^{2\pi}$$

But why doesn't the definite integral work out to the correct answer (listed under "Definite integral over a period:", near the bottom) of $4 \sqrt{2}$?

When you plug in the limits, you get $- \frac{2}{3} ( 0 - 0 )$ which is just $0$.

Edit: You have to click "Try again with more time" for this to appear, but here is the "definite integral over a period": When I click on the Wolfram output, I see $-\frac{2}{3} \sqrt{1 - \cos(3t)}$ only in the indefinite integral calculation: there are no bounds at all. (There are some specific, numerically computed definite integrals below the symbolic calculation, but this is not where $-\frac{2}{3} \sqrt{1 - \cos(3t)}$ is.)

This is important, because you cannot in general evaluate definite integrals by grabbing Wolfram Alpha's symbolically calculated output for an indefinite integral, and then plugging in bounds. The issue is that the output is not guaranteed to work for all possible choices of bounds. In general it can only be expected to work when the bounds lie in a specific interval.

This is what that "restricted $t$ values" business is all about. Wolfram Alpha is telling you to look out, because it has detected that the function its algorithm produced may only work as an indefinite integral on an interval of $t$ values--- not everywhere.

In slightly more precise language: you're putting in $f(t) = \sqrt{1 + \cos(t) \cos(2t) - \sin(t) \sin(2t)}$ and asking for an indefinite integral. An indefinite integral of $f$ is by definition an antiderivative of $f$, that is, a function whose derivative is $f$. Its output $F(t) = -\frac{2}{3} \sqrt{1 - \cos(3t)}$ has the property that $F'(t) = f(t)$, but only for $t$ in a restricted interval. The equality $F'(t) = f(t)$ does not hold for all $t$. So you can't evaluate all definite integrals involving $f$, by plugging into $F$.

Recall the hypotheses of the theorem that lets you evaluate integrals with antiderivatives, namely, the fundamental theorem of calculus. It says: if you have a nice enough function $f(t)$ defined on $[a,b]$ and you have some function $F$ that satisfies $F'(t) = f(t)$ for all $t$ in $[a,b]$, then $$\int_a^b f(t) \, dt = F(b) - F(a).$$ If $F'(t) = f(t)$ does not hold for all $t$ in $[a,b]$, then the FTC doesn't apply, and you have no reason to expect $\int_a^b f(t) \, dt$ to be $F(b) - F(a)$. That's what's going on here.

To convince yourself that that's what's going on here, note that your $f(t)$ is nonnegative for all $t$ (graph it). If $F(t)$ were to satisfy $F'(t) = f(t)$ for all $t$, then because the derivative of $F$ is nonnegative, the function $F$ would have to be nondecreasing, on the whole real line. But you can see (look at the plot of $F$) that it isn't.

Another way to convince yourself: ask Wolfram to plot the derivative of $F$, and also $f$, on the same axes. You'll see that the graphs match, but only on some intervals, and not on the entire interval $[0, 2\pi]$ (in particular: $F'$ has jump discontinuities in this interval, and $f$ doesn't). So: you can't expect the integral to be $F(2\pi) - F(0)$.

Why is Wolfram bugging out? I don't know the precise algorithm it's using, but roughly, it's because the function $f$ you're asking to integrate on $[0,2\pi]$ is not differentiable on all of $[0,2\pi]$--- the graph has several sharp corners. Symbolic calculators aren't good at handling functions like this. (Humans aren't, either: doing calculus with such functions generally requires working in pieces, and paying very close attention to the hypotheses of each calculational step--- ie, you're not just manipulating symbols anymore.)

Here is another perspective. If you look up what "substitution" for definite integrals actually says--- as a statement that, under specific hypotheses, one can rewrite one definite integral as another--- you'll find hypotheses preventing the calculation suggested by Wolfram Alpha from working for your bounds. The familiar process of symbolic replacement we know for "doing a change of variables"--- where you replace symbols with other symbols and put in new numbers as the bounds--- is guaranteed to work only when the relationship between the old and new variable defines a one-to-one function. If you plot $s = \cos(u) + 1$ as a function of $u = 3t$ on the $u$-interval from $3 \cdot0$ to $3 \cdot 2\pi$ you see it's a wavelike graph, not a one-to-one function (it fails the horizontal line test).

I hope one of these perspectives helped.

[I should say: your issue isn't all that uncommon. You can expect it almost any time you are symbolically evaluating definite integrals using symbolic formulas found via "trigonometric substitutions". I don't think any software package is any better at it than Wolfram Alpha is.]

In the item you posted earlier, there was an absolute value. $0$ is just what you would get if that were neglected. So I suspect it was neglected.

• This could have just been a comment. Hungry for reputation, eh? – Mr Pie Aug 23 '18 at 1:17
• @user477343 : Try using some common sense. Obviously I am not "hungry for reputation". – Michael Hardy Aug 23 '18 at 17:28