13. Choosing a technique
Modules §4.5 through §4.11 handed you six tools: substitution, integration by parts, trigonometric integrals, trigonometric substitution, partial fractions, and (for when none of those close the deal) numerical integration. (§4.10's improper integrals sit inside that range but aren't one of the six — they answer a different question, whether an integral exists at all, rather than offering another way to evaluate one.) Each tool came with its own lesson and its own practice problems already sorted into the right bucket. Real integrals don't announce which bucket they belong to. This lesson is the sorting step — a decision process to run before reaching for any specific technique.
The decision order
Run these checks roughly in this order; the first one that fires is usually the right move.
1. Is it already a known form? Check §4.0's basic antiderivative table first. No technique needed if it's already there.
2. Is there an inner function whose derivative (up to a constant) is sitting in the integrand? That's substitution (§4.5) — by far the most common opening move, and the reason it's the first technique taught.
3. Is it a product of two structurally different things — a polynomial times an exponential, a polynomial times a trig function, an exponential times a trig function, or a lone \ln x or \arctan x? That's integration by parts (§4.6). The LIATE order from that lesson picks u.
4. Is it built from \sin and \cos (or \tan and \sec) raised to powers, with no algebraic denominator? That's §4.7's trigonometric integrals — check parities, peel an odd power or halve an even one.
5. Does it contain \sqrt{a^2-x^2}, \sqrt{a^2+x^2}, or \sqrt{x^2-a^2} — or an unfactored quadratic under a root or in a power? That's trigonometric substitution (§4.8), turning the root into a trig identity.
6. Is it a ratio of polynomials (rational function) that substitution can't crack directly? That's partial fractions (§4.9) — factor the denominator, split into simple pieces, integrate term by term.
7. Does nothing above apply, or does the antiderivative not exist in elementary terms (like e^{-x^2} or the elliptic integral from §4.11)? Fall back to numerical integration (§4.11), or recognize a special function like \text{erf}.
Why order matters
Several checks can look like they apply at once, and picking the wrong correct-looking one costs real work. \int xe^{x^2}dx satisfies check 2 (inner function x^2, derivative 2x present) — substitution finishes it in one line. But it also looks like check 3's polynomial-times-exponential pattern for integration by parts, which would spiral: differentiating x and integrating e^{x^2} is not possible in elementary terms, so by-parts is a dead end here despite the superficial match. Try substitution first, always — it's cheaper when it works, and it's the fastest way to rule itself out when it doesn't.
The reverse trap: \int xe^x dx has no derivative-of-inner-function relationship (x is not proportional to the derivative of anything useful here) — check 2 fails, so move to check 3. Polynomial times exponential, by parts, done in one step (this was \S4.6's worked example).
A worked sort
Four integrals, sorted by the checklist rather than solved:
\int\frac{1}{x^2-4}dx\qquad\int\sqrt{4-x^2}\,dx\qquad\int\sin^3x\cos x\,dx\qquad\int e^{-x^2}dx
- \dfrac1{x^2-4}: ratio of polynomials, denominator factors as (x-2)(x+2) — no inner-function match for substitution, no product for parts. Partial fractions.
- \sqrt{4-x^2}: the \sqrt{a^2-x^2} form by name. Trig substitution, x=2\sin\theta.
- \sin^3x\cos x: pure trig product, odd power present. Actually — check 2 first: the inner function \sin x has derivative \cos x, which is sitting right there. Substitution, u=\sin x, is faster than treating it as a trig-integral case, even though it would also fall under check 4.
- e^{-x^2}: no elementary antiderivative exists at all. Numerical / special function (\text{erf}).
That third example is the general truth: when two checks both seem to apply, the earlier (cheaper) one wins.
Doing it in Python
Sort by trying the cheap technique first and letting SymPy confirm:
import sympy as sp
x = sp.Symbol('x')
integrals = [
("x*e^(x^2)", x * sp.exp(x**2)),
("x*e^x", x * sp.exp(x)),
("1/(x^2-4)", 1 / (x**2 - 4)),
("sqrt(4-x^2)", sp.sqrt(4 - x**2)),
("sin^3(x)*cos(x)", sp.sin(x)**3 * sp.cos(x)),
("e^(-x^2)", sp.exp(-x**2)),
]
for name, f in integrals:
print(f"int {name:<18} = {sp.integrate(f, x)}")
The two exponential-times-x cases side by side, showing why one is one line of substitution and the other needs parts:
import sympy as sp
x, u = sp.symbols('x u')
print("int x e^(x^2) dx:")
print(f" inner function x^2, derivative 2x is present up to a constant")
print(f" u = x^2 -> (1/2) int e^u du = {sp.integrate(sp.exp(u), u) / 2}")
print(f" back-substituted: {(sp.integrate(sp.exp(u), u) / 2).subs(u, x**2)}\n")
print("int x e^x dx:")
print(f" no inner function whose derivative appears -- substitution stalls")
print(f" by parts, u=x dv=e^x dx -> {sp.integrate(x * sp.exp(x), x)}")
The checklist itself, as code: each check becomes one predicate, they run in order, and the first to fire is the recommendation. Watch the "also matched" column — it is the whole argument of this lesson made visible.
import sympy as sp
x, u = sp.symbols('x u')
def substitution_fires(expr):
"""Check 2: an inner g(x) whose derivative sits in the integrand as a factor."""
candidates = set()
for node in sp.preorder_traversal(expr):
if node.is_Atom or node == x or node.free_symbols != {x}:
continue
if node.is_Function:
candidates.add(node) # u = ln x, u = sin x
candidates.add(node.args[0]) # u = x^2, from inside exp(x^2)
elif node.is_Pow:
candidates.add(node.base)
for g in sorted(candidates, key=sp.count_ops): # try the simplest u first
if g == x or sp.diff(g, x).is_zero:
continue
rest = sp.cancel(sp.simplify(expr / sp.diff(g, x)))
if x not in sp.simplify(rest.subs(g, u)).free_symbols:
return f"u = {g}" # nothing but u survived -- substitution closes
return None
def parts_fires(expr):
"""Check 3: a product of two structurally different factors, or a lone log/arctan."""
if expr.func in (sp.log, sp.atan):
return "lone log/arctan"
if not expr.is_Mul:
return None
kinds = set()
for factor in expr.args:
if factor.is_polynomial(x):
kinds.add("poly")
elif factor.has(sp.exp):
kinds.add("exp")
elif factor.has(sp.sin, sp.cos, sp.tan):
kinds.add("trig")
elif factor.has(sp.log, sp.atan):
kinds.add("log")
return " x ".join(sorted(kinds)) if len(kinds) >= 2 else None
def trig_integral_fires(expr):
"""Check 4: a polynomial in sin/cos/tan, with no algebraic denominator."""
if not expr.has(sp.sin, sp.cos, sp.tan):
return None
return "powers of sin/cos" if expr.is_polynomial(sp.sin(x), sp.cos(x), sp.tan(x)) else None
def trig_sub_fires(expr):
"""Check 5: a square root of a quadratic."""
for node in sp.preorder_traversal(expr):
if node.is_Pow and node.exp.is_Rational and node.exp.q == 2:
if node.base.is_polynomial(x) and sp.degree(node.base, x) == 2:
return f"sqrt({node.base})"
return None
def partial_fractions_fires(expr):
"""Check 6: a ratio of polynomials whose denominator factors."""
num, den = sp.fraction(sp.together(expr))
if num.is_polynomial(x) and den.is_polynomial(x) and sp.degree(den, x) >= 1:
return f"denominator {sp.factor(den)}"
return None
CHECKS = [("2 substitution", substitution_fires),
("3 by parts", parts_fires),
("4 trig integral", trig_integral_fires),
("5 trig sub", trig_sub_fires),
("6 partial fractions", partial_fractions_fires)]
batch = [x * sp.exp(x**2), x * sp.exp(x), sp.log(x) / x, sp.sin(x)**3 * sp.cos(x),
1 / (x**2 - 4), sp.sqrt(4 - x**2), sp.exp(-x**2)]
for f in batch:
fired = [(name, why) for name, why in ((n, c(f)) for n, c in CHECKS) if why]
first = f"{fired[0][0]} ({fired[0][1]})" if fired else "none -- numerical / special function"
also = f" [also matched: {', '.join(n for n, _ in fired[1:])}]" if len(fired) > 1 else ""
print(f"{str(f):<20} -> check {first}{also}")
Two rows carry the lesson. xe^{x^2} matches check 3 as well as check 2, and \sin^3x\cos x matches check 4 as well as check 2 — in both cases the earlier, cheaper check is the one you want, and running them in order gets it right without any judgement call. Meanwhile xe^x, which looks like its neighbour, fails check 2 outright and correctly falls through to by parts.
Worked example
Classify, then evaluate, \displaystyle\int\frac{\ln x}{x}dx.
Check 2: is there an inner function whose derivative is present? \ln x has derivative \frac1x — and \frac1x is exactly the other factor. Substitution wins over integration by parts here, even though \ln x is LIATE's top priority for u in by-parts; check the cheaper technique first regardless of which technique's usual "favorite" function appears.
u=\ln x,\qquad du=\frac1x dx
\int\frac{\ln x}{x}dx=\int u\,du=\frac{u^2}{2}+C=\boxed{\frac{(\ln x)^2}{2}+C}
Sanity check. Differentiate back: $\frac{d}{dx}\frac{(\ln x)^2}{2}=\ln x\cdot\frac1x$ by the chain rule. ✓ One line, because the classification step caught the substitution match before by-parts was even tried.
Your turn
Classify each integral (name the technique — don't necessarily solve it), then solve the one marked with a star.
1. \displaystyle\int x^2e^{3x}\,dx
2. \displaystyle\int\frac{2x}{x^2+1}\,dx
3. \displaystyle\int\frac{1}{x^2+6x+5}\,dx ★
4. \displaystyle\int\sqrt{9-x^2}\,dx
Solutions
1. Polynomial times exponential, no derivative-of-inner match (x^2's derivative 2x isn't proportional to anything else present). Integration by parts, applied twice — each pass drops the polynomial's degree by one, so a degree-2 factor takes exactly two passes.
2. Inner function x^2+1, derivative 2x — present exactly. Substitution, u=x^2+1, done in one line: \ln|x^2+1|+C.
3. ★ Ratio of polynomials, denominator factors as (x+1)(x+5) — no substitution match, no product for parts. Partial fractions.
\frac{1}{(x+1)(x+5)}=\frac{A}{x+1}+\frac{B}{x+5}
1=A(x+5)+B(x+1)
x=-1: 1=4A\Rightarrow A=\frac14. x=-5: 1=-4B\Rightarrow B=-\frac14.
\int\frac{1}{x^2+6x+5}dx=\frac14\ln|x+1|-\frac14\ln|x+5|+C
4. The \sqrt{a^2-x^2} signature with a=3. Trig substitution, x=3\sin\theta — structurally identical to §4.8's worked example, just a different radius.
Check yourself in code
For each of the six integrals below, use SymPy to compute the antiderivative.
Print exactly this:
int x*e^(x^2) = exp(x**2)/2
int x*e^x = (x - 1)*exp(x)
int 1/(x^2-4) = log(x - 2)/4 - log(x + 2)/4
int sqrt(4-x^2) = x*sqrt(4 - x**2)/2 + 2*asin(x/2)
int sin^3(x)*cos(x) = sin(x)**4/4
int e^(-x^2) = sqrt(pi)*erf(x)/2
import sympy as sp
x = sp.Symbol('x')
integrals = [
("x*e^(x^2)", x * sp.exp(x**2)),
("x*e^x", x * sp.exp(x)),
("1/(x^2-4)", 1 / (x**2 - 4)),
("sqrt(4-x^2)", sp.sqrt(4 - x**2)),
("sin^3(x)*cos(x)", sp.sin(x)**3 * sp.cos(x)),
("e^(-x^2)", sp.exp(-x**2)),
]
for name, f in integrals:
print(f"int {name:<18} = ...")
import sympy as sp
x = sp.Symbol('x')
integrals = [
("x*e^(x^2)", x * sp.exp(x**2)),
("x*e^x", x * sp.exp(x)),
("1/(x^2-4)", 1 / (x**2 - 4)),
("sqrt(4-x^2)", sp.sqrt(4 - x**2)),
("sin^3(x)*cos(x)", sp.sin(x)**3 * sp.cos(x)),
("e^(-x^2)", sp.exp(-x**2)),
]
for name, f in integrals:
print(f"int {name:<18} = {sp.integrate(f, x)}")
Before reaching for a technique, run the checklist: known form, then substitution (an inner function's derivative present), then parts (a product of unlike functions), then trig integrals (pure powers of sine and cosine), then trig substitution (a root of a^2\pm x^2), then partial fractions (a rational function that resists the earlier steps), and only then numerical methods for what has no elementary antiderivative at all. When two checks both seem to fire, the cheaper, earlier one almost always wins — as \int xe^{x^2}dx showed against the tempting but dead-end by-parts route.
That closes integration technique by technique. Next: what all of this machinery actually computes for — areas, volumes, and the other geometric and physical quantities integrals were built to measure.