# Integration: More Than One Way, More Than One Answer

#### (An archive question of the week)

In searching for answers to include in Monday’s post on calculus fallacies, I ran across a long discussion that illustrates some important aspects of methods of integration. In particular, there are often multiple ways to find an integral (the best not necessarily being the one taught in your textbook); and different methods will sometimes result in answers that appear to be different from that in the textbook.

## A trick method

We eventually discussed several examples, but we started with one particularly challenging one:

Integrals of the Cosecant, and of the Square Root of a Sum of Squares

How does one integrate csc(x) and get the right answer?

I searched and came upon this explanation:
http://math2.org/math/integrals/more/csc.htm

But as a newcomer to trig identities and calculus, how would I ever think to multiply by csc(x) + cot(x)? That Math2.org page understates it right from the start: this "strategy is not obvious"!

I did it a different way. Basically, I wrote csc(x) as 1/sin(x), then as sin(x)/sin^2(x), and again as sin(x)/(1 - cos^2x). Here I substituted, letting u = cos(x), -du = sin(x)dx. Next, I plugged in to get the integral of -du/(1 - u^2). Finally, I factored the denominator into (u - 1)(u + 1) and did partial fractions to get an answer of

(1/2)ln|cos(x) - 1| - (1/2)ln|cos(x) + 1|

This is wrong. Why?

Same question for how to integrate sec(x). Why do I have to multiply top and bottom by sec(x) + tan(x) and then do a u-substitution? and how I would I ever know to do that?

Here is what Winnie did, written out:

$$\displaystyle\int\csc x\ dx = \int \frac{1}{\sin x}\ dx = \int \frac{\sin x}{\sin^2 x}\ dx = \int \frac{\sin x}{1 – \cos^2 x}\ dx = \int \frac{-du}{1 – u^2}$$ $$\displaystyle = \int \frac{du}{u^2 – 1} = \int \frac{du}{(u – 1)(u + 1)} = \int \left(\frac{1/2}{u – 1} – \frac{1/2}{u + 1}\right)du$$ $$\displaystyle = \frac{1}{2} \ln|u-1| – \frac{1}{2} \ln|u+1| = \frac{1}{2} \ln|\cos x-1| – \frac{1}{2} \ln|\cos x+1|$$.

The answer on the page she referred to looks very different:

$$\displaystyle\int\csc x\ dx = -\ln\left|\csc x + \cot x\right|$$

Plus the constant, of course. (I’ll come back to their method later.)

So her two questions are: (1) How would anyone come up with their method?, and (2) Why is her method wrong? I replied:

Integration is an art, not a routine skill. Some problems can only be solved by using special tricks that you just have to know -- because someone showed it to you -- and some are originally done just by recognizing that you have differentiated something previously that gave, as an integrand, the expression you want.

In other words, integration is much like division — you know that $$56 \div 7 = 8$$ largely because you have previously run across the fact that $$56 = 7 \times 8$$, so you can recognize the inverse.

Many integrals can be attacked in more than one way -- including csc(x). To integrate it, you don't *have* to use the strategy on Math2.org. The first person to do that most likely did so by working backward from the answer derived via another strategy. Once they had done that, they probably stood back, compared the old and new methods, considered the new one the most direct possible route to the answer, and started telling others about it. It ultimately became the standard, "elegant" way to derive it in textbooks -- but like many things found in math texts, it is the end product of lots of thinking, reflection, and re-thinking.

Such a nonobvious method is definitely *not* intended as something anyone would even try their first time through!

In other words, the work we tend to put on display is a polished, final product. We don’t show our rough work. But in teaching, we really need to show how that product is created — just as a sculptor, in teaching how to sculpt rather than just showing off his brilliance, needs to show what the block of marble looks like while it is being worked on.

I do see a way that you might intuit your way to this strategy -- perhaps not when you are faced with this integral, but just when you are in a playful mood (!): If you know that the derivatives of cot(x) and csc(x) are, respectively, -csc^2(x) and -csc(x)cot(x), it might occur to you that the derivative of cot(x) + csc(x) happens to be -csc(x)(csc(x) + cot(x)). If you've got that fact squirreled away in your mind, it might just pop up in a flash of insight.

Good mathematicians are not those who figure things out only when they stare at a new problem, but who are constantly on the lookout for ideas that might be useful in future problems. (The same is true of good authors, or good detectives, or good inventors, or whatever!) After solving a problem, they look back to see if they could have done better, and also to see if there are other problems their discoveries could help with. Here, seeing $$\cot x + \csc x$$ hidden inside its own derivative provides a potential trick …

So that is one way the elegant method might have been invented; or it might have been a matter of working backward from the answer obtained a different way. Knowing that the answer is $$\displaystyle\int\csc x\ dx = -\ln\left|\csc x + \cot x\right|$$, perhaps by the method we’ll be discussing next, we might just think of getting $$\csc x + \cot x$$ into the integrand by multiplying top and bottom:

$$\displaystyle\int\csc x\ dx = \int\csc x\left(\frac{\csc x + \cot x}{\csc x + \cot x}\right)\ dx = \int\frac{\csc^2 x + \csc x\cot x}{\csc x + \cot x}\ dx$$ $$\displaystyle = \int \frac{-du}{u} = -\ln|u| = -\ln\left|\csc x + \cot x\right|$$

That is what the math2 site did. But they didn’t invent it themselves; they just passed on a nice trick they had learned.

## An alternative form

Now let’s turn to the other question: Why is Winnie’s method/answer wrong? It isn’t!

Now, as far as your work integrating csc(x) in a "different way" ... your method is not wrong -- nor is your answer!

Let's take your answer and show that it is equivalent to theirs:

(1/2)ln|cos(x) - 1| - (1/2)ln|cos(x) + 1|

= (1/2)ln|(cos(x) - 1)/(cos(x) + 1)|

|(cos(x) - 1)(cos(x) - 1)|
= (1/2)ln|------------------------|
|(cos(x) + 1)(cos(x) - 1)|

|(cos(x) - 1)^2|
= (1/2)ln|--------------|
|(cos^2(x) - 1)|

|(cos(x) - 1)^2|
= (1/2)ln|--------------|
|  -sin^2(x)   |

|cos(x) - 1|
= ln|----------|
|  sin(x)  |

|cos(x)       1   |
= ln|------  -  ------|
|sin(x)     sin(x)|

= ln|cot(x) - csc(x)|

= ln|csc(x) - cot(x)|

I had a general idea what form of answer I wanted to transform Winnie’s answer to, so I pulled the 1/2 inside the log (as a square root), then expressed the argument of the log in terms of csc and cot. But …

That's not quite where we wanted to go; but rather than go back and do it a little differently, I'm going to let you either make a little change to my work so we end up where we want to be, or start with my end product and take it the rest of the way to the answer you found, namely

-ln|csc(x) + cot(x)|

One of the beautiful but frustrating things about trig functions is that what at first looks entirely different can turn out to be exactly the same. Trig lets you express the same relationships in so many different ways!

A good argument could be made that my form of answer is nicer than theirs (no negative on the outside); the important thing is that we now have three different answers, which all look different but turn out to be equivalent. This is typical of trigonometric problems. (Hint: one way to convert mine to theirs is to multiply the numerator and denominator by $$\csc x + \cot x$$.)

Having said all this, I found the following page in our archive:

Integration Trick
http://mathforum.org/library/drmath/view/53537.html

In that Dr. Math conversation, a student came up with something much like your answer, and Doctor Jerry (a) checked the answer by differentiation, showing it was correct; (b) found yet another form of the answer in a table; and (c) told about the elegant way -- which he recalls being taught, rather than finding on his own! It's a sort of math lore, passed down from one generation to another, rather than a wheel that humans invent and re-invent on their own.

Though your method takes more work, it is an excellent one. In fact, if I were writing a textbook, I'd relegate the quick method to a footnote, to show how creative we can be. But in the main text, yours is the method I would use -- the better to show other students that you can find a solution for yourself using ordinary methods, rather than having to solve the whole thing in one super-insightful leap.

## A trig substitution

At this point Winnie asked for some clarification, which you can read if you wish; then she asked:

In addition, if you wouldn't mind helping me further, I am struggling a bit with trig substitutions. My teacher actually never taught me this method, but I am 100% sure that, on the test, there will be something that requires it. Could you direct me to a good archive or website that thoroughly goes through the general approaches without being too dense? Or could you explain it to me with an example?

For starters, here's a question from my review package that I don't get:

Find the integral of dx/(sqrt(x^2 + 16))

I thought it would involve tangent at first, but the square root threw me off. Bummer ...

Maybe some trig substitution would work?

The specific example here is $$\displaystyle\int \frac{dx}{\sqrt{x^2 + 16}}$$. Her impression of the appropriate method is exactly right; she just needs to follow through:

The basic trig substitutions remind me of the Pythagorean identities, insofar as I don't have to specifically remember a table of substitutions.

Here's a site I refer to from time to time:
Paul's Online Math Notes: Trig Substitution

In your case, x^2 + 16 reminds me of tan^2(u) + 1 = sec^2(u). If I divide by 16, I have (x/4)^2 + 1, so I want to let

tan(u) = x/4

That is, I replace x with 4 tan(u), so that

x^2 + 16
= [4 tan(u)]^2 + 16
= 16[tan^2(u) + 1]
= 16 sec^2(u)

So

sqrt(x^2 + 16) = 4 sec(u)

And dx/du = 4 sec^2(u), so

dx = 4 sec^2(u) du

The integrand therefore becomes

dx        4 sec^2(u)
------------ = ---------- du = sec(u) du
sqrt(x^2+16)    4 sec(u)

From here, we just have to look up the integral of sec(u).

So you were right about using the tangent; and the fact that there is a square root isn't a problem -- just something to address after the substitution, once we see how much closer it brought us to an answer.

Never be afraid to try something; you don't have to be sure it will work! Each thing you do just makes it easier to see what to do next (even if it's to back up and try something else!).

(If we don’t just look up $$\displaystyle\int\sec u\ du$$ in a table (it’s inside the back cover of a book I’ve used), we would do the same sort of thing we did above.)

She wrote back, showing her work of finishing up with this integral; the work looks almost identical to the original work she showed for the cosecant, so I will not repeat it. But she didn’t finish this, by going back to the original variable; and this may have happened because she used the same name for the new variable (which I called u), so that there was nothing to remind her that she wasn’t finished. This is a very bad practice; two things called by the same name within the same problem should be the same thing!

Then, having given up on that, she showed another attempt at the same integral, $$\displaystyle\int \frac{dx}{\sqrt{x^2 + 16}}$$, different from the trig substitution we just did:

In addition, I also tried using this substitution: set u = x^2 + 16, du = 2xdx, dx = du/2x. Then x = sqrt(u - 16). Subbing in, we get

(1/2)INT[du/(u^(1/2) * (u - 16)^(1/2))]

I multiplied same square roots to get (1/2)INT[du/(sqrt(u^2 - 16u))]. But now how do I integrate 1/(sqrt(u^2 - 16u))? I have no idea. Tried writing it as (u^2 - 16u)^(-1/2), but then what? Do I divide by the derivative of u^2 - 16u? But I still wouldn't get my desired answer of ln|x + sqrt(x^2 + 16)|...

I was a little confused here, as to what integral she was referring to. But I did say the right things. First,

The method you show here just doesn't work; it took you to a dead end (or at least to a point where I don't feel like doing the work to get it back on track, if that is even possible). The standard way to deal with sqrt(u^2 - 16u) is to complete the square, but I think that might just get you back to where you started.

Handling dead ends is part of the art of integrating: Even the most experienced sometimes just have to try things, and abandon methods that are not getting anywhere. Experience just lets you recognize more quickly when a method will not work.

Then I finished the work for her:

Looking back, I showed you how to integrate dx/(sqrt(x^2 + 16)), by substituting x = 4 tan(u), turning it into the integral of sec(u). Now you can use what you did above (or, as I suggested, look it up in a table, as this is a standard result that we don't usually reproduce for ourselves each time), finding that it is ln|tan(u) + sec(u)|. [I've been leaving out constants of integration to keep things simple.]

Now reverse the substitution:

sec(u) = sqrt(tan^2(u) + 1) = sqrt((x/4)^2 + 1)

This differs by only a constant that gets absorbed into the constant of integration.