Differentiating is a routine: follow the rules and an answer comes out. Integrating is more like a puzzle, because you're hunting for a function whose derivative is the one in front of you. Two techniques turn most of the integrals physics hands you into ones you already know. Each is a rule for derivatives run backwards: substitution is the chain rule, and integration by parts is the product rule.
Substitution
The idea is to change the variable you're integrating over, so that an awkward area becomes an easy one. The picture shows what changing the variable does to an area.
- The hump is the graph of \(2x\,e^{-x^2}\) against \(x\). Watch it slide into the graph of \(e^{-u}\) against \(u\), where \(u = x^2\), and back. If it isn't moving, press "Change the variable".
- Watch the amber strip and the numbers under the picture. It gets wider and shorter, but width times height stays put.
- Drag the amber point to a strip near the left, then one near the right. With \(u = x^2\) the stretch is \(\frac{du}{dx} = 2x\), so strips further right are stretched more, and those left of \(x = \frac{1}{2}\) are squashed instead.
- Choose \(u = 2x\). Now every strip is stretched by exactly 2 and squashed to half its height.
- Choose \(u = \sin x\). Near the right-hand end \(\frac{du}{dx}\) is close to zero, and the strips are squeezed almost to nothing.
Each thin strip has width \(dx\) against \(x\) and width \(du\) against \(u\), and the two are tied together by the slope of \(u\):
So if the thing you're integrating contains some inside function \(u\), and also its derivative as a factor, the derivative and the \(dx\) together are just \(du\).
How to spot one: look for something inside a function, with the derivative of that something sitting outside. A missing constant doesn't matter, as the example shows.
Find this. The \(x^2\) is inside the exponential, and its derivative \(2x\) is nearly sitting outside.
So choose \(u\) to be the inside, and work out \(du\).
There's an \(x\,dx\) in the integral, not \(2x\,dx\). Half of \(du\) is exactly that.
Swap everything over. No \(x\) should be left. The integral of \(e^{-u}\) is \(-e^{-u}\), since differentiating that gives \(e^{-u}\) back.
Put \(x\) back.
Always check by differentiating. The chain rule gives \(-\frac{1}{2}\,e^{-x^2} \times (-2x) = x\,e^{-x^2}\), which is what you started with.
With limits, change them too and you never have to go back to \(x\). As \(x\) runs from 0 to 2, \(u = x^2\) runs from 0 to 4:
That's the "All of it" number under the picture.
When there's nothing to substitute
\(\int \sin^2 x\,dx\) has no derivative sitting outside, so substitution has nothing to work with. An identity rescues it. From the trig identities lesson, \(\sin^2 x = \frac{1}{2} - \frac{1}{2}\cos 2x\), and both of those pieces are easy:
Integration by parts
Substitution handles a function inside a function. Parts handles two different things multiplied together, like \(x\cos x\) or \(x\,e^{-x}\). It comes straight from the product rule's rectangle.
- The curve cuts the rectangle in two. The blue area under it is \(\int v\,du\): thin upright strips, each \(v\) tall and \(du\) wide. The amber area beside it is \(\int u\,dv\): thin level strips, each \(u\) long and \(dv\) thick.
- Drag the point, and check from the numbers under the picture that amber plus blue is always \(u \times v\).
- Watch the corner sweep along the curve, or press Sweep if it has stopped. As it moves, the rectangle grows by one upright strip and one level strip, the same two strips as in the product rule's picture.
- Choose \(\int \ln x\,dx\), then \(\int x\,e^{-x}\,dx\). For the last one, drag the point far to the right and watch the amber area close in on 1.
Start from the product rule.
Integrate both sides. On the left, integrating undoes the derivative.
That's the picture: the rectangle is the blue area plus the amber one. Move the blue one across.
It doesn't finish the job. It trades the integral you want for a different one, and the skill is in choosing \(u\) and \(dv\) so that the new one is easier. Pick as \(u\) the part that gets simpler when you differentiate it, such as \(x\) or \(\ln x\). Pick as \(dv\) a part you can integrate.
Find this. Differentiating \(x\) gives 1, which is simpler, so \(x\) is the one to call \(u\).
Name the parts. Differentiate \(u\), and integrate \(dv\).
Put them into \(uv - \int v\,du\).
The integral that's left is one you know.
Check by differentiating: the product rule gives \(\sin x + x\cos x\), then \(-\sin x\) from the cosine, leaving \(x\cos x\).
This is the first integral in the picture. From 0 to 1.2 it comes to \(1.2\sin 1.2 + \cos 1.2 - 1 \approx 0.481\). Drag the point to \(u = 1.20\) and the amber area agrees.
One detail about the third integral in the picture. With \(dv = e^{-x}\,dx\), the usual choice is \(v = -e^{-x}\). The picture uses \(v = 1 - e^{-x}\) instead. Both have the slope \(e^{-x}\), so either will do, and starting \(v\) at zero keeps both areas above the axis. The answer comes out the same.
These are the shapes physics hands you. \(x\,e^{-x^2}\) turns up whenever you average over the speeds of the molecules in a gas. \(\sin^2\) is the power in anything that oscillates. And \(x\,e^{-x}\) gives the average lifetime of something that decays at random, like a radioactive nucleus: the last problem below. In quantum mechanics, integration by parts is used on almost every page, to move a derivative off one function and on to another.
Problems
Find \(\int \cos 3x\,dx\).
Answer
Let \(u = 3x\), so \(du = 3\,dx\) and \(dx = \frac{1}{3}\,du\).
\(\int \cos u\,\frac{1}{3}\,du = \frac{1}{3}\sin u + C = \frac{1}{3}\sin 3x + C\)
Find \(\int_0^{\pi/2} \sin^2 x\cos x\,dx\). Check with the first picture.
Answer
Let \(u = \sin x\), so \(du = \cos x\,dx\). As \(x\) runs from 0 to \(\frac{\pi}{2}\), \(u\) runs from 0 to 1.
\(\int_0^1 u^2\,du = \left[\frac{u^3}{3}\right]_0^1 = \frac{1}{3}\)
Choose \(u = \sin x\) in the picture and "All of it" reads 0.333.
Find \(\int x\,e^x\,dx\).
Answer
By parts, with \(u = x\) and \(dv = e^x\,dx\), so \(du = dx\) and \(v = e^x\).
\(\int x\,e^x\,dx = x\,e^x - \int e^x\,dx = x\,e^x - e^x + C\)
Check: differentiating gives \(e^x + x\,e^x - e^x = x\,e^x\).
Find \(\int_1^e \ln x\,dx\). There's only one thing here, so let \(u = \ln x\) and \(dv = dx\).
Answer
\(du = \frac{1}{x}\,dx\), because the slope of \(\ln x\) is \(\frac{1}{x}\), and \(v = x\).
\(\int \ln x\,dx = x\ln x - \int x \cdot \frac{1}{x}\,dx = x\ln x - x + C\)
Between 1 and \(e\): \((e - e) - (0 - 1) = 1\).
Find \(\int_0^{\pi} \sin^2 x\,dx\). What is the average value of \(\sin^2 x\) over that stretch?
Answer
\(\left[\dfrac{x}{2} - \dfrac{\sin 2x}{4}\right]_0^{\pi} = \dfrac{\pi}{2} - 0 = \dfrac{\pi}{2} \approx 1.571\)
The average is the area divided by the width: \(\dfrac{\pi}{2} \div \pi = \dfrac{1}{2}\), as the trig identities lesson said it would be.
A radioactive nucleus has an average lifetime of \(\displaystyle\int_0^\infty \frac{t}{\tau}\,e^{-t/\tau}\,dt\), where \(\tau\) is a constant. Show that this is just \(\tau\). Use a substitution first, then parts. An upper limit of \(\infty\) means: integrate up to a large number \(b\), then see what the answer settles on as \(b\) grows.
Answer
Let \(s = \dfrac{t}{\tau}\), so \(t = \tau s\) and \(dt = \tau\,ds\). The limits stay 0 and \(\infty\), and the integral becomes \(\tau\displaystyle\int_0^\infty s\,e^{-s}\,ds\).
By parts with \(u = s\) and \(dv = e^{-s}\,ds\), so \(v = -e^{-s}\):
\(\displaystyle\int_0^\infty s\,e^{-s}\,ds = \Big[-s\,e^{-s}\Big]_0^\infty + \int_0^\infty e^{-s}\,ds = 0 + 1 = 1\)
The bracket is zero at both ends: at 0 because of the \(s\), and at \(\infty\) because \(e^{-s}\) shrinks far faster than \(s\) grows. So the average lifetime is \(\tau \times 1 = \tau\). This is the amber area closing in on 1 in the second picture.