# Integration by Substitution

# Introduction to u-Substitution

We already know how to integrate every function that we will ever integrate in this course. No, seriously.

When you learned how to differentiate, you first learned derivatives for the same handful of functions, and then you learned rules for handling different combinations of those functions (using the Product Rule, Quotient Rule, and Chain Rule). The idea is similar here: you know how to integrate the basic functions, and the rest of the time will be spent integrating variations and combinations of those functions.

The most fundamental concept that bridges the gap between the basic functions and their variations is **substitution**. This section deals with what we call u-substitution (because we'll introduce a $u$ into the problem), but most of the other methods that you'll see in the following sections are just different kinds of substitutions. If you can get a solid grasp on the idea in this section, you'll be well set for what follows.

Let's start slow with a simple example.

## Why Substitute?

Evaluate $\displaystyle\int \cos(2x) \ dx$.

### Solution

If the problem were $\displaystyle\int \cos x \ dx$, the answer would simply be $\ans{\sin x + C}$.

It's not *quite* that simple, but let's use that as a starting point. In other words, think about what function would have $\cos(2x)$ as its derivative - you should be able to tell that the answer will involve $\sin (2x)$.

The answer can't only be $\sin(2x) + C,$ though, because the derivative of that (using the Chain Rule) is $2 \cos (2x).$

We're getting close, though. The integral of $\cos (2x)$ is *almost* $\sin (2x) + C$, but we're off by a multiple of 2.

Check this out, though: since our answer is double what it should be, we know that the correct answer is half of our guess.

Putting this all together: $\int \cos (2x) \ dx = \ans{\dfrac{1}{2}\sin(2x) + C}$

### Check

We can verify this by differentiating $\dfrac{1}{2}\sin(2x) + C$; I'll leave it to you to make sure its derivative is $\cos(2x)$.

Maybe you noticed that we didn't actually do any substitution in that problem - we just took an educated guess and tweaked the answer until we got something that worked. As problems get harder, we won't be able to solve them that way, though.

Let's do an almost identical example to the last one, and this time we'll actually use substitution to solve it.

## First Substitution

Evaluate $\displaystyle\int 2 \cos (2x) \ dx$.

### Solution

At this point, it shouldn't be huge surprise that the answer will be $\sin(2x) + C,$ but our goal is to see how u-substitution can get us to this answer.

Remember, we have a very short list of functions that we actually know how to integrate: anything of the form $x^n$, $e^x$, and a handful of trigonometric functions.

To integrate $\cos(2x)$, look for the closest form that we do know how to integrate: $\cos x$. If instead of $2x$ we had $x$, we'd be able to integrate this.

That's what leads us to substitution: we're going to introduce a new variable $u$ so that our problem just involves integrating $\cos u$. To do this, we need to let $u = 2x.$

Now our problem looks like $\int 2 \cos (2x) \ dx = \int 2 \cos u \ dx$

That raises a new issue, though: we've got a variable mismatch. We're integrating a function of $u$ with respect to $x$, which doesn't make any sense. Instead of $dx$ at the end, we need to have $du$.

### Differentials

We need to take our definition of $u$ and find $du$ from it. Without getting too technical, $du = \dfrac{du}{dx} \ dx$

So since $u = 2x$, $\dfrac{du}{dx} = 2$, so $du = 2\ dx$

In every problem, once you define $u$, take its derivative, slap on $dx$, and you've got $du$.

### Back to the Problem

Where were we? $\int 2 \cos (2x) \ dx = \int {\color{red}2} \cos u \ {\color{red}dx}$

Look at that: we've got a $2$ and a $dx$ in our problem, so we can replace those with ${\color{red}du}$.

$\int 2 \cos (2x) \ dx = \int {\color{red}2} \cos u \ {\color{red}dx} = \int \cos u \ du$

At this point we can integrate: $\int \cos u \ du = \sin u + C$

We've got an answer, but it is given in terms of $u$, which isn't what we want; the problem was given in terms of $x$, so the answer should be too.

All we need to do now is replace $u$ with $2x$ (look back at where we defined $u$), and we're all done!

$\int 2 \cos (2x) \ dx = \ans{\sin (2x) + C}$

Evaluate $\displaystyle\int 5 \sin (5x) \ dx$

$-5 \cos (5x) + C$

## What have we done?

That example is much longer than it needed to be, because I wanted to lay out the first instance of substitution in all its detail, because if you miss one of the core concepts, it'll be frustrating later to try to catch up. Let me summarize the key points of the example here, though, in much less detail:

- We were given an integral involving $\cos (2x)$: $\int 2 \cos (2x) \ dx$
- We noticed that if we replaced the $2x$ with $u$, we'd just have $\cos u$, which we know how to integrate
- Once we picked $u = 2x$, we found that $du = 2 \ dx$
- We replaced the $2x$ inside the cosine function with $u$, and we replaced the $2$ and $dx$ with $du$
- We integrated to get an answer in terms of $u$, and substituted back to get the answer in terms of $x$: $\int 2 \cos (2x) \ dx = \int \cos u \ du = \sin u + C = \sin (2x) + C$

For all the examples in this section, the basic steps will be the same.

This diagram helps to illustrate the process of u-substitution:

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.

## How do you pick $u$?

Every problem starts with picking a definition for $u$. If you're trying to figure out what to make it, just remember that after substituting, you need to end up with one of the basic integral forms: $x^n$, $e^x$, or a trig function. So to start, see what form the problem fits.

For instance, if the integral involved something like $e^{2x+5}$, we'd want to let $u=2x+5$, so that after substituting, we'd be left with $e^u$, which we know how to integrate.

Another thing to think about is that after picking $u$, you'll also need to substitute for $du$, which involves the derivative of $u$.

Here's an example: $\int 2x \ e^{x^2}\ dx$ Notice the exponential form: if we let $u=x^2$, $du=2x\ dx$, so after substituting, the integral looks like $\int e^u\ du,$ which is easy to integrate.

If you notice, like in that example, that one piece of the integral looks like the derivative of another piece, that can also help you pick $u$.

As we go through the examples below, try practicing using these tips to pick $u$.

# Examples

## Exponential u-Substitution

Use u-substitution to evaluate $\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 $du$. 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

As always, we can check by differentiating our answer: $\dfrac{d}{dx} (e^{8x} + C) = 8e^{8x} \textrm{(using the Chain Rule)}$

## Power Function u-Substitution

Evaluate $\displaystyle\int (2x^3-3)^4 \cdot 6x^2\ dx$.

### Solution

The basic form here is that of a power function, so it makes sense to let $u=2x^3-3.$ Also, if we do so, $du = 6x^2\ dx$, which also appears in the problem.

Making the substitution and integrating: $\int u^4 \ du = \dfrac{1}{5}u^5 + C$

Finally, substitute back to get the answer in terms of $x$: $(2x^3-3)^4 \cdot 6x^2\ dx = \ans{\dfrac{1}{5}(2x^3-3)^5 + C}$

I'll leave it to you to check by differentiating the answer.

$\displaystyle\int 3(3x-7)^9 \ dx$

$\displaystyle\int 4e^{4x} \ dx$

$\dfrac{1}{10}(3x-7)^{10} + C$

$e^{4x} + C$

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

### Solution

What's different about this example? As before, let $u$ be the exponent so that we'll have $e^u$ after substituting: $u = 7x \longrightarrow du = 7 \ dx$

The difference is that now, there's no $7$ in the integral to be replaced with $du$.

What we *do* have is $dx$, so we can solve for that:
$du = 7 \ dx \longrightarrow \dfrac{1}{7} \ du = dx$

After replacing $7x$ with $u$ and $dx$ with $\dfrac{1}{7}\ du$: $\int e^{7x}\ dx = \int \dfrac{1}{7}\ e^u \ du = \dfrac{1}{7}\ e^u + C = \ans{\dfrac{1}{7}\ e^{7x} + C}$

Evaluate $\displaystyle\int (3x^4+7)^3 \cdot 5x^3\ dx$.

### Solution

Let $u=3x^4+7$, so $du = 12x^3\ dx$. Notice that $12x^3$ is not exactly the $5x^3$ that we have in the problem, but it's only off by a constant multiple, so we can do the same thing we did in the last example.

The part that is the same is $x^3\ dx$, so solve for that: $du = 12x^3\ dx \longrightarrow \dfrac{1}{12}\ du = x^3\ dx$

Making the substitution: $\int (3x^4+7)^3 \cdot 5x^3\ dx = \int u^3 \cdot 5 \cdot \dfrac{1}{12}\ du$

Finally we can integrate and re-substitute: $\int \dfrac{5}{12}\ u^3\ du = \dfrac{5}{12} \cdot \dfrac{1}{4}\ u^4 + C = \ans{\dfrac{5}{48}(3x^4+7)^4 + C}$

$\displaystyle\int (2x+5)^7\ dx$

$\displaystyle\int \cos(7x)\ dx$

$\displaystyle\int \sin(3x)\ dx$

$\dfrac{1}{16} (2x+5)^8 + C$

$\dfrac{1}{7} \sin(7x) + C$

$-\dfrac{1}{3} \cos (3x) + C$

## Reciprocal Function

Evaluate $\displaystyle\int \dfrac{4}{4x-3}\ dx$.

### Solution

This one looks like the reciprocal function, so let $u=4x-3$. In that case, $du = 4\ dx$, so after substituting, we're left with $\int \dfrac{4}{4x-3}\ dx = \int \dfrac{1}{u}\ du$

Integrating gives the natural log function: $\int \dfrac{1}{u}\ du = \ln u + C = \ans{\ln |4x-3| + C}$

### Natural Log and Absolute Value

Why did the last answer use the absolute value inside the natural log function?

First, remember that the natural log function is only defined for positive inputs. It turns out that this means that, technically, $\int \dfrac{1}{x}\ dx = \ln |x| + C$

Think about it in reverse: if $x > 0$, $\dfrac{d}{dx} [\ln x] = \dfrac{1}{x}$ If $x < 0$, $\ln x$ is not defined, so instead we can use $\ln (-x)$: $\dfrac{d}{dx} [\ln (-x)] = \dfrac{1}{-x} \cdot (-1) = \dfrac{1}{x}.$

Since the absolute value function is defined as $|x| = \left{\begin{array}{r l} x & \textrm{if } x > 0\ -x & \textrm{if } x < 0 \end{array}\right.$ we can summarize the two derivatives above as $\dfrac{d}{dx} \ln |x| = \dfrac{1}{x}$ which means that $\ans{\int \dfrac{1}{x}\ dx = \ln |x| + C}$

We often leave off the absolute value signs on the base case, but you'll see them included when we do substitution.

Evaluate $\displaystyle\int \dfrac{1}{2x+7}\ dx$.

### Solution

Let $u = 2x+7$, so $du = 2\ dx$. Again, we're off by a constant multiple, so we need to solve for $dx$ as before: $du = 2\ dx \longrightarrow \dfrac{1}{2} \ du = dx$

After substituting: $\int \dfrac{1}{2x+7}\ dx = \int \dfrac{1}{u} \cdot \dfrac{1}{2}\ du = \dfrac{1}{2} \ln |u| + C = \ans{\dfrac{1}{2}\ln |2x+7| + C}$

There are patterns like this one that it can be handy to get familiar with. If you can follow the pattern, for instance, you can solve the following problem almost immediately:

$\int \dfrac{1}{9x-2}\ dx = \dfrac{1}{9} \ln |9x-2| + C$

And this one: $\int \dfrac{2}{5-3x} \ dx = -\dfrac{2}{3} \ln |5-3x| + C$

$\displaystyle\int \dfrac{1}{7x+15} \ dx$

$\displaystyle\int \dfrac{1}{5-2x} \ dx$

$\displaystyle\int \dfrac{3}{-5x+12} \ dx$

$\dfrac{1}{7} \ln |7x+15| + C$

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

$-\dfrac{3}{5} \ln |-5x+12| + C$

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

### Solution 1

Having limits of integration just adds one step at the end of the problem: we can do the indefinite integral as usual, then use the Fundamental Theorem of Calculus at the end.

Let $u=2x+1$, so $du = 2\ dx \longrightarrow \dfrac{1}{2}\ du = dx$. $\begin{aligned} \int \sqrt{2x+1}\ dx &= \int \dfrac{1}{2} \sqrt{u} \ du\ &= \int\dfrac{1}{2} u^{1/2}\ du\ &= \dfrac{1}{2} \cdot \dfrac{2}{3} u^{3/2} + C\ &= \dfrac{1}{3}(2x+1)^{3/2} \end{aligned}$

Now, using the limits of integration: $\dfrac{1}{3}(2x+1)^{3/2} \bigg|_0^4 = \dfrac{1}{3} \cdot 9^{3/2} - \dfrac{1}{3} \cdot 1^{3/2} = \ans{\dfrac{26}{3}}$

### Solution 2

There's another option for how to solve this, although it's only a small change: instead of doing the whole substitution process and then evaluate the limits, we can take the limits with us into u-land and evaluate them there.

$u = 2x+1$ When $x=0$, $u = 2(0)+1 = 1$. When $x=4$, $u=9$.

Thus, $\int_0^4 \sqrt{2x+1}\ dx = \int_1^9 \sqrt{u}\ du$

After integrating, we get $\dfrac{1}{3}u^{3/2} \bigg|_1^9 = \dfrac{1}{3} \cdot 9^{3/2} - \dfrac{1}{3} \cdot 1^{3/2} = \ans{\dfrac{26}{3}}$

If you notice, we really did the same work in both cases; all that really changed is *where* we did each step. Either process gives the same answer, so it's really up to you to choose which you prefer.

$\displaystyle\int_1^2 \dfrac{1}{(3-5x)^2} \ dx$

\dfrac{1}{5(3-5x)} \ \bigg|*1^2 = \dfrac{1}{5u} \ \bigg*{-2}^{-7} = \dfrac{1}{14}

## A Tricky One

Evaluate $\displaystyle\int x(x-4)^9\ dx$.

### Solution

Here again there are two parts, so we could let $u=x$ or let $u=x-4$. Letting $u=x$ wouldn't do anything other than rename the variable; it wouldn't simplify the integral at all.

Thus, let $u=x-4$, so $du=dx$.

Substituting: $\int x(x-4)^9\ dx = \int x \cdot u^9\ du$

The only problem is that there's a lingering $x$, so what can we replace $x$ with so that the integral will only involve $u$? The answer lies in the definition of $u$: if $u=x-4$, $x = u+4$: $\int (u+4)u^9\ du$

This still looks complicated, but there's something we can do now that we couldn't do at the beginning: we can distribute the $u^9$ through the parentheses: $\begin{aligned} \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} + C} \end{aligned}$

## Another Tricky One

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

### Solution

Let $u=1-x$, so $x=1-u$ and $-du = dx$.

Substituting: $\begin{aligned} \int \dfrac{x^2}{\sqrt{1-x}}\ dx &= \int \dfrac{(1-u)^2}{\sqrt{u}} \ du\ &= \int \dfrac{1-2u+u^2}{u^{1/2}}\ 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{aligned}$

$\displaystyle\int (3x^2+13)^9 \cdot 6x\ dx$

$\displaystyle\int xe^{x^2+2}\ dx$

$\displaystyle\int 2x^2 \ \sqrt{1+x^3}\ dx$

$\displaystyle\int 8 \sec(3x) \tan(3x)\ dx$

$\displaystyle\int x \cos(x^2)\ dx$

$\displaystyle\int \dfrac{(\ln x)^4}{x}\ dx$

$\displaystyle\int \dfrac{x}{x-5}\ dx$

$\displaystyle\int (\cos^6 x - \cos^2 x) \sin x\ dx$

$\dfrac{1}{10}(3x^2+13)^{10} + C$

$\dfrac{1}{2}e^{x^2+2} + C$

$\dfrac{4}{9}(1+x^3)^{3/2} + C$

$\dfrac{8}{3}\sec(3x) + C$

$\dfrac{1}{2} \sin (x^2) + C$

$\dfrac{1}{5} (\ln x)^5 + C$

$x-5 + 5 \ln |x-5| + C$

$-\dfrac{1}{7}\cos^7 x + \dfrac{1}{3}\cos^3 x + C$