Instant PDF download, name-and-email checkout. Complete bundle: every Economics, Statistics and Mathematics book
Mathematics guide, Unit 6, step 22 of 33Previous stepNext step

Step 22: Integration by Substitution

SyllabusAP 6.9 · 9709 P3 3.5 · IB HL 5.16
In 30 seconds
  • Substitution undoes the chain rule. Spot an inside function \( u = g(x) \) whose derivative \( g'(x) \) is also sitting in the integrand, then write everything, including \( dx \), in terms of \( u \).
  • In a definite integral, change the limits to values of \( u \) as well, and never mix \( x \)-limits with a \( u \)-integral.
  • Two patterns are worth knowing on sight: \( \int \frac{f'(x)}{f(x)}\,dx = \ln|f(x)| + C \) and \( \int f'(x)[f(x)]^n\,dx = \frac{[f(x)]^{n+1}}{n+1} + C \). Squares of sine and cosine need the double angle identities; \( \frac{1}{x^2 + a^2} \) and \( \frac{1}{\sqrt{a^2-x^2}} \) give \( \tan^{-1} \) and \( \sin^{-1} \).
  • Exam point: Cambridge 9709 Paper 3 always tells you the substitution, and the line converting \( dx \) and the limits carries method marks. On AP you choose \( u \) yourself.
Video lesson coming soonA short animated lesson for this step will appear here.

Undoing the chain rule

The rules in Step 21 handle powers, exponentials and trigonometric functions of \( ax + b \). They cannot touch \( \int 2x(x^2 + 1)^5\,dx \), because the inside, \( x^2 + 1 \), is not linear. But look at the shape: there is a bracket raised to a power, and next to it sits \( 2x \), which is exactly the derivative of the bracket. That is the fingerprint of the chain rule. Differentiate \( (x^2 + 1)^6 \) and you get \( 6(x^2 + 1)^5 \cdot 2x \). So \( \int 2x(x^2 + 1)^5\,dx = \tfrac16(x^2 + 1)^6 + C \).

Substitution is the method that finds this without guessing. Name the inside \( u = x^2 + 1 \). Then \( \dfrac{du}{dx} = 2x \), which we write as \( du = 2x\,dx \). The integral becomes \( \int u^5\,du = \tfrac16u^6 + C \), and putting \( x \) back gives the same answer.

Key termIntegration by substitution: if \( u = g(x) \), then \( du = g'(x)\,dx \) and \[ \int f\big(g(x)\big)\,g'(x)\,dx = \int f(u)\,du. \] For a definite integral, the limits change too: \( x = a \) becomes \( u = g(a) \) and \( x = b \) becomes \( u = g(b) \).

Writing \( du = g'(x)\,dx \) is bookkeeping, not a new rule. If \( F \) is an antiderivative of \( f \), the chain rule says \( \frac{d}{dx}F(g(x)) = f(g(x))\,g'(x) \), so \( F(g(x)) \) is the antiderivative you wanted.

Worked example

Find \( \int x^2(x^3 + 2)^4\,dx \).

Step 1The inside is \( x^3 + 2 \), whose derivative \( 3x^2 \) matches the \( x^2 \) outside up to a constant. Let \( u = x^3 + 2 \), so \( du = 3x^2\,dx \) and \( x^2\,dx = \tfrac13\,du \).
Step 2Rewrite: \( \int (x^3 + 2)^4 \cdot x^2\,dx = \tfrac13\int u^4\,du = \tfrac{1}{15}u^5 + C \).
Step 3Return to \( x \): \( \tfrac{1}{15}(x^3 + 2)^5 + C \).

Check by differentiating: \( \tfrac{1}{15} \cdot 5(x^3 + 2)^4 \cdot 3x^2 = x^2(x^3 + 2)^4 \). A constant factor that does not match (here \( \tfrac13 \)) is fine; a missing \( x \) is not. You could not use this \( u \) on \( \int (x^3 + 2)^4\,dx \), because there would be no \( x^2 \) to absorb.

Worked example

Evaluate \( \displaystyle\int_0^2 \frac{x}{(x^2 + 1)^2}\,dx \).

Step 1Let \( u = x^2 + 1 \), so \( du = 2x\,dx \) and \( x\,dx = \tfrac12\,du \).
Step 2New limits: \( x = 0 \) gives \( u = 1 \); \( x = 2 \) gives \( u = 5 \).
Step 3\( \displaystyle\tfrac12\int_1^5 u^{-2}\,du = \tfrac12\Big[-\tfrac1u\Big]_1^5 = \tfrac12\left(-\tfrac15 + 1\right) = \tfrac25 \).

There is no need to go back to \( x \): the new limits belong to \( u \). Figure 1 shows why this works. The region under the new curve is a different shape, but it has exactly the same area.

One area, two variables
y = x/(x² + 1)², shaded for 0 ≤ x ≤ 2y = 1/(2u²), shaded for 1 ≤ u ≤ 5
1234560.10.20.30.40.50.60x or uyteal area = 2/5gold area = 2/5
Figure 1. The substitution u = x² + 1 changes the shape of the region but not its size: both shaded areas equal 2/5. That is why the limits must change with the variable.
Common mistakeKeeping the old limits. Once the integral is written in \( u \), the limits must be values of \( u \). Using 0 and 2 in the example above gives \( \tfrac12\big[-\tfrac1u\big]_0^2 \), which is not even defined. Either change the limits, or return to \( x \) first and use the original ones. Never mix the two. A second classic slip is forgetting to convert \( dx \): \( \int (x^3 + 2)^4\,dx \) does not become \( \int u^4\,du \).

How to choose \( u \). On AP and IB papers nobody tells you the substitution, so it helps to know where to look. In almost every exam question, \( u \) is the “inside” of something: the expression inside a bracket that is raised to a power, inside a square root, in the exponent of \( e \), or in the denominator. Then you check that its derivative, or a constant multiple of it, is also there as a factor. If it is, the substitution will work. If there is a stray \( x \) left over that you cannot absorb, try a different \( u \), or a different method altogether.

Integrand looks likeTryBecause the integrand contains
\( x^3\sqrt{x^4 + 5} \)\( u = x^4 + 5 \)\( x^3 \), a multiple of \( 4x^3 \)
\( x\,e^{-x^2} \)\( u = -x^2 \)\( x \), a multiple of \( -2x \)
\( \dfrac{\ln x}{x} \)\( u = \ln x \)\( \tfrac1x \), the derivative of \( \ln x \)
\( \cos x\,e^{\sin x} \)\( u = \sin x \)\( \cos x \), the derivative of \( \sin x \)

So, for example, \( \int \dfrac{\ln x}{x}\,dx = \int u\,du = \tfrac12(\ln x)^2 + C \), and \( \int \cos x\,e^{\sin x}\,dx = e^{\sin x} + C \).

When the substitution is given

Cambridge 9709 Paper 3 (topic 3.5) does not ask you to invent a substitution: the question says “use the substitution \( u = \ldots \)”. Often the substitution is not “a bracket and its derivative”. Then you make \( x \) the subject, replace every \( x \), and convert \( dx \) using \( \dfrac{du}{dx} \).

Worked example

Use the substitution \( u = x-1 \) to find the exact value of \( \displaystyle\int_2^5 x\sqrt{x-1}\,dx \).

Step 1From \( u = x-1 \): \( x = u + 1 \) and \( du = dx \). Limits: \( x = 2 \Rightarrow u = 1 \); \( x = 5 \Rightarrow u = 4 \).
Step 2The integral becomes \( \displaystyle\int_1^4 (u + 1)u^{1/2}\,du = \int_1^4 \left(u^{3/2} + u^{1/2}\right)du \).
Step 3Integrate: \( \Big[\tfrac25u^{5/2} + \tfrac23u^{3/2}\Big]_1^4 = \left(\tfrac{64}{5} + \tfrac{16}{3}\right)-\left(\tfrac25 + \tfrac23\right) \).
Step 4Over 15: \( \tfrac{192 + 80-6-10}{15} = \tfrac{256}{15} \).

The square root of a linear expression is the usual reason for such a substitution: it turns \( \sqrt{x-1} \) into a plain power of \( u \).

Exam tipShow the line that converts \( dx \) and the new limits; in a “show that” question it carries the method marks. On Cambridge, use the substitution you are given even if you see a quicker way. IB AA SL (5.10) expects integration by inspection, or substitution of the form \( \int f(g(x))\,g'(x)\,dx \); HL (5.16) adds general substitutions. AP (topic 6.9) expects you to choose \( u \), and multiple-choice questions often ask only for the transformed integral, so read the options before you integrate.

Integration by inspection

Two patterns come up so often that you should recognise them and write the answer straight down. Each is the substitution \( u = f(x) \) done in your head.

\[ \int \frac{f'(x)}{f(x)}\,dx = \ln|f(x)| + C \]
\[ \int f'(x)\big[f(x)\big]^n\,dx = \frac{\big[f(x)\big]^{n+1}}{n+1} + C \quad (n \neq -1) \]

The first holds because \( \frac{d}{dx}\ln|f(x)| = \frac{f'(x)}{f(x)} \) by the chain rule. The modulus is there because the logarithm needs a positive input while \( f(x) \) might be negative; you can drop it when \( f(x) \) is always positive, as with \( x^2 + 9 \). Cambridge 9709 lists the first pattern as \( \int \frac{kf'(x)}{f(x)}\,dx \): a constant multiple of the derivative on top is fine.

Worked example

Find (a) \( \int \dfrac{6x-4}{3x^2-4x + 5}\,dx \), (b) \( \int \dfrac{x}{x^2 + 9}\,dx \), (c) \( \int \sin x\cos^4 x\,dx \), and evaluate (d) \( \displaystyle\int_0^1 \frac{e^x}{e^x + 3}\,dx \).

Step 1(a) The derivative of the bottom is \( 6x-4 \), exactly the top. The bottom has discriminant \( 16-60 < 0 \), so it is always positive: \( \ln(3x^2-4x + 5) + C \).
Step 2(b) The derivative of \( x^2 + 9 \) is \( 2x \); the top is half of that: \( \tfrac12\ln(x^2 + 9) + C \).
Step 3(c) \( \cos^4 x = (\cos x)^4 \), and the derivative of \( \cos x \) is \( -\sin x \). So the integrand is \( -f'(x)[f(x)]^4 \) and the answer is \( -\tfrac15\cos^5 x + C \).
Step 4(d) \( \Big[\ln(e^x + 3)\Big]_0^1 = \ln(e + 3)-\ln 4 = \ln\dfrac{e + 3}{4} \).

Always differentiate your answer mentally. It catches nearly every wrong constant, and IB SL questions on 5.10 are designed to be done this way.

Common mistakeReaching for a logarithm when the top is not the derivative of the bottom. \( \int \dfrac{1}{x^2 + 1}\,dx \) is not \( \ln(x^2 + 1) \): differentiate that and you get \( \dfrac{2x}{x^2 + 1} \). The pattern needs \( f'(x) \) on top, up to a constant multiple. That integral is \( \tan^{-1} x + C \), as the last section shows.

An economics example: consumer surplus under a curved demand curve. Demand for a product is \( P = \dfrac{100}{Q + 1} \), with \( P \) in dollars and \( Q \) in thousands of units, and the market price is $20. Then \( 20 = \frac{100}{Q + 1} \) gives \( Q^* = 4 \). Consumer surplus is the area between the demand curve and the price line (Figure 2), and the integrand has the \( \frac{f’}{f} \) shape:

\[ CS = \int_0^4 \left(\frac{100}{Q + 1}-20\right)dQ \]

which is \( \Big[100\ln(Q + 1)-20Q\Big]_0^4 = 100\ln 5-80 \approx 80.94 \). With \( Q \) in thousands, buyers gain about $80,900 in total. A straight line through the same two points would give a different answer; the shape of the curve matters, which is why we integrate.

Consumer surplus under P = 100/(Q + 1)
demand P = 100/(Q + 1)
12345678204060801000Q (thousand units)P ($)(4, 20)CS ≈ 80.9P* = 20
Figure 2. Consumer surplus is the area between the demand curve and the price line from Q = 0 to Q* = 4: 100 ln 5 − 80 ≈ 80.9 thousand dollars.

Integrals using trigonometric identities

No rule integrates \( \sin^2 x \) directly, and the tempting answer \( \tfrac13\sin^3 x \) is wrong: its derivative is \( \sin^2 x\cos x \). The fix is to rewrite the square with the double angle formulae from Step 8, so that what is left is something you can integrate.

RewriteThen integrate
\( \sin^2 x = \tfrac12(1-\cos 2x) \)\( \int \sin^2 x\,dx = \tfrac12x-\tfrac14\sin 2x + C \)
\( \cos^2 x = \tfrac12(1 + \cos 2x) \)\( \int \cos^2 x\,dx = \tfrac12x + \tfrac14\sin 2x + C \)
\( \tan^2 x = \sec^2 x-1 \)\( \int \tan^2 x\,dx = \tan x-x + C \)
\( \sin x\cos x = \tfrac12\sin 2x \)\( \int \sin x\cos x\,dx = -\tfrac14\cos 2x + C \)

The first two come from \( \cos 2x = 1-2\sin^2 x = 2\cos^2 x-1 \), solved for the square. The third comes from dividing \( \sin^2 x + \cos^2 x = 1 \) by \( \cos^2 x \). With a different angle, replace \( x \) throughout: \( \sin^2 3x = \tfrac12(1-\cos 6x) \).

Worked example

Find the exact values of (a) \( \int_0^{\pi/2} \cos^2 x\,dx \) and (b) \( \int_0^{\pi/3} \tan^2 x\,dx \), and find (c) \( \int \sin^2 3x\,dx \).

Step 1(a) \( \Big[\tfrac12x + \tfrac14\sin 2x\Big]_0^{\pi/2} = \tfrac{\pi}{4} + \tfrac14\sin\pi-0 = \tfrac{\pi}{4} \).
Step 2(b) \( \Big[\tan x-x\Big]_0^{\pi/3} = \sqrt3-\tfrac{\pi}{3} \).
Step 3(c) \( \int \tfrac12(1-\cos 6x)\,dx = \tfrac12x-\tfrac{1}{12}\sin 6x + C \).

In (c) the \( \tfrac{1}{12} \) is \( \tfrac12 \times \tfrac16 \): one half from the identity and one sixth from integrating \( \cos 6x \).

Notice what part (a) says about the shape of \( \cos^2 x \). Over a quarter turn its area is \( \tfrac{\pi}{4} \), exactly half the area of the rectangle of height 1 on \( [0, \tfrac{\pi}{2}] \). That is no accident: \( \cos^2 x \) is a wave of half the height and twice the frequency, sitting on the line \( y = \tfrac12 \), and the wave part integrates to zero over any whole number of its cycles. The same reasoning gives \( \int_0^{\pi} \sin^2 x\,dx = \tfrac{\pi}{2} \) in one line, and it is why physicists say the average of \( \sin^2 \) over a cycle is one half. When an exam asks for an exact value of a trigonometric integral, a quick sketch like this is a good check that your answer is the right size.

Integrals that give tan⁻¹ and sin⁻¹

Step 14 found \( \frac{d}{dx}\tan^{-1} x = \frac{1}{1 + x^2} \) and \( \frac{d}{dx}\sin^{-1} x = \frac{1}{\sqrt{1-x^2}} \). Read backwards, with a constant \( a > 0 \), these give two families:

\[ \int \frac{1}{x^2 + a^2}\,dx = \frac1a\tan^{-1}\left(\frac{x}{a}\right) + C \]
\[ \int \frac{1}{\sqrt{a^2-x^2}}\,dx = \sin^{-1}\left(\frac{x}{a}\right) + C \quad (|x| < a) \]

Differentiate \( \tan^{-1}(x/a) \) by the chain rule and you get \( \frac{a}{x^2 + a^2} \), which is \( a \) times too big; hence the \( \frac1a \). For \( \sin^{-1}(x/a) \) the \( \frac1a \) from the chain rule cancels against \( \sqrt{a^2} = a \), so no factor appears.

Worked example

Find (a) the exact value of \( \int_0^2 \dfrac{1}{x^2 + 4}\,dx \), (b) \( \int \dfrac{1}{x^2 + 6x + 13}\,dx \) and (c) the exact value of \( \int_0^{3/2} \dfrac{1}{\sqrt{9-x^2}}\,dx \).

Step 1(a) \( a = 2 \): \( \Big[\tfrac12\tan^{-1}\tfrac{x}{2}\Big]_0^2 = \tfrac12\tan^{-1} 1 = \tfrac12 \cdot \tfrac{\pi}{4} = \tfrac{\pi}{8} \).
Step 2(b) Complete the square: \( x^2 + 6x + 13 = (x + 3)^2 + 4 \). With \( u = x + 3 \) and \( a = 2 \), the answer is \( \tfrac12\tan^{-1}\left(\tfrac{x + 3}{2}\right) + C \).
Step 3(c) \( a = 3 \): \( \Big[\sin^{-1}\tfrac{x}{3}\Big]_0^{3/2} = \sin^{-1}\tfrac12 = \tfrac{\pi}{6} \).

Inverse trigonometric answers are in radians, so exact values involve \( \pi \). Completing the square, as in (b), is AP topic 6.10.

Exam tipSyllabuses differ here. Cambridge 9709 Paper 3 needs only the \( \tan^{-1} \) form, \( \int \frac{1}{x^2 + a^2}\,dx \); \( \sin^{-1} \) is not required. IB AA HL (5.15) needs both. AP expects both, often after completing the square. When the numerator has an \( x \) in it, such as \( \frac{x + 3}{x^2 + 9} \), split it into \( \frac{x}{x^2 + 9} \) (a logarithm) plus \( \frac{3}{x^2 + 9} \) (an inverse tangent).

Practise: 6 questions

Try each one on paper first, then check the worked answer.

EasyQ1. Find \( \int 4x(x^2-3)^5\,dx \). Show worked answer
Let \( u = x^2-3 \), so \( du = 2x\,dx \) and \( 4x\,dx = 2\,du \).
\( \int 2u^5\,du = \tfrac13u^6 + C \).
Answer: \( \tfrac13(x^2-3)^6 + C \).
EasyQ2. Find \( \int \dfrac{3x^2}{x^3 + 1}\,dx \). Show worked answer
The numerator \( 3x^2 \) is exactly the derivative of \( x^3 + 1 \).
So the integral is \( \ln|x^3 + 1| + C \).
MediumQ3. Evaluate \( \int_0^1 x e^{x^2}\,dx \) exactly. Show worked answer
Let \( u = x^2 \), so \( x\,dx = \tfrac12\,du \); limits \( u = 0 \) to \( u = 1 \).
\( \tfrac12\int_0^1 e^u\,du = \tfrac12\Big[e^u\Big]_0^1 \).
\( = \tfrac12(e-1) \).
MediumQ4. Find the exact value of \( \int_0^{\pi/8} \cos^2 2x\,dx \). Show worked answer
\( \cos^2 2x = \tfrac12(1 + \cos 4x) \).
\( \int_0^{\pi/8} \tfrac12(1 + \cos 4x)\,dx = \Big[\tfrac12x + \tfrac18\sin 4x\Big]_0^{\pi/8} \).
\( = \tfrac{\pi}{16} + \tfrac18\sin\tfrac{\pi}{2} = \tfrac{\pi}{16} + \tfrac18 \).
MediumQ5. Find \( \int \dfrac{x + 3}{x^2 + 9}\,dx \). Show worked answer
Split: \( \int \dfrac{x}{x^2 + 9}\,dx + \int \dfrac{3}{x^2 + 9}\,dx \).
First part: \( \tfrac12\ln(x^2 + 9) \) (top is half the derivative of the bottom).
Second part: \( 3 \times \tfrac13\tan^{-1}\tfrac{x}{3} = \tan^{-1}\tfrac{x}{3} \).
Answer: \( \tfrac12\ln(x^2 + 9) + \tan^{-1}\left(\tfrac{x}{3}\right) + C \). No modulus is needed, since \( x^2 + 9 > 0 \).
ExamQ6. (a) Using the substitution \( u = e^x \), show that \( \displaystyle\int_0^{\frac12\ln 3} \frac{e^x}{1 + e^{2x}}\,dx = \int_1^{\sqrt3} \frac{1}{1 + u^2}\,du \). [3] (b) Hence find the exact value of the integral. [2] Show worked answer
(a) \( u = e^x \Rightarrow du = e^x\,dx \), and \( e^{2x} = u^2 \). [M1]
So \( \dfrac{e^x}{1 + e^{2x}}\,dx = \dfrac{1}{1 + u^2}\,du \). [A1]
Limits: \( x = 0 \Rightarrow u = 1 \); \( x = \tfrac12\ln 3 \Rightarrow u = e^{\frac12\ln 3} = \sqrt3 \). [B1]
(b) \( \Big[\tan^{-1} u\Big]_1^{\sqrt3} = \tan^{-1}\sqrt3-\tan^{-1} 1 \). [M1]
\( = \tfrac{\pi}{3}-\tfrac{\pi}{4} = \tfrac{\pi}{12} \). [A1]
Total: 5 marks.

Check yourself

1. With \( u = x^2 + 4 \), what does \( \int_0^2 x(x^2 + 4)^3\,dx \) become?

\( du = 2x\,dx \), so \( x\,dx = \tfrac12\,du \), and the limits become \( u = 0 + 4 = 4 \) and \( u = 4 + 4 = 8 \).

2. Which is \( \int \dfrac{1}{x^2 + 25}\,dx \)?

With \( a = 5 \), \( \int \frac{1}{x^2 + a^2}\,dx = \frac1a\tan^{-1}\frac{x}{a} + C \). The logarithm would need \( 2x \) on top.

3. Which is \( \int \cos^2 x\,dx \)?

\( \cos^2 x = \tfrac12(1 + \cos 2x) \). The minus sign belongs to \( \sin^2 x \), and \( \tfrac13\cos^3 x \) differentiates to \( -\cos^2 x\sin x \).

Your score: 0 out of 3

The short version

  • Substitution reverses the chain rule: \( u = g(x) \), \( du = g'(x)\,dx \). Convert the integrand, the \( dx \) and the limits.
  • With a given substitution (Cambridge P3), make \( x \) the subject and replace every \( x \).
  • By inspection: \( \int \frac{f’}{f}\,dx = \ln|f| + C \) and \( \int f’ f^n\,dx = \frac{f^{n+1}}{n+1} + C \). Check by differentiating.
  • \( \sin^2 x = \tfrac12(1-\cos 2x) \), \( \cos^2 x = \tfrac12(1 + \cos 2x) \), \( \tan^2 x = \sec^2 x-1 \).
  • \( \int \frac{dx}{x^2 + a^2} = \frac1a\tan^{-1}\frac{x}{a} + C \) and \( \int \frac{dx}{\sqrt{a^2-x^2}} = \sin^{-1}\frac{x}{a} + C \); complete the square first if needed.
  • The full chapter in Mathematics Made Simple has many more worked examples and a full set of practice questions with a complete answer key.

Further reading on EconTutorials

Related in-depth articles from our blog:

Want more questions like these, with worked answers?
The practice book has hundreds more, graded from easy to exam level.
Next: step 23 of 33Integration by Parts and Partial Fractions