Category Archives: Teaching

Some Cute Integrals — Integration By Parts — Part I

In the previous post, I gave some examples of \(u\)-substitution problems that required a little bit of algebraic manipulation. Those types of \(u\)-substitution problems can highlight some weaknesses in algebra and pre-Calculus. And what to do with weaknesses? Get rid of them!

\(u\)-substitution is an integration technique that is aimed at ‘undoing the chain rule’ — \([f(g(x))]^{\prime} = f'(g(x))g'(x)\) — by selecting \(u\) to be \(g(x)\) so that \(du = g'(x)\ dx\). However, the choice of \(u\) is not always obvious, since not all integrands are set up as \(f'(g(x))g'(x)\). One example was $$\int \frac{1}{1 + e^{x}}\ dx$$

Thus, while \(u\)-substitution is a technique of integration, there are “sub”-techniques that require a general comfort level with Algebra, Pre-calculus, Calculus (Derivatives), and Trigonometry.

Similarly, integration by parts is a technique of integration aimed at ‘undoing the product rule’ with its own set of “sub”-techniques. The product rule is a rule taught to students of calculus for differentiating the product of two functions. The rule is that for two differentiable functions \(f\) and \(g\), their product \(fg\) differentiates to \(f’g + g’f\). In other words, $$(fg)’ = f’g + g’f$$ and I am suppressing the “of \(x\)” in the notation. Thus, to undo the product rule, we simply integrate both sides of the equation to obtain
$$\int (fg)’ = \int f’g + \int g’f$$

Written a bit more cleanly and with the notation of differentials we have
$$\int d(fg) = \int g\ df + \int f\ dg$$

Now, $$\int d(fg) = fg$$ since “the integral of the derivative is the integrand” and this gives $$fg = \int g\ df + \int f \ dg$$
Rearranging, we have $$\int f\ dg = fg\ – \int g\ df$$ and this is integration by parts.

The general idea then is to choose an \(f\) that is “simpler” when differentiated and to choose a \(dg\) that doesn’t get dramatically worse when integrated. The overall hope is that \(g\ df\) is easier to work with than \(f\ dg\). Here’s a standard example: $$\int xe^{x}\ dx$$
Which function is simpler when differentiated and which function doesn’t get dramatically worse when integrated? We notice if \(f = x\) and \(dg = e^{x}\ dx\) then \(df = 1\ dx\) and \(g = e^{x}\) which means that \(g\ df = e^{x}\ dx\) — and that is trivial to integrate. Thus, $$\int xe^{x}\ dx = xe^{x}\ – \int e^{x}\ dx$$ and integrating the right hand side gives $$\int xe^{x}\ dx = xe^{x}\ – e^{x} + C$$ where \(C\) is a constant. It can be verified that differentiating the right hand side does indeed give the integrand on the left hand side.

As an instructional exercise, it is worthwhile to have students to choose the “wrong” \(f\) and \(dg\) to see what happens. (I know that most text books use “\(u\)” and “\(dv\)”, but I tend to go with \(f\) and \(g\) since those are letters typically used for functions. And for a first introduction to integration by parts, I find it simpler for students not to worry about another layer of notation, even though in the purest sense this shouldn’t matter.)

Once a student has a basic grasp of how integration by parts works, we can start to introduce some of the sub-techniques. Here are examples of basic integrals that do not require anything beyond a direct approach:
$$\int x\sin(x)\ dx$$
$$\int x\ln(x)\ dx$$
$$\int xe^{-x}\ dx$$

You may have noticed that the three integrals above all involve the lonesome \(x\). These tend to be the easiest integrals to work with since \(x\) differentiates nicely to \(1\ dx\) — though, with \(\int x\ln(x)\ dx\) it is better to choose \(f = \ln(x)\) since \(df = \frac{1}{x}\ dx\). Choosing \(dg = \ln(x)\ dx\) gets one stuck in the mud because what then is the antiderivative of \(\ln(x)\)? oops! That requires integration by parts and is presented later.

Ok, now let’s get into some sub-techniques. Mind you, integrals can be made to be really really messy if one were so inclined. But that’s not the purpose of these exercises. The purpose is

  • to understand when to use integration by parts,
  • to strengthen the Algebra, Precalculus, Trigonometry, and Calculus I and Calculus II skills,
  • to develop a problem solving thought process.

Using \(u\)-substitution

It is easy to teach the various integration techniques as isolated techniques. But one must go beyond this. Students ought to learn how to use multiple integration techniques together. The typical order of instruction is

  1. Recalling antiderivatives,
  2. \(u\)-substitution
  3. integration by parts

Thus, at this point, students will not have had too many methods in their repertoire. And this is a good thing! Here are two variations on some of the basic integrals mentioned previously.

$$\int x\sin(7x + 2)\ dx$$
$$\int xe^{5x}\ dx$$

Both of these use similar \(f\) and \(dg\) choices with their simpler counterparts. However, \(dg\) will require a \(u\)-substitution in order to find \(g\) (note: with enough practice, the \(u\)-substitution step can be skipped, but the beginner student will likely have to labor through the steps — this is a good thing! It’s more practice.). What will most likely happen is the following — and I will use \(xe^{5x}\) as an example. With $$\int xe^{5x}\ dx$$ most students will choose (when they choose correctly) \(f = x\) and \(dg = e^{5x}\ dx\). This will work out just fine since \(dg\) will yield \(g = \frac{e^{5x}}{5}\), \(df = 1\ dx\), and \(g\ df\) will be a simple \(u\)-substitution integral that was already done to obtain \(g\).

What most students will not do is try a \(u\)-substitution first. That is, let \(u = 5x\), then \(du = 5\ dx\) and $$\int xe^{5x}\ dx = \int \frac{1}{5}\cdot\frac{u}{5}e^{u}\ du$$

The right hand side when re-written is just $$\frac{1}{25}\int ue^{u}\ du,$$ which was already solved!

The subtle takeaway here is to get students to convert problems into previously solved problems. The more readily they are able to do this, the more “lazy” they can become with the mechanics and the more they can focus on meaning and understanding. The ability to convert a problem into a previously solved one is also a stepping stone towards mathematical rigor — that is, the usage of definitions and theorems to prove other theorems (perhaps some which had never been proven before!).

In a similar, but slightly different vein, students can next try this:
$$\int x\ln(5x + 2)\ dx$$
and they will quickly find themselves up against \(\int \ln(x)\ dx\). And this brings us to our next sub-technique which was briefly introduced in \(u\)-substitution.

Choosing \(dx\)

In much the same way that students have a hard time seeing that \(dx = 1\cdot dx\), students will not realize that \(dg = dx\) is a perfectly valid choice. Consider $$\int \ln(x)\ dx$$ Most students will stare blankly at this problem. They will be looking for two functions: one to call \(f\) and the other to call \(dg\). Odds are they will eventually settle on \(f = \ln(x)\) since \(dg = \ln(x)\ dx\) makes the problem circular. Thus, \(f = \ln(x)\), but what then is \(dg\)? There may be claims that this is a trick question, or it’s not an integration by parts, etc. All are natural reactions when one is seeking an “out”. Here, \(dg = dx\)! And we have \(df = \frac{1}{x}\ dx\) and \(g = x\) yielding $$\int \ln(x)\ dx = x\ln(x)\ – \int\ dx$$ and the right hand side is easy to integrate since \(g\ df = 1\ dx\).

Once students have been shown this, give them the following:
$$\int \arctan(x)\ dx$$
This is just a repetition on a theme: \(f = \arctan(x)\), \(dg = dx\) therefore, \(df = \frac{1}{1 + x^{2}}\ dx\) and \(g = x\) giving
$$\int \arctan(x)\ dx = x\arctan(x)\ – \int \frac{x}{1 + x^{2}}\ dx$$ and the integral on the right hand side is solved via \(u\)-substitution.

Next give $$\int \operatorname{arcsec}(x)\ dx$$

The purpose again is to get students comfortable with the idea that \(dg = dx\) is a suitable choice and this is a good way for students to become better acquainted with inverse trig functions and their derivatives.

Eventually, students will accept the idea of choosing \(dg = dx\). And so, what better to do next than to twist their brains a little bit more. Now remind them of $$\int x\ln(5x + 2)\ dx$$ There are several ways to solve this and given the problems above, students will have seen all the techniques needed. So, it’s a question of how nimble they are with manipulating the symbolism.

Here’s one way to solve \(\int x\ln(5x + 2)\ dx\). Let \(u = 5x + 2\). Then \(du = 5\ dx\) and \(\frac{u-2}{5} = x\). Thus $$\int x\ln(5x + 2)\ dx = \int \frac{u-2}{25}\ln(u)\ dx$$ and the right hand side becomes $$\frac{1}{25}\Bigg(\int u\ln(u)\ du\ – 2\int \ln(u)\ du\Bigg)$$ with both integrals having been previously solved!

Here’s a second way to solve \(\int x\ln(5x + 2)\ dx\) and the way that most students will try first, which naturally will lead to a mess. But so goes the learning process. Immediately go with integration by parts: \(f = \ln(5x + 2)\), \(dg = x\ dx\) which gives \(df = \frac{5}{5x + 2}\) (chain rule!) and \(g = \frac{x^{2}}{2}\). Thus $$\int x\ln(5x + 2)\ dx = \frac{x^{2}}{2}\ln(5x + 2)\ – \frac{5}{2}\int \frac{x^{2}}{5x + 2}\ dx$$ and now how we have to deal with $$\int \frac{x^{2}}{5x + 2}\ dx$$
I leave this as an exercise for the reader with the following hints:

  1. This is a \(u\)-substitution
  2. \(u = 5x + 2\)
  3. \(\frac{u-2}{5} = x\) you will need this

Do both ways get the same answer? They had better!

Integration by parts is a big part of the standard integration techniques. So I’ll stop here. Next week, Part 2!