Integration Techniques
Foundation refresher - u-substitution, partial fractions, and integration by parts
Undoing the Chain Rule
We know how to differentiate $e^{x^2}$ - the chain rule gives $2x\,e^{x^2}$. But what if someone hands us $\int 2x\,e^{x^2}\,dx$ and asks us to go backward?
The chain rule says $\frac{d}{dx}F(g(x)) = f(g(x))\,g'(x)$ where $F' = f$. Reading that equation from right to left is the key insight: if we spot a composite function multiplied by the derivative of the inner piece, we can integrate the whole thing at once.
In practice, we make this mechanical with a substitution: set $u = g(x)$, compute $du = g'(x)\,dx$, rewrite everything in terms of $u$, integrate, then substitute back.
$\displaystyle\int 2x\,e^{x^2}\,dx$
Set $u = x^2$, so $du = 2x\,dx$. The integral becomes $\int e^u\,du = e^u + C = e^{x^2} + C$.
Check: $\frac{d}{dx}e^{x^2} = 2x\,e^{x^2}$. It works.
That first example was almost too clean - the $g'(x)$ factor was sitting right there in the integrand. Real problems are rarely so polite. The trick is learning to spot the inner function even when the derivative factor is partially hidden.
$\displaystyle\int\frac{x\,dx}{(1+x^2)^2}$
Set $u = 1 + x^2$, so $du = 2x\,dx$, which means $x\,dx = \frac{1}{2}\,du$. The integral becomes
$$\frac{1}{2}\int u^{-2}\,du = \frac{1}{2}\cdot\frac{u^{-1}}{-1} + C = -\frac{1}{2(1+x^2)} + C$$
$\displaystyle\int x^2\sqrt{1+x^3}\,dx$
Set $u = 1 + x^3$, so $du = 3x^2\,dx$, which means $x^2\,dx = \frac{1}{3}\,du$. The integral becomes
$$\frac{1}{3}\int u^{1/2}\,du = \frac{1}{3}\cdot\frac{2}{3}u^{3/2} + C = \frac{2}{9}(1+x^3)^{3/2} + C$$
Common trap: forgetting to adjust the $dx$. If $u = x^2$, then $du = 2x\,dx$, not $x\,dx$. Missing that constant factor is the #1 substitution error. Always write out $du = \ldots$ explicitly before rewriting the integral.
The visualization below shows what substitution looks like geometrically. On the left we see the original integrand $\frac{x}{(1+x^2)^2}$ as a function of $x$. On the right, after substituting $u = 1 + x^2$, we see the simpler function $\frac{1}{2u^2}$. Drag the slider to change the upper limit - the shaded areas always represent the same quantity.
Breaking Apart Fractions
Adding $\frac{1}{3} + \frac{1}{5}$ is easy - common denominator gives $\frac{8}{15}$. What about going backward? Given $\frac{8}{15}$, can we recover $\frac{1}{3} + \frac{1}{5}$?
That's the idea behind partial fractions. We take a complicated rational function and decompose it into simpler pieces that we already know how to integrate. The algebra runs "in reverse" compared to adding fractions.
Distinct linear factors. When the denominator factors into distinct linear terms, each gets its own constant numerator:
$\displaystyle\int\frac{dx}{(x-1)(x+2)}$
We write $\frac{1}{(x-1)(x+2)} = \frac{A}{x-1} + \frac{B}{x+2}$.
Cover-up method: To find $A$, cover up $(x-1)$ in the original fraction and set $x = 1$: $A = \frac{1}{1+2} = \frac{1}{3}$. To find $B$, cover up $(x+2)$ and set $x = -2$: $B = \frac{1}{-2-1} = -\frac{1}{3}$.
So the integral becomes $$\frac{1}{3}\int\frac{dx}{x-1} - \frac{1}{3}\int\frac{dx}{x+2} = \frac{1}{3}\ln\left|\frac{x-1}{x+2}\right| + C$$
Irreducible quadratic factors. When the denominator includes a quadratic that doesn't factor over the reals (like $x^2 + 4$), the numerator for that term must be $Ax + B$, not just a constant:
$\displaystyle\frac{2x+1}{(x^2+4)(x-1)} = \frac{Ax+B}{x^2+4} + \frac{C}{x-1}$
Multiply through by $(x^2+4)(x-1)$: $$2x + 1 = (Ax+B)(x-1) + C(x^2+4)$$
Set $x = 1$: $\;3 = 0 + 5C$, so $C = \frac{3}{5}$.
Compare $x^2$ coefficients: $0 = A + C$, so $A = -\frac{3}{5}$.
Compare constant terms: $1 = -B + 4C = -B + \frac{12}{5}$, so $B = \frac{7}{5}$.
The decomposition is $$\frac{-\frac{3}{5}x + \frac{7}{5}}{x^2+4} + \frac{\frac{3}{5}}{x-1}$$
Each piece integrates with standard forms: the first splits into an $\arctan$ term and a $\ln$ term, the second is a plain logarithm.
Common trap: for irreducible quadratics like $x^2 + 4$, the numerator must be $Ax + B$, not just $A$. Using only a constant is the most common partial fractions mistake - it leaves you with an inconsistent system of equations and no solution.
The plot below shows the magic of partial fractions visually. The solid curve is the original rational function. The dashed curves are the individual partial fraction pieces. Notice how the pieces add up to reproduce the original at every point.
Undoing the Product Rule
U-substitution came from reading the chain rule backward. What happens if we read the product rule backward?
Differentiating $u(x)\,v(x)$ gives $(uv)' = u'v + uv'$. Integrating both sides over $[a,b]$ and rearranging:
That's integration by parts. The whole identity is just the product rule spelled sideways - a boundary term minus the integral with the roles of "thing to differentiate" and "thing to integrate" swapped.
Why would we ever want to swap? Because sometimes $\int v\,du$ is much easier than $\int u\,dv$. The technique is worth trying whenever the integrand is a product where one factor gets simpler when differentiated (like a polynomial or $\ln x$) and the other is easy to integrate (like $e^x$, $\sin x$, or just $dx$).
A rough rule of thumb (LIATE) picks $u$ in this priority order: Logarithmic, Inverse trig, Algebraic, Trig, Exponential. It's a heuristic, not a law - but it's right surprisingly often.
$\displaystyle\int \ln x\,dx$
There's only one factor - or is there? Write it as $\ln x \cdot 1\,dx$. Then $u = \ln x$ (differentiates to $1/x$, which is simpler) and $dv = dx$ (integrates to $v = x$).
$du = \frac{1}{x}\,dx$, so $$\int \ln x\,dx \;=\; x\ln x \;-\; \int x\cdot\tfrac{1}{x}\,dx \;=\; x\ln x - x + C.$$
Check by differentiating: $\frac{d}{dx}(x\ln x - x) = \ln x + 1 - 1 = \ln x$. It works.
$\displaystyle\int x\,e^x\,dx$
LIATE says pick $u = x$ (Algebraic) and $dv = e^x\,dx$ (Exponential). Then $du = dx$ and $v = e^x$.
$$\int x\,e^x\,dx \;=\; x\,e^x - \int e^x\,dx \;=\; x\,e^x - e^x + C \;=\; (x-1)e^x + C.$$
The polynomial lost a power - exactly what we wanted. If we'd picked $u = e^x$ instead, $du = e^x\,dx$ wouldn't simplify at all and the new integral would be worse than the one we started with.
$\displaystyle\int x^2\sin x\,dx$
Pick $u = x^2$, $dv = \sin x\,dx$. Then $du = 2x\,dx$ and $v = -\cos x$: $$\int x^2\sin x\,dx \;=\; -x^2\cos x + \int 2x\cos x\,dx.$$
The new integral $\int 2x\cos x\,dx$ is still a polynomial-times-trig - just with the polynomial one degree lower. Apply parts again: $u = 2x$, $dv = \cos x\,dx$, so $du = 2\,dx$, $v = \sin x$: $$\int 2x\cos x\,dx \;=\; 2x\sin x - \int 2\sin x\,dx \;=\; 2x\sin x + 2\cos x + C.$$
Stitching it together: $$\int x^2\sin x\,dx \;=\; -x^2\cos x + 2x\sin x + 2\cos x + C.$$
A degree-$n$ polynomial times $\sin x$ or $e^x$ will always yield to $n$ applications of parts - each pass kills one power.
Common trap - the cyclic case. When the integrand is $e^{ax}\sin(bx)$ or $e^{ax}\cos(bx)$, differentiating and integrating either factor just cycles through sines and cosines. After two passes of parts, the original integral reappears on the right-hand side. Don't panic - this is the trick. Move it to the left and solve algebraically:
$\displaystyle I = \int e^x\sin x\,dx$
First pass: $u = \sin x$, $dv = e^x\,dx$ gives $I = e^x\sin x - \int e^x\cos x\,dx$.
Second pass on that remaining integral: $u = \cos x$, $dv = e^x\,dx$ gives $\int e^x\cos x\,dx = e^x\cos x + \int e^x\sin x\,dx = e^x\cos x + I$.
Substituting back: $I = e^x\sin x - e^x\cos x - I$, so $2I = e^x(\sin x - \cos x)$, giving $$I = \tfrac{1}{2}e^x(\sin x - \cos x) + C.$$
The trap is flipping your choice of $u$ on the second pass. If you picked the exponential for $u$ the first time and the trig the second time, you undo your own work and get $I = I$ - a true but useless identity. Stay consistent.
The geometry. There's a beautiful picture hiding in the formula. Take $u = x$, $v = f(x)$ on an interval where $f$ is increasing. Then $\int_a^b x\,f'(x)\,dx = \bigl[x\,f(x)\bigr]_a^b - \int_a^b f(x)\,dx$. Rearranged: the rectangle $bf(b) - af(a)$ is split into two pieces - the area under $f$ (the green region, $\int f\,dx$) plus the area to the left of $f$ (the blue region, $\int x\,f'\,dx = \int x\,dy$). Drag the slider to move the right endpoint and watch the two pieces add up to the full rectangle.