$$\def\ans#1{\bbox[border:1px solid green,6pt]{#1}}$$

# Integration by Substitution

## Introduction to u-Substitution

Here's the dirty little secret about integration methods: we really only know how to integrate a few simple functions. If we want to integrate anything more complicated, we ultimately have to simplify it to look like one of those functions. The first method we have to do that is the simplest: u-substitution. However, as we discuss more complicated integration methods, we'll see that, really, they're all variations of substitution, or perhaps a different kind of substitution. But the key is that we have to do whatever we can to break a complicated integral down into a simple form that we can directly integrate.

When we do u-substitution, we'll transform an integral in terms of $$x$$ into an integral in terms of $$u$$. In the process, we'll have two goals:

1. Replace all the $$x$$'s, so that the result only has $$u$$.
2. Make the result a simpler integral to do.

Let's illustrate u-substitution with an example. Take a look at $$\int 2x(x^2+1)^3 \ dx.$$

That almost looks like something we can integrate, but not quite. Follow me for a moment as I take a leap: let's define a new variable1 $$u$$ like this: $$u=x^2+1.$$ Now, instead of having $$(x^2+1)^3$$ in the integral, we'll just have $$u^3$$, which is something we can handle with the Power Rule.

This brings us to a crucial part of the process: if we're replacing all the $$x$$'s, we also need to replace $$dx$$ in the integral. Recall what you learned about differentials in Calculus 1: if $$u = f(x)$$, then $$du = f'(x) \ dx$$. In this case, then,

$u = x^2+1 \longrightarrow du = 2x \ dx.$

Go back to the integral we're trying to tackle: if we replace $$x^2+1$$ with $$u$$, that leaves $$2x$$ and $$dx$$, which conveniently get replaced with $$du$$:

$\int 2x(x^2+1)^3 \ dx = \int u^3 \ du.$

This is something that we know how to integrate; if we use the Power Rule, we see that

$\int u^3 \ du = \dfrac{1}{4}u^4 + C.$

We finally have an answer, but our answer is stated in terms of $$u$$, and we need to express it in terms of $$x$$, since that's how the problem was given. To do this, just look back to where we defined $$u$$, and you'll see that we just need to replace $$u$$ with $$x^2+1$$. This gives us our final answer:

$\int 2x(x^2+1)^3 \ dx = \int u^3 \ du = \dfrac{1}{4}u^4 + C = \ans{\dfrac{1}{4}(x^2+1)^4+C}$

### What have we done?

This diagram illustrates the process:

If we encounter an integral that we can't evaluate directly, we can often get around the difficulty by picking a substitution that makes for an easier integral. I often liken this to crossing a river: if we want to get from one side to another, but the crossing is difficult where we are standing, we can go downriver to an easier spot, cross the river, and then come back upriver to where we want to be.

## Procedure

Here's what we did in that example:

1. Find a way to substitute $$u$$ for $$x$$ in such a way that in simplifies the integral (more on this below).
2. Find $$du$$ by differentiating $$u$$ and tacking on $$dx$$: $\text{if } u = f(x) \text{, then } du = f'(x) dx.$
3. Substitute to get an integral in terms of $$u$$ (a simpler integral than the original one).
4. Integrate with respect to $$u$$ (this is what the $$du$$ tells us to do).
5. Substitute back, using the definition of $$u$$ to get an answer in terms of $$x$$.

### How do you pick $$u$$?

The short answer to this question is that you learn by practice. After doing a few of these, the process of picking $$u$$ gets easier and more natural. However, there are a few guidelines that can help you as you get started:

• In u-substitution problems, there are typically two pieces to the integral ($$(x^2+1)^3$$ and $$2x$$ in the example above).
• See if one of the pieces looks like the derivative of the other. For instance, in the example above, $$2x$$ is exactly the derivative of $$x^2+1$$. More generally, if both pieces are polynomials, see if one of them is one degree lower than the other (in that case, the one with the lower degree is at least similar to the derivative of the other).
• If you see something like that, the one that is like the derivative will be replaced with $$du$$ during the substitution, so let the other one be $$u$$.

## Examples

Use u-substitution to integrate $$\displaystyle\int 8e^{8x} \ dx.$$

#### Solution

Let's follow the process outlined above to pick $$u$$. Remember that, after substituting, we want the result to be one of the basic integrals that we can do: we can integrate $$e^{u}$$, but not $$e^{8x}$$. Plus, we notice that $$8$$ is the derivative of $$8x$$, so if we let $$u=8x,$$ the $$8$$ will get picked up by the $$dx$$. Let's try that:

$u = 8x \longrightarrow du = 8 \ dx$

Now make the substitution:

$\int e^u \ du$

We can integrate this, and once we do, we can substitute back into $$x$$ to get the final answer:

$\int e^u \ du = e^u + C = \ans{e^{8x} + C}$

#### Check

Don't forget that we can always check our answer after integrating by differentiating our answer and making sure we get back to where we started:

$\dfrac{d}{dx}(e^{8x}+C) = 8e^{8x} \text{ (using the Chain Rule)}$

This checks out, so we can be sure we got it!

#### Try it yourself:

(click on a problem to show/hide its answer)

1. $$\displaystyle\int 3(3x-7)^4 \ dx$$
2. $$\dfrac{1}{5} (3x-7)^5 + C$$

3. $$\displaystyle\int 4e^{4x} \ dx$$
4. $$\dfrac{1}{4} e^{4x} + C$$

Evaluate the following integral: $$\displaystyle\int e^{7x} \ dx.$$

#### Solution

What's different about this example? It looks very similar, but if we let $$u=7x$$ to follow the pattern from the previous example, there isn't a $$7$$ somewhere else in the integral to get replaced by $$du$$. Let's start the same way, though, and see what happens: $u=7x \longrightarrow du = 7 \ dx.$ Looking back at the original integral, we notice that we can replace $$e^{7x}$$ with $$e^u$$, but all that's left is $$dx$$. Here's where we see the first example of a common step: we have $$du = 7 \ dx$$, and all we have to replace is $$dx$$, so we solve for that: $du = 7 \ dx \longrightarrow \dfrac{1}{7} \ du = dx.$

NOW we can finally make the substitution and integrate to get our final answer:

$\displaystyle\int e^{7x} \ dx = \displaystyle\int \dfrac{1}{7} e^u \ du = \dfrac{1}{7} \displaystyle\int e^u \ du = \dfrac{1}{7}e^u + C = \ans{\dfrac{1}{7}e^{7x} + C}$

#### Try it yourself:

(click on a problem to show/hide its answer)

1. $$\displaystyle\int (2x+5)^7 \ dx$$
2. $$\dfrac{1}{16} (2x+5)^8 + C$$

3. $$\displaystyle\int \cos (7x) \ dx$$
4. $$\dfrac{1}{7} \sin (7x) + C$$

5. $$\displaystyle\int \sin (3x) \ dx$$
6. $$-\dfrac{1}{3} \cos (3x) + C$$

Evaluate the following integral: $$\displaystyle\int \dfrac{4}{4x-3} \ dx.$$

#### Solution

It's pretty clear what the two parts of this function are, and it should be equally clear that $$4$$ is the derivative of $$4x-3$$, so we let $u=4x-3 \longrightarrow du = 4 \ dx.$

For this one, we don't have to worry about that extra step in the last example where we account for a missing constant, since the $$4x-3$$ gets replaced with $$u$$, and the $$4$$ and $$dx$$ together get replaced with $$du$$. Therefore, we can jump straight to substituting and solving:

$\displaystyle\int \dfrac{4}{4x-3} \ dx = \displaystyle\int \dfrac{1}{u} \ du = \ln u + C = \ans{\ln |4x-3| + C}$

#### Two Notes From This Example

1. Notice that, as before, once we substituted, we got to one of the basic forms that we have memorized how to integrate. Every time we do u-substitution, we need to get to one of the forms on that list in order to be able to integrate.
2. Notice the absolute value signs on the final answer. Where did these come from? If you don't want to worry about the details, you can skip this discussion (jump straight to the punchline), and just get used to including the absolute value signs when you integrate $$\dfrac{1}{x}$$.

There are several different ways to see this, but one of the simpler ones goes this way: if $$x>0$$, then $$\dfrac{d}{dx}[\ln x] = \dfrac{1}{x}$$ (remember, the natural log function is only defined for positive inputs). On the other hand, if $$x<0$$, we can evaluate $$\ln (-x)$$, and using the Chain Rule, we can see that $$\dfrac{d}{dx}[\ln (-x)] = \dfrac{1}{x}$$. Therefore, $\displaystyle\int \dfrac{1}{x} \ dx = \left\{\begin{array}{r l}\ln x & \text{ if } x>0\\ \ln (-x) & \text{ if } x<0\end{array}\right.$ Since $$|x|$$ is defined as $\left\{\begin{array}{r l}x & \text{ if } x>0\\ -x & \text{ if } x<0\end{array}\right.$ the following should be clear:
##### Punchline:
$\displaystyle\int \dfrac{1}{x} \ dx = \ln |x| + C$

To be perfectly honest, many people (including the author) often get lazy and just write $$\ln x + C$$ as the answer to this integral, but when the expression inside the logarithm is more complicated, it is more common to see the precise answer with the absolute value signs.

#### Try it yourself:

(click on the problem to show/hide the answer)

$$\displaystyle\int \dfrac{1}{5-2x} \ dx$$
$$-\dfrac{1}{2} \ln |5-2x| + C$$

Evaluate the following integral: $$\displaystyle\int \dfrac{3}{-5x+12} \ dx.$$

#### Solution

This looks similar to the previous example, and we notice that the denominator is a linear function, while the numerator is a constant. Since the derivative of a linear function is a constant, let $$u$$ be the denominator:

$u=-5x+12 \longrightarrow du = -5 \ dx$

Here, again, we don't have the right constant in the integral to make the substitution immediately, so we take advantage of that step where we solve for $$dx$$ and sort out the constants later:

$du = -5 \ dx \longrightarrow -\dfrac{1}{5}\ du = dx$

Now we can make the substitution, replacing the denominator with $$u$$ and replacing $$dx$$ with this expression.

$\int \dfrac{3}{-5x+12} \ dx = \int \dfrac{3}{u} \left(-\dfrac{1}{5}\right) \ du$

If we clean this up a little bit and pull the constants outside the integral, we can evaluate the integral and substitute back to get our answer in terms of $$x$$:

$\int \dfrac{3}{u} \left(-\dfrac{1}{5}\right) \ du = -\dfrac{3}{5}\int \dfrac{1}{u} \ du = -\dfrac{3}{5}\ln u + C = \ans{-\dfrac{3}{5}\ln |-5x+12| + C}$

#### Note:

In that example, we got a little bit lazy with the arbitrary constant. Technically, it should be

$-\dfrac{3}{5}\int u \ du = -\dfrac{3}{5}(\ln u + C) = -\dfrac{3}{5}\ln u -\dfrac{3}{5} \cdot C$

However, since $$C$$ is just an arbitrary constant anyway, multiplying it by any constant just makes another arbitrary constant. Technically, if we just fold that $$-3/5$$ into the constant, we should rename it $$K$$ or something to indicate that it has changed. But since we don't really care what that constant is until we solve for it, we can be a little bit lazy and multiply $$C$$ by other constants without really worrying about being pedantic.

Evaluate the following integral: $$\displaystyle\int_0^4 \sqrt{2x+1} \ dx.$$

#### Solution

This is the first example that we've seen of a definite integral using u-substitution, where we'll have to plug the limits of integration into the antiderivative at the end. The key to note here is that those limits of integration are $$x$$ values, so when we transition into $$u$$, we can't use the same limits. However, what we can do is drop off the limits until the very end (do the indefinite integral problem first, then once we've gotten our answer in terms of $$x$$, come back and plug in the limits).

Note: we can integrate $$\sqrt{u}$$, but not $$\sqrt{2x+1}$$, so let's define $u=2x+1 \longrightarrow du = 2\ dx \longrightarrow \dfrac{1}{2}\ du = dx$ Make the substitution and integrate:

$\int \sqrt{2x+1} \ dx = \int \dfrac{1}{2}\sqrt{u} \ du = \dfrac{1}{2}\int u^{1/2} \ du = \dfrac{1}{2} \cdot \dfrac{u^{3/2}}{3/2} = \dfrac{1}{2} \cdot \dfrac{2}{3} u^{3/2} = \dfrac{1}{3}(2x+1)^{3/2}$

Now we can plug the limits of integration into this answer (notice that we left off the $$+C$$ in the process, since that would drop off anyway when we evaluate the definite integral).

$\int_0^4 \sqrt{2x+1} \ dx = \dfrac{1}{3}(2x+1)^{3/2} \Bigg|_0^4 = \dfrac{1}{3} \cdot 9^{3/2} - \dfrac{1}{3} \cdot 1^{3/2} = 9-\dfrac{1}{3} = \ans{\dfrac{26}{3}}$

#### Alternate Solution

There's another way to handle a definite integral with u-substitution: we can rewrite the limits of integration in terms of $$u$$. This way, we can shortcut the process by substituting, integrating, and then plugging in the limits of integration, without ever coming back to $$x$$.

To rewrite the limits in terms of $$u$$, use the definition that we created: $$u=2x+1$$. Therefore, when $$x=0$$, $$u=2(0)+1 = 1$$, and when $$x=4$$, $$u=2(4)+1 = 9$$.

$\int_0^4 \sqrt{2x+1} \ dx = \int_1^9 \sqrt{u} \ du = \dfrac{1}{3}u^{3/2} \Bigg|_1^9 = \ans{\dfrac{26}{3}}$

Notice that we end up doing the same arithmetic either way; all that changes is the way that we keep track of the limits of integration.

Evaluate the following integral: $$\displaystyle\int x \cos (x^2) \ dx.$$

#### Solution

Notice that $$x$$ is similar to the derivative of $$x^2$$, so

$u = x^2 \longrightarrow du = 2x \ dx \longrightarrow \dfrac{1}{2} \ du = x \ dx.$

Making the subsitution, this becomes something we can integrate:

$\int x \cos (x^2) \ dx = \int \dfrac{1}{2} \cos u \ du = \dfrac{1}{2}\sin u + C = \ans{\dfrac{1}{2}\sin (x^2) + C}$

Evaluate the following integral: $$\displaystyle\int x(x-4)^9 \ dx.$$

#### Solution

This example is a bit of a tricky one. The two pieces that we notice here are $$x$$ and $$x-4$$, neither of which looks like the integral of the other (if that $$x$$ outside the parentheses were a constant, for instance, we'd be able to forge ahead as before). However, if we have to define one of them to be $$u$$, we'll certainly pick $u=x-4,$ because if we let $$u=x$$, that wouldn't simplify things at all.

Okay, so let's try this: (note that if $$u=x-4$$, $$du = dx$$) $\int x(x-4)^9 \ dx = \int x \cdot u^9 \ du.$ Of course, there's a glaring problem with this: we haven't replaced all the $$x$$'s! This is one of the fundamental goals of the substitution process, along with simplifying the integral.

The question, therefore, becomes: what can we replace $$x$$ with in terms of $$u$$? This is where the tricky part of the problem comes in: if we go back to the definition of $$u$$, we can rearrange this give us the answer to our problem: $u = x-4 \longrightarrow x = u+4.$ Therefore, we can replace $$x$$ with $$u-4$$: $\int x(x-4)^9 \ dx = \int x \cdot u^9 \ du = \int (u-4)u^9 \ du$

Why does this help? Well, now we are able to distribute the $$u^9$$ through the parentheses and integrate the resulting polynomial:

$\int (u-4)u^9 \ du = \int u^{10} - 4u^9 \ du = \dfrac{1}{11}u^{11} - \dfrac{4}{10}u^{10} + C = \ans{\dfrac{1}{11}(x-4)^{11}-\dfrac{4}{10}(x-4)^{10}}$

Evaluate the following integral: $$\displaystyle\int \dfrac{x^2}{\sqrt{1-x}} \ dx.$$

#### Solution

Select the piece inside the square root to be $$u$$: \begin{align} u = 1-x &\longrightarrow x = 1-u\\ du = -dx &\longrightarrow -du = dx \end{align} Making the substitution \begin{align} \int \dfrac{x^2}{\sqrt{1-x}} \ dx &= \int \dfrac{(1-u)^2}{\sqrt{u}} \ du\\ &= \int \dfrac{1-2u+u^2}{\sqrt{u}} \ du = \int \dfrac{1}{\sqrt{u}} -\dfrac{2u}{\sqrt{u}} +\dfrac{u^2}{\sqrt{u}} \ du\\ &= \int u^{-1/2} - 2u^{1/2} + u^{3/2} \ du = 2u^{1/2} - \dfrac{4}{3}u^{3/2} + \dfrac{2}{5}u^{5/2} + C\\ &= \ans{2(1-x)^{1/2} - \dfrac{4}{3}(1-x)^{3/2} + \dfrac{2}{5}(1-x)^{5/2} + C}\\ \end{align}

#### Try it yourself:

(click on a problem to show/hide its answer)

1. $$\displaystyle\int \dfrac{1}{7x+15} \ dx$$
2. $$\dfrac{1}{7} \ln |7x+15| + C$$

3. $$\displaystyle\int_1^2 \dfrac{dx}{(3-5x)^2}$$
4. $$\dfrac{1}{5(3-5x)} \Big|_1^2 = \dfrac{1}{14}$$

5. $$\displaystyle\int \dfrac{x}{x+6} \ dx$$
6. $$(x+6)-6\ln (x+6) + C$$

7. $$\displaystyle\int xe^{x^2} \ dx$$
8. $$\dfrac{1}{2}e^{x^2} + C$$

9. $$\displaystyle\int \dfrac{(\ln x)^4}{x} \ dx$$
10. $$\dfrac{1}{5} (\ln x)^5 + C$$

#### Footnotes

1. Called a dummy variable, since we create it in the process of solving a problem, but it doesn't appear in our answer, and it isn't used for any other purpose than simply to solve the problem.