Integration by Substitution and by Parts

Published on 2026-11-04·v1.0

Learning Objectives

  • Derive substitution from the chain rule and parts from the product rule, and state the hypotheses each one needs.
  • Evaluate definite integrals by substitution, converting the limits to the new variable and never returning to the old one.
  • Recognize an invalid substitution (a change of variable that is undefined or non-continuous inside the interval) and a dropped absolute value after a square root.
  • Choose uu and dvdv for integration by parts, and handle repeated and cyclic applications.
  • Use ∫ln⁡x dx\int\ln x\,dx to bound a sum of logarithms, the calculus behind log⁡(n!)=Θ(nlog⁡n)\log(n!)=\Theta(n\log n).

Context & Motivation

the-fundamental-theorem-of-calculus reduced a definite integral to finding an antiderivative, but gave no method for finding one. Differentiation has a rule for every composition and product; integration has no rule of the same completeness. What it has instead are two techniques that each run a differentiation rule backwards. Substitution undoes the chain rule and integration by parts undoes the product rule. Between them they handle most integrals met in practice.

The techniques also matter where no closed-form integral is the goal. Bounding ln⁡(n!)\ln(n!), the heart of the Ω(nlog⁡n)\Omega(n\log n) lower bound for comparison sorting, gives sharp bounds via ∫ln⁡x dx\int\ln x\,dx, a natural job for parts.

Core Theory

Substitution: the chain rule backwards

If F′=fF'=f, the chain rule gives ddxF(g(x))=f(g(x)) g′(x)\frac{d}{dx}F(g(x)) = f(g(x))\,g'(x). Reading that right to left:

∫f(g(x)) g′(x) dx=F(g(x))+C\int f(g(x))\,g'(x)\,dx = F(g(x)) + C

The shorthand is u=g(x)u=g(x), du=g′(x) dxdu = g'(x)\,dx, turning the integral into ∫f(u) du\int f(u)\,du. The method works when the integrand contains an inner function together with (a constant multiple of) its derivative.

Theorem (definite form). Let gg have a continuous derivative on [a,b][a,b] and let ff be continuous on an interval containing g([a,b])g([a,b]). Then

∫abf(g(x)) g′(x) dx=∫g(a)g(b)f(u) du\int_a^b f(g(x))\,g'(x)\,dx = \int_{g(a)}^{g(b)} f(u)\,du

The proof is Part 2 of the FTC on both sides: each equals F(g(b))−F(g(a))F(g(b))-F(g(a)). Three consequences. The new limits are g(a)g(a) and g(b)g(b), not aa and bb. They may come out reversed (g(a)>g(b)g(a)>g(b)) or equal. And gg does not have to be one-to-one or monotone. Once the limits are converted, the answer is computed entirely in uu; substituting back to xx is unnecessary, and mixing the two is the classic error.

Substitution in the other direction

Trigonometric substitution writes x=φ(θ)x=\varphi(\theta) and uses ∫abf(x) dx=∫αβf(φ(θ)) φ′(θ) dθ\int_a^b f(x)\,dx = \int_\alpha^\beta f(\varphi(\theta))\,\varphi'(\theta)\,d\theta with φ(α)=a\varphi(\alpha)=a, φ(β)=b\varphi(\beta)=b. The hypotheses are now strict: φ′\varphi' continuous on [α,β][\alpha,\beta] and φ\varphi staying inside the domain of ff on the whole way from α\alpha to β\beta. Two things go wrong in practice. First, cos⁡2θ=∣cos⁡θ∣\sqrt{\cos^2\theta}=\lvert\cos\theta\rvert, which equals cos⁡θ\cos\theta only where cos⁡θ≥0\cos\theta\ge0, so the range chosen for θ\theta must be stated. Second, φ\varphi may be undefined at some point between the endpoints (Example 4).

Integration by parts: the product rule backwards

From (uv)′=u′v+uv′(uv)'=u'v+uv', integrating gives

∫u v′ dx=uv−∫u′ v dx,∫abu v′ dx=[uv]ab−∫abu′ v dx\int u\,v'\,dx = uv - \int u'\,v\,dx, \qquad \int_a^b u\,v'\,dx = \big[uv\big]_a^b - \int_a^b u'\,v\,dx

The definite form needs uu and vv to have continuous derivatives on [a,b][a,b]. The point is to trade ∫uv′\int uv' for an easier ∫u′v\int u'v. Pick uu to be the factor that gets simpler on differentiation (ln⁡x\ln x, arctan⁡x\arctan x, a polynomial) and v′v' the factor whose antiderivative is easy (exe^x, sin⁡x\sin x, cos⁡x\cos x, a power). The mnemonic LIATE (logarithmic, inverse trig, algebraic, trig, exponential, in order of preference for uu) encodes this; it is a heuristic, not a theorem. Three patterns recur: a polynomial times exe^x or sin⁡x\sin x needs one application per degree; a lone ln⁡x\ln x or arctan⁡x\arctan x uses v′=1v'=1; and exsin⁡xe^x\sin x returns to itself after two applications, so it is solved for algebraically.

Worked Examples

Example 1: a standard substitution

∫02xx2+1 dx\int_0^2 \frac{x}{x^2+1}\,dx. Let u=x2+1u=x^2+1, so du=2x dxdu=2x\,dx and x dx=12dux\,dx=\tfrac12du. When x=0x=0, u=1u=1; when x=2x=2, u=5u=5.

∫02xx2+1 dx=12∫15duu=12ln⁡5≈0.80472\int_0^2 \frac{x}{x^2+1}\,dx = \frac12\int_1^5\frac{du}{u} = \frac12\ln 5 \approx 0.80472

Symbolic evaluation and quadrature both give 0.8047189560.804718956. The ln⁡\ln is safe because u≥1>0u\ge1>0 on the whole path.

Example 2: the limits are the whole job

∫022xcos⁡(x2) dx\int_0^2 2x\cos(x^2)\,dx with u=x2u=x^2: the limits become 00 and 44, giving ∫04cos⁡u du=sin⁡4≈−0.7568\int_0^4\cos u\,du = \sin4 \approx -0.7568. Applying the old limits to the new antiderivative gives sin⁡2≈+0.9093\sin 2 \approx +0.9093, which has the wrong sign as well as the wrong size. A case where gg is not monotone: ∫0πcos⁡x sin⁡2x dx\int_0^\pi \cos x\,\sin^2x\,dx with u=sin⁡xu=\sin x has limits sin⁡0=0\sin0=0 and sin⁡π=0\sin\pi=0, so the integral is ∫00u2du=0\int_0^0u^2du=0. This is correct: sin⁡2xcos⁡x\sin^2 x\cos x is positive on [0,π/2][0,\pi/2] and the mirror-image negative on [π/2,π][\pi/2,\pi]. Compare ∫0π/2sin⁡2xcos⁡x dx=∫01u2du=13\int_0^{\pi/2}\sin^2x\cos x\,dx=\int_0^1u^2du=\tfrac13, where the same u=sin⁡xu=\sin x runs from 00 to 11 and the sign never changes.

Example 3: a trigonometric substitution

∫011−x2 dx\int_0^1\sqrt{1-x^2}\,dx is a quarter of the unit disk. Let x=sin⁡θx=\sin\theta, dx=cos⁡θ dθdx=\cos\theta\,d\theta, and θ\theta runs from 00 to π/2\pi/2. On that range cos⁡θ≥0\cos\theta\ge0, so 1−sin⁡2θ=cos⁡θ\sqrt{1-\sin^2\theta}=\cos\theta:

∫0π/2cos⁡2θ dθ=π4≈0.7854\int_0^{\pi/2}\cos^2\theta\,d\theta = \frac{\pi}{4}\approx0.7854

Matching the area of a quarter circle is a built-in check. The simplification 1−sin⁡2θ=cos⁡θ\sqrt{1-\sin^2\theta}=\cos\theta holds only where cos⁡θ≥0\cos\theta\ge0. Over [0,π][0,\pi] it breaks: ∫0π1−sin⁡2θ dθ=∫0π∣cos⁡θ∣ dθ=2\int_0^\pi\sqrt{1-\sin^2\theta}\,d\theta=\int_0^\pi\lvert\cos\theta\rvert\,d\theta=2, while ∫0πcos⁡θ dθ=0\int_0^\pi\cos\theta\,d\theta=0. That range would also be wrong for this substitution, since sin⁡θ\sin\theta rises to 11 and returns to 00 instead of tracing [0,1][0,1] once.

Example 4: a substitution that is not allowed

∫−11dx1+x2=2arctan⁡1=π2≈1.5708\int_{-1}^{1}\frac{dx}{1+x^2}=2\arctan1=\frac\pi2\approx1.5708. Try u=1/xu=1/x: dx=−du/u2dx=-du/u^2, and 11+x2=u2u2+1\frac{1}{1+x^2}=\frac{u^2}{u^2+1}, so the integrand becomes −du1+u2-\frac{du}{1+u^2}, with limits u=−1u=-1 to u=1u=1. The result would be −π2-\frac\pi2, a negative number for a positive integrand. The map x↦1/xx\mapsto1/x is undefined at x=0x=0, which lies inside [−1,1][-1,1], so the hypotheses fail. On [1,2][1,2] the same substitution is valid.

Example 5: parts, three ways

∫01xex dx\int_0^1 xe^x\,dx: u=xu=x, v′=exv'=e^x, so [xex]01−∫01ex dx=e−(e−1)=1[xe^x]_0^1-\int_0^1e^x\,dx = e-(e-1)=1.

∫1eln⁡x dx\int_1^e\ln x\,dx: u=ln⁡xu=\ln x, v′=1v'=1, so [xln⁡x]1e−∫1e1 dx=e−(e−1)=1[x\ln x]_1^e-\int_1^e1\,dx = e-(e-1)=1. This gives the antiderivative xln⁡x−xx\ln x-x.

∫01x2ex dx\int_0^1x^2e^x\,dx: two applications give [x2ex−2xex+2ex]01=e−2≈0.71828[x^2e^x-2xe^x+2e^x]_0^1 = e-2\approx0.71828. Each pass lowers the power of xx by one.

All three match symbolic and numerical evaluation.

Example 6: a cyclic integral

Let I=∫exsin⁡x dxI=\int e^x\sin x\,dx. With u=sin⁡xu=\sin x, v′=exv'=e^x: I=exsin⁡x−∫excos⁡x dxI=e^x\sin x-\int e^x\cos x\,dx. Applying parts again with the same roles (u=cos⁡xu=\cos x): ∫excos⁡x dx=excos⁡x+I\int e^x\cos x\,dx = e^x\cos x+I. Therefore I=exsin⁡x−excos⁡x−II=e^x\sin x-e^x\cos x-I, so I=12ex(sin⁡x−cos⁡x)+CI=\tfrac12e^x(\sin x-\cos x)+C. On [0,π][0,\pi] the value is eπ+12≈12.0703\frac{e^\pi+1}{2}\approx12.0703, confirmed numerically. Swapping the roles on the second pass would undo the first and return 0=00=0.

Example 7: bounding ln⁡(n!)\ln(n!)

Since ln⁡x\ln x is increasing, each term satisfies ∫k−1kln⁡x dx≤ln⁡k≤∫kk+1ln⁡x dx\int_{k-1}^{k}\ln x\,dx\le\ln k\le\int_k^{k+1}\ln x\,dx. Summing k=2,…,nk=2,\dots,n and using ∫ln⁡x dx=xln⁡x−x\int\ln x\,dx = x\ln x-x:

nln⁡n−n+1 ≤ ln⁡(n!) ≤ (n+1)ln⁡(n+1)−(n+1)−2ln⁡2+2n\ln n-n+1\ \le\ \ln(n!)\ \le\ (n+1)\ln(n+1)-(n+1)-2\ln2+2
n lower bound ln(n!) upper bound
10 14.026 15.104 15.991
100 361.52 363.74 365.74
1000 5908.76 5912.13 5915.28

So ln⁡(n!)=Θ(nln⁡n)\ln(n!)=\Theta(n\ln n). A comparison sort must tell n!n! possible orderings apart using yes/no answers, so it needs at least log⁡2(n!)=ln⁡(n!)/ln⁡2\log_2(n!)=\ln(n!)/\ln2 comparisons in the worst case, which is Θ(nlog⁡n)\Theta(n\log n).

Common Misconceptions & Pitfalls

  • Keeping the old limits after substituting. The limits belong to the variable. After u=g(x)u=g(x) they are g(a)g(a) and g(b)g(b) (Example 2).
  • Mixing variables. An integral with both xx and uu in the integrand is not finished. Express the whole integrand in one variable, or the change of variable has not happened.
  • Substituting across a singularity. u=1/xu=1/x or u=tan⁡xu=\tan x on an interval containing a point where the map blows up is invalid (Example 4). Check that the map is defined and continuous along the whole path.
  • Dropping the absolute value. u2=∣u∣\sqrt{u^2}=\lvert u\rvert. State the range of the angle in a trig substitution.
  • Expecting an antiderivative to exist in closed form. Every continuous function has one (the accumulation function), but e−x2e^{-x^2} and sin⁡xx\frac{\sin x}{x} have none among elementary functions, and no technique here will produce one.
  • Parts that go in circles. If the new integral is harder, swap the roles. In cyclic problems keep the same roles on both passes.
  • Constants differ. ∫sin⁡xcos⁡x dx\int\sin x\cos x\,dx is 12sin⁡2x\frac12\sin^2x by u=sin⁡xu=\sin x and −12cos⁡2x-\frac12\cos^2x by u=cos⁡xu=\cos x. Both are right: they differ by the constant 12\frac12.

Summary

Substitution is the chain rule run backwards: ∫abf(g(x))g′(x) dx=∫g(a)g(b)f(u) du\int_a^b f(g(x))g'(x)\,dx=\int_{g(a)}^{g(b)}f(u)\,du when g′g' is continuous on [a,b][a,b] and ff is continuous on the range of gg, and the converted limits are part of the answer. In the other direction (trigonometric substitution) the map must also be defined and continuous across the interval, and a square root forces an absolute value unless the sign is known. Integration by parts is the product rule run backwards: ∫abuv′=[uv]ab−∫abu′v\int_a^b uv'=[uv]_a^b-\int_a^bu'v for continuously differentiable u,vu,v. Choose uu to simplify when differentiated, repeat for polynomial factors, use v′=1v'=1 for lone ln⁡\ln and arctan⁡\arctan, and solve algebraically when the integral reappears. The antiderivative of ln⁡x\ln x also bounds ln⁡(n!)\ln(n!), giving the Ω(nlog⁡n)\Omega(n\log n) lower bound for comparison sorting. The next lesson, applications-area-volume-and-average-value, puts these tools to work on geometry.

Documentation Links