Having looked at two basic techniques of integration, let’s start putting things together. How do you approach an integral without knowing what method to use? We’ll focus on substitution here, which is also called “change of variables”.

## Integration isn’t easy!

Let’s start with a general question, from 1998:

Tips for Integrating Functions Hi! I have been looking all over the Net for the past few weeks for a good tutorial on finding anti-derivatives, and haven't had much luck. There is an abundance of excellent sources on Derivative Calculus but none on Integral, so I am turning to you for help. Unfortunately it seemsthere is not an easy formulafor finding an Anti-Derivative, as there is for finding a derivative (f'(x)=(f(x+h)-f(x))/h). So if a good explanation would be too lengthy, even a pointer to a tutorial would be great. Thanks for maintaining such a wonderful site, as it has helped me with numerous issues, not to mention it's just cool going "Ahhh, so that's why." =) Brian Cowan

Doctor Rob answered:

It is an unfortunate fact that while every familiar function of calculus has a derivative,not all of them have antiderivatives expressible in terms of those familiar functions. A classic example is the so-called elliptic integrals, which first appear when trying to find the arc-length of an ellipse. The arc-length s from x = 0 to x = a * sin(T) is given by: s = a * Integral sqrt(1 - k^2 * sin^2[t]) dt from t = 0 to T where k is the eccentricity of the ellipse. For ellipses that are not circles, k is not 1, andthis integral is not possible in closed form. Other examples are the integrals of sqrt(sin(x)), e^(-x^2), and so on.

Not only is integration *difficult*, it is sometimes literally *impossible* (in the sense of finding an expression for the answer in terms of the basic functions, which is what “closed form” means).

You are correct that there isno standard methodfor doing integration. Some classes of functions have such methods, however. Forrational functions, the idea is to decompose the rational function into a polynomial plus a rational function whose numerator has smaller degree than the denominator. Then this new rational function can be split into simpler ones by factoring the denominator, and splitting it up via the method ofpartial fractions. These can be integrated individually.

So if the integrand is a rational function, you know it can be integrated, because there is a standard method (as long as the denominator can be factored, and you have enough patience to carry out the process).

Forrational functions of trigonometric functions, the method is to use multiple angle formulas to express the function in terms of sines and cosines of a single angle t. Then the substitutionz = tan(t/2)will reduce the function to a rational function in z. This reduces it to the previous case.

This is a special method that *always* works for such integrands; beginners are generally taught easier methods that *often* work, similar to what we’ll do below (but for non-rational functions).

For more elaborate functions, and those of other types, a high degree ofpattern-recognitionandexperiencein choosing substitutions that will simplify the problem at hand are involved. Often when there is a common subexpression among two or more parts of the integrand, it is useful tosubstitutesome new variable for it. When an expression of the form sqrt(a^2-t^2) is encountered, the substitutiont = a*sin(z)will often help, ort = q*coth(z). When it is sqrt(a^2+t^2), the substitution t =a*tan(z)will often help, or elset = a*cosh(z).

I often say that integration is an art; it takes a lot of experience to see quickly what to try, and even then you may not be able to see a way. The methods of “*u*-substitution” (as we’ll be seeing below) and “trig substitution” or “hyperbolic substitution” (like those he just mentioned) often help simplify a problem.

Another very useful technique isintegration by parts. When to use it is not, however, very clear. When the integrand is aproduct, one of whose parts is integrable, and the other of which has a relatively simple derivative, then integration by partsmaybe beneficial. In summary, there are just a few useful techniques that are useful in integration. They have to beapplied imaginatively. Even so, some functions will turn out not to be integrable at all.

The key to integration is to have a full toolbox, and to learn to recognize when each tool might be needed. And sometimes you have to try one you didn’t think would help – just because nothing else did!

## The simplest substitution: replacing *ax* with one variable.

As a first example, I want to start very small, with this question from 2001:

Integrate Cos 2a Dear Dr. Math, I was doing some integration and one of the problems was tointegrate cos2a. The answer given in the book is sin 2a/2. The textbooks that I have tell me that integrating cos a gives me sin a, and tell me in detail how that was arrived at. But I have searched everywhere for information on cos2a and how the result sin 2a/2 is arrived at. Does this follow a pattern, i.e. cos 3a = sin 3a/3 cos 4a = sin 4a/4 or cos na = sin na/n ?

Katherine is using *a* (which sounds like a constant) where I would expect to see *x*; to avoid confusion, we may want to think of this as integrating $$\int\cos(2x)dx$$ and more generally $$\int\cos(nx)dx$$ Books commonly give this integral as $$\int\cos(ax)dx=\frac{\sin(ax)}{a}+C$$

I answered, using the variable *x*:

Hi, Katherine. In general, theformulais [INT] cos(ax)dx = sin(ax) / a You can prove this by taking the derivative of the right side: d/dx[1/a sin(ax)] = 1/a cos(ax) d/dx(ax) = 1/a cos(ax) * a = cos(ax) This required only a simple application of the chain rule.

Here I’ve taken the formula as given, and checked this antiderivative by differentiating it. The formula is worth memorizing. But what if you haven’t done so?

Not knowing this more general formula, you canobtain it by substitution. If we let u = ax, then du = a dx and dx = du/a, so [INT]cos(ax)dx = [INT]cos(u) du/a = sin(u)/a = sin(ax)/a Here I firstreplaced ax with uanddx with du/a, then integrated, and finallyreplaced u with axagain. The same method is useful everywhere, so you should learn it well and even be able to do it in your head.

For details on the method, see Integration by Substitution. We defined a new variable *u* to be equal to the quantity found inside the function, *ax*; found how to express *dx* in terms of *du*; and then replaced each in the integral. The resulting integral was one we’ve memorized, so we just wrote the answer. Finally, we back-substituted to put the answer in terms of the original variable, *x*.

Now, what I often do for problems like this, if I’m not quite sure of the formula, is to start with a knowingly wrong “guess”, and correct it by checking:

I want the integral of \(\cos(ax)\); I know that the antiderivative of \(\cos(x)\) is \(\sin(x)\) (that is, that the derivative of the latter is the former), so I expect the answer to be something like \(\sin(ax)\).

Then I take the derivative of that using the chain rule, finding that it is \(a\cos(ax)\), which is *a* times as large as I want. To fix this, I just need to divide by *a*, so my answer is \(\frac{1}{a}\sin(ax)\).

I can do all this in my head, and it frees my memory from having to be certain what to multiply or divide by. (Each function has its own behavior, which I don’t have to remember this way.)

This can be described as a version of the method of false position. We’ll be using it again below.

## Looking for a substitution by rewriting

For a harder example, here’s a question from 1999:

Techniques of Integration - Change of Variables Hello. I would like to know how to solve this question.(integral sign) sin 2x / sqrt(9-cos^4 x) dxHow should I begin? Jen

We want to integrate $$\int\frac{\sin(2x)}{\sqrt{9-\cos^4(x)}}dx$$ It is not obvious that this is a function of a function, which is what you look for to make a substitution (giving a name to the inner function); but rewriting it will change things.

Doctor Luis answered:

You can approach this question more easily if you use the identity sin(2x) = 2sin(x)cos(x), and if you rewrite your integral in a more suggestive way, like this: / | 2 sin(x) cos(x) | ----------------------- dx | sqrt(9 - (cos^2(x))^2) /

Getting everything in terms of the same angle (*x* itself) is a good start; moreover, we see that the numerator is the derivative of \(\cos^2(x)\)! Also, writing the radicand as a difference of squares suggests something …

At this point it is clear that achange of variableswill do the trick. Letcos^2(x) = 3u. Then, differentiating implicitly, 2cos(x)*(-sin(x))dx = 3du This means that 2cos(x)sin(x) = -3du, and so, rewriting our integral in terms of u, we have / / | -3 du | du | ---------------- = - | ------------- | sqrt(9 - 9 u^2) | sqrt(1-u^2) / /

The way he substituted may be unfamiliar to you.

We often define a new variable directly as something like \(u=\cos(x)\) (a “*u*-substitution”), or, in reverse, something like \(x=\cos(\theta)\) (a “trig substitution”). In those cases, we can directly differentiate to find \(du\), or to solve for \(d\theta\).

Here, we are replacing one expression by another (\(\cos^2(x)\) by \(3u\)), and implicit differentiation shows that we can replace all of \(2\cos(x)\sin(x)dx\) with \(-3du\).

But this last integral is already known. It's nothing more than the inverse cosine function. So, / | du - | ------------- = arccos(u) = arccos((1/3)cos^2(x)) | sqrt(1-u^2) / Notice that we have expressed our final answer in terms of the original variable of integration, using the fact that u = (1/3)cos^2(x) . Obviously, I have neglected the arbitraryconstant of integration, but you can add that at any time.

This integral is commonly just **memorized**. If you hadn’t, you could use a **trig substitution** to derive it; and if you had just half-memorized it (like me) you could **check** that you had all the signs right, as Doctor Luis now shows:

Now, to show that theintegral of -1/sqrt(1-u^2)is thearccos(u)function, what you can do is check that the derivative of the arccos(u) function is -1/sqrt(1-u^2). We can do that as follows: Let y = arccos(x); then x = cos(y). By implicit differentiation on this last equation you can obtain, 1 = -sin(y) * dy/dx (notice we used the chain rule here) Solving for dy/dx, you get -1 dy/dx = --------- sin(y) Expressing sin(y) in terms of cos(y) (use the identity sin^2(y) + cos^2(y) = 1 for this step) we get: -1 dy/dx = ----------------- sqrt(1-cos^2(y)) But, by definition, x = cos(y). Therefore, -1 dy/dx = ------------- sqrt(1-x^2) Now, y was just y = arccos(x). Therefore, we have proven that the derivative of the arccos(x) function is -1/sqrt(1-x^2) .

Alternatively, you might know that \(\int\frac{1}{\sqrt{1-x^2}}=\arcsin(x)\), and write the answer as $$-\int\frac{du}{\sqrt{1-u^2}}=-\arcsin(u)=-\arcsin\left(\frac{1}{3}\cos^2(x)\right)+C$$ Believe it or not, this is equivalent to his answer (because arcsin and arccos add up to \(\frac{\pi}{2}\)).

## Looking for a substitution by listing possibilities

Now consider this, from 2003:

Substituting to Simplify the Integral What is the integral of tan^3 x * sec x dx?

We want $$\int\tan^3(x)\sec(x)dx$$ Where can we start?

Doctor Barrus answered:

Hi, Trista. This is a good question. Finding the indefinite integral of a bunch of trigonometric functions is often challenging, andsometimes it takes a lot of tries to get something that works. One strategy that you'll want to adapt is tolook for a good substitutionthat will make the integral simpler. I'm going to assume that you're familiar with substitutions; let us know if you need more information on this.

We need to consider possible inner functions, and what their derivatives are:

What I'll do is look at different choices for ournew variable u, based on what you have already in the integral, and figure out what thedifferential duwould be with such a choice... If then u = tan x du = sec^2 x dx u = tan^2 x du = 2(tan x)(sec^2 x) dx u = tan^3 x du = 3(tan^2 x)(sec^2 x)dx u = sec x du = sec x tan x dx The first three didn't look promising. All of them required a sec^2 x in order to substitute du into the integral. The last one looks a lot better, though, because we DO have a sec x tan x dx in the indefinite integral.

Since we have only one secant, \(u=\sec(x)\) seems like the only choice in order to have its derivative present. Note the key idea here: We want *u* to be something whose **derivative** is present in the integral, even if we don’t (yet) see a function of that *u*!

What we'll want to do, then, is to pull this quantity apart from the rest of the indefinite integral. In other words, we'll rewrite (tan^3 x)(sec x)dx as (tan^2 x)(sec x tan x dx) Remember that it doesn't matter in which order we multiply things. Then we know that if we make the substitution u = sec x, we'll be able to change the sec x tan x dx into du.

Now we look at the rest of the integrand.

The question now is whether we can write that remaining tan^2 x in terms of sec x, so we can replace it by something involving u. What relations (identities, etc.) exist between the functions tan x and sec x? I hope you're familiar with one of the Pythagorean identities that relates these two: 1 + tan^2 x = sec^2 x We want to write tan^2 x in terms of sec x, so we'll solve for tan^2 x in this equation: tan^2 x = sec^2 x - 1 Or, putting it in terms of u = sec x, we have tan^2 x = u^2 - 1

So now our integral becomes $$\int\tan^3(x)\sec(x)dx=\int\underset{f(u)}{\underbrace{\tan^2(x)}}\cdot\underset{du}{\underbrace{\sec(x)\tan(x)dx}}\\=\int\underset{u^2-1}{\underbrace{(\sec^2(x)-1)}}\cdot\underset{du}{\underbrace{\sec(x)\tan(x)dx}}=\int(u^2-1)du$$

We can substitute this into the indefinite integral to arrive at the following indefinite integral: INT (u^2 - 1) du and we hope you know how to finish the problem from there. Does this make sense? Substitution is a good strategy to consider in problems like this, particularly in instances where one of the trig functions is raised to an odd power, as in this case.

Here is the rest of the work: First we integrate, $$\int(u^2-1)du=\frac{1}{3}u^3-u+C$$ and then we back-substitute, replacing *u* with \(\sec(x)\), $$\frac{1}{3}\sec^3(x)-\sec(x)+C$$

Finally, if we are unsure, we can check by differentiating: $$\frac{d}{dx}\left(\frac{1}{3}\sec^3(x)-\sec(x)+C\right)\\=\frac{1}{3}\cdot3\sec^2(x)\cdot\sec(x)\tan(x)-\sec(x)\tan(x)\\=\left(\sec^2(x)-1\right)\sec(x)\tan(x)\\=\tan^2(x)\sec(x)\tan(x)=\tan^3(x)\sec(x)$$

## One step at a time

Sometimes it takes more than one substitution, as in this final question from 1998:

A Trigonometry Integral Requiring Two Substitutions What is the integral of sqrt(1 + sin(x)), where sqrt stands for "square root of"?

We want $$\int\sqrt{1+\sin(x)}dx$$ With nothing outside of the radical, what can we use for *du*?

Doctor Sam answered:

Paul, This is a tricky problem. It will take (I think) two different substitutions. We want to find: INT sqrt(1 + sin x) dx

(We’ll see that it could be done with only one substitution, but what he’s doing is just what I would do, trying something simple first. We just try whatever seems like it might help.)

I am going totry substituting u = sin(x)to try to remove the trig function. When you make a substitution, you must also substitute for dx. So: u = sin(x) and du = cos(x) dx This gives dx = du/cos(x), and changes the integral to sqrt(1 + u) INT ----------- du cos(x)

Since this time there is no differential sitting there waiting for us, we’re taking a step in the dark, trying an “inner function” and hoping its derivative will turn up. If this didn’t work, we might instead try \(u=1+\sin(x)\), or even \(u=\sqrt{1+\sin(x)}\) to see what happened.

I don’t like to write an integral with two different variables in it as he does here, but it’s okay as long as we see it as a fleeting intermediate step. We immediately want to express that denominator in terms of the new variable *u*:

This is no good.We need to get an integral in terms of the u variable alone.Here's where a little right-triangle trigonometry can help. We made the substitution u = sin(x), so we can visualize a triangle with an acute angle x whose sine is u. Here is one such triangle: /| / | / | / | 1 / | u / | /x | -------- Now we can use the Pythagorean Theorem to find the third side, and then the cosine of x. The third side is sqrt(1 - u^2), and so: cos(x) = sqrt(1 - u^2)

Alternatively, we could just recall the Pythagorean identity without drawing the picture; We want to express \(\cos(x)\) in terms of \(\sin(x)\), so we observe that \(\sin^2(x)+\cos^2(x)=1\); therefore, \(\cos(x)=\sqrt{1-\sin^2(x)}=\sqrt{1-u^2}\).

But we’ve skipped over an important question: There are *two* square roots; shall we take the positive or negative root? This depends on what quadrant angle *x* is in! If \(-\frac{\pi}{2}\le x\le \frac{\pi}{2}\), then the cosine will be positive; otherwise it would be negative, and the actual integral would have a different sign. Let’s just restrict *x* to that interval for simplicity; it turns out that making a single formula for the integral over all real numbers is tricky (even Wolfram Alpha doesn’t quite manage it).

Our integral is now: sqrt(1 + u) INT ------------- du sqrt(1 - u^2) Now I can't help but notice that 1 - u^2 = (1 - u)(1 + u) so this fraction simplifies to: 1 INT ----------- du sqrt(1 - u)

So we have a new, and simpler, integral; but it still is not one we’ve memorized.

We are almost done. We have now transformed our trig integral into an algebraic integral. Now asecond substitution:w = 1 - ushould finish the job. If w = 1 - u, then dw = -du, so du = -dw. This gives: 1 - INT ------- dw sqrt(w)

Now we just have to rewrite this, and it will be one of our basic forms:

Interpret this as w^(-1/2), and we can use the formula for antidifferentiating u^n: - INT w^(-1/2) dw = -2w^(1/2) + C Now change back from w to u using w = 1 - u: -2w^(1/2) = -2 sqrt(1 - u) + C And now change back from u to x using u = sin(x): -2w^(1/2) = -2 sqrt(1 - u) + C =-2 sqrt(1 - sin(x)) + C

We can check our answer by differentiating: $$\frac{d}{dx}\left(-2\sqrt{1-\sin(x)}+C\right)=\frac{d}{dx}\left(-2\left(1-\sin(x)\right)^{1/2}\right)\\=-2\cdot\frac{1}{2}\left(1-\sin(x)\right)^{-1/2}\cdot\left(-\cos(x)\right)=\frac{\cos(x)}{\sqrt{1-\sin(x)}}\\=\frac{\sqrt{1-\sin^2(x)}}{\sqrt{1-\sin(x)}}=\frac{\sqrt{1+\sin(x)}\sqrt{1-\sin(x)}}{\sqrt{1-\sin(x)}}=\sqrt{1+\sin(x)}$$

Do you see how this suggests a trick method we could have used instead? Work backward:

$$\int\sqrt{1+\sin(x)}dx=\int\frac{\sqrt{1+\sin(x)}\sqrt{1-\sin(x)}}{\sqrt{1-\sin(x)}}dx\\=\int\frac{\sqrt{1-\sin^2(x)}}{\sqrt{1-\sin(x)}}dx=\int\frac{\cos(x)dx}{\sqrt{1-\sin(x)}}$$ Letting \(u=1-\sin(x)\), we have

$$\int\frac{-du}{\sqrt{u}}=-\int u^{-1/2}du=-2u^{1/2}\\=-2\sqrt{1-\sin(x)}+C$$

And we could have made this same substitution from the start; it combines the two we did above into one. We can let \(w=1-\sin(x)\) all at once, so that \(\sin(x)=1-w\) and $$dw=-\cos(x)dx=-\sqrt{1-\sin^2(x)}dx\\=-\sqrt{1-(1-w)^2}dx=-\sqrt{2w-w^2}dx$$

Then $$\int\sqrt{1+\sin(x)}dx=\int\sqrt{1+(1-w)}\cdot\frac{dw}{-\sqrt{2w-w^2}}\\

=-\int\frac{\sqrt{2-w}\,dw}{\sqrt{2w-w^2}}=-\int\frac{\sqrt{2-w}\,dw}{\sqrt{w}\sqrt{2-w}}\\

=-\int\frac{dw}{\sqrt{w}}=-\int w^{-1/2}dw\\

=-2w^{1/2}=-2(1-\sin(x))^{1/2}=-2\sqrt{1-\sin(x)}+C$$

But we’d never have thought of that. Step by step is the way to go.