the natural history of abstract objects
-->

Integrating By Parts By Parts By Parts By Parts By Parts By Parts By Parts By Parts By Parts

Here’s an antiderivative: \[\int\! x^5 \sin(x)\,dx\] Looks hard! We probably can’t immediately see how to antidifferentiate it… which means that we should pull out our all-purpose, use-when-all-else-fails integration tool: integration by parts! Integration by parts, after all, is the machine gun of integration techniques—sometimes it’s overkill, but even when it is, you know it’ll get the job done!

I never remember the integration-by-parts formula, so here it is, for our reference:

\[\int\! f'(x)g(x)\, dx \quad=\quad f(x)\cdot g(x) \,-\, \int\! f(x)g'(x) \,dx\]

So, if we integrate this by parts, we’ll have:

\[\begin{align*} \int\! x^5 \sin(x)\,dx &= \int\! \underbrace{x^5}_{g(x)} \underbrace{\sin(x)}_{f'(x)}\,dx \\ &= f(x)\cdot g(x) \,-\, \int\! f(x)g'(x) \,dx \\ &= (-\cos x)x^5 \,-\, \int\! (-\cos x)\!\cdot\! 5x^4 \,dx \\ &= -x^5\cos x \,-\, \int\! (-\cos x)\!\cdot\! 5x^4 \,dx \end{align*}\]

Okay, well, this is nice, but we still have another integral we need to work out. This looks like something ELSE to work out by parts. So let’s do it again—let’s integrate by parts again!!! We have:

\[\begin{align*} &= -x^5\cos x \,-\, \int\! \underbrace{(-\cos x)}_{f'(x)}\!\cdot\! \underbrace{5x^4}_{g(x)} \,dx \\ &= -x^5\cos x - \left( f(x) g(x) \,-\, \int\! f(x)g'(x) \,dx \right)\\ &= -x^5\cos x - (-\sin x)5x^4 + \int\! (-\sin x)20x^3 \,dx \\ &= -x^5\cos x + 5x^4\sin x+ \int\! (-\sin x)20x^3 \,dx \end{align*}\]

Okay, we seem to be making some progress—the exponents on the \(x\)’s are trending in a hopeful direction—but we’re not done! There’s ANOTHER integral to work out by parts. Here we go:

\[\begin{align*} &= -x^5\cos x + 5x^4\sin x + \int\! \underbrace{(-\sin x)}_{f'(x)} \cdot \underbrace{20x^3}_{g(x)} \,dx \\ &= -x^5\cos x + 5x^4\sin x + \left( f(x) g(x) \,-\, \int\! f(x)g'(x) \,dx \right) \\ &= -x^5\cos x + 5x^4\sin x + \left( \cos(x)\cdot 20x^3 \,-\, \int\! \cos(x)\!\cdot\!60x^2 \,dx \right) \\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- \int\! \cos(x)\!\cdot\!60x^2 \,dx \end{align*}\]

AND AGAIN!

\[\begin{align*} &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- \int\! \underbrace{\cos(x)}_{f'(x)}\!\cdot\!\underbrace{60x^2}_{g(x)} \,dx \\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- \left( f(x) g(x) \,-\, \int\! f(x)g'(x) \,dx \right)\\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- \left( \sin(x)\!\cdot\! 60x^2 \,-\, \int\! \sin(x)\!\cdot\!120x \,dx \right)\\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) + \int\! \sin(x)\!\cdot\!120x \,dx \end{align*}\]

AGAIN!!!

\[\begin{align*} &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) + \int\! \underbrace{\sin(x)}_{f'(x)}\!\cdot\!\underbrace{120x}_{g(x)} \,dx \\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) + \left( f(x) g(x) \,-\, \int\! f(x)g'(x) \,dx \right) \\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) + \left( (-\cos x) 120x \,-\, \int\! (-\cos x)\cdot 120 \,dx \right) \\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) -120x \cos x - \int\! -120\cos x \,dx \end{align*}\]

Okay, wait, this is now an integral we can do without integrating by parts! I mean, we could integrate it by parts—we always can integrate by parts—but we can just do this by hand, as it were, from knowing how to antidifferentiate cosine. We have:

\[\begin{align*} &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) -120x \cos x -\left(-120\sin x \right) \\ &= -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) -120x \cos x + 120\sin x \end{align*}\]

We’re done! We’re done! We’re finally done!!! What a huge pain that was! But it looks like we have, as our final answer:

\[\boxed{ \int\! x^5 \sin(x)\,dx \,=\, -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) -120x \cos x + 120\sin x }\]

I guess we could check it by differentiating. But that seems like a pain, so let’s just assume that we did this all correctly.

Was there an easier way to do this? All that algebra was clunky and gross. And fundamentally, what we were doing was repetitive and simple. We were just pairing up derivatives of \(x^5\) with antiderivatives of \(\sin x\). So we just need to find the precise pattern of how they pair up. Oh, and we need to pay attention to the sign—there’s that negative in the integration-by-parts formula, so the sign keeps flipping. So, in principle, we could just make a table/chart, listing all three of these things, and use that to build each term!

I’m not going to motivate this particularly extensively, because (a) I don’t have that much time to write this, and (b) I don’t think it’s that hard to figure out, but anyway, we can list all the derivatives of \(g(x)\) and all the antiderivatives of \(f'(x)\):

\(g\) and its derivatives \(f'\) and its antiderivatives
\(x^5\) \(\sin(x)\)
\(5x^4\) \(-\cos(x)\)
\(20x^3\) \(-\sin(x)\)
\(60x^2\) \(\cos(x)\)
\(120x\) \(\sin(x)\)
\(120\) \(-\cos(x)\)
\(0\) \(-\sin(x)\)
\(0\) \(-\cos(x)\)
\(\vdots\) \(\vdots\)
etc. etc.

There are some alternating signs, too, from the negative in the integration by parts formula:

sign \(g\) and its derivatives \(f'\) and its antiderivatives
\(+\) \(x^5\) \(\sin(x)\)
\(-\) \(5x^4\) \(-\cos(x)\)
\(+\) \(20x^3\) \(-\sin(x)\)
\(-\) \(60x^2\) \(\cos(x)\)
\(+\) \(120x\) \(\sin(x)\)
\(-\) \(120\) \(-\cos(x)\)
\(+\) \(0\) \(-\sin(x)\)
\(-\) \(0\) \(-\cos(x)\)
\(+\) \(0\)

How do we combine these all to get our result? Well, the first term of integration by parts is \(f(x)g(x)\), so we need to take \(x^5\), with the first antiderivative of \(\sin x\), and multiply them together. Oh, and there’s a \(+\) sign in front. (Well, not exactly, because the antiderivative of \(\sin x\) has a negative… but there’s not an additional negative.) So, I’ll label that stuff in blue, and write the corresponding term:

sign \(g\) and its derivatives \(f'\) and its antiderivatives corresponding term
\(\color{blue} +\) \(\color{blue} x^5\) \(\sin(x)\) (n/a)
\(-\) \(5x^4\) \(\color{blue} -\cos(x)\) \(+x^5\cdot(-\cos x)\)
\(+\) \(20x^3\) \(-\sin(x)\)
\(-\) \(60x^2\) \(\cos(x)\)
\(+\) \(120x\) \(\sin(x)\)
\(-\) \(120\) \(-\cos(x)\)
\(+\) \(0\) \(-\sin(x)\)
\(-\) \(0\) \(-\cos(x)\)
\(\vdots\) \(\vdots\) \(\vdots\)

Great! Note that this is a little weird: we’re not multiplying together things from the exact same row. You could set this up differently if you want. This is just a procedure—it’s just a way of making repeated integration by parts easier.

For the next term, we’ll multiply together the next set of things. I’ll label them in red:

sign \(g\) and its derivatives \(f'\) and its antiderivatives corresponding term
\(\color{blue} +\) \(\color{blue} x^5\) \(\sin(x)\) (n/a)
\(\color{red}-\) \(\color{red} 5x^4\) \(\color{blue} -\cos(x)\) \(+x^5(-\cos x)\)
\(+\) \(20x^3\) \(\color{red}-\sin(x)\) \(-5x^4\left(-\sin x\right)\)
\(-\) \(60x^2\) \(\cos(x)\)
\(+\) \(120x\) \(\sin(x)\)
\(-\) \(120\) \(-\cos(x)\)
\(+\) 0 \(-\sin(x)\)
\(-\) 0 \(-\cos(x)\)
\(\vdots\) \(\vdots\)

Let’s keep going! I’ll label the next set in green:

sign \(g\) and its derivatives \(f'\) and its antiderivatives corresponding term
\(\color{blue} +\) \(\color{blue} x^5\) \(\sin(x)\) (n/a)
\(\color{red} -\) \(\color{red} 5x^4\) \(\color{blue} -\cos(x)\) \(\color{blue} +x^5\cdot(-\cos x)\)
\(\color{green} +\) \(\color{green} 20x^3\) \(\color{red} -\sin(x)\) \(\color{red} -5x^4\left(-\sin x\right)\)
\(-\) \(60x^2\) \(\color{green} \cos(x)\) \(\color{green} +20x^3\cos(x)\)
\(+\) \(120x\) \(\sin(x)\)
\(-\) \(120\) \(-\cos(x)\)
\(+\) 0 \(-\sin(x)\)
\(-\) 0 \(-\cos(x)\)
\(\vdots\) \(\vdots\)

You get the idea. Ultimately, this looks like:

sign \(g\) and its derivatives \(f'\) and its antiderivatives corresponding term
\(+\) \(x^5\) \(\sin(x)\) (n/a)
\(-\) \(5x^4\) \(-\cos(x)\) \(+x^5\cdot(-\cos x)\)
\(+\) \(20x^3\) \(-\sin(x)\) \(-5x^4 \cdot (-\sin x)\)
\(-\) \(60x^2\) \(\cos(x)\) \(+20x^3\cdot(\cos x)\)
\(+\) \(120x\) \(\sin(x)\) \(-60x^2 \cdot (\sin x)\)
\(-\) \(120\) \(-\cos(x)\) \(+120x \cdot (-\cos x)\)
\(+\) 0 \(-\sin(x)\) \(-120 \cdot (-\sin x)\)
\(-\) 0 \(-\cos(x)\) \(+0\cdot (-\cos x)\)
\(\vdots\) \(\vdots\) \(\vdots\)
etc. \(0\) etc. \(0\)

So, from adding together and simplifying all these things, we get the same answer:

\[\int\! x^5 \sin(x)\,dx \,=\, -x^5\cos x + 5x^4\sin x + 20x^3\cos(x)- 60x^2 \sin(x) -120x \cos x + 120\sin x \]

People often call this tabular integration; sometimes I refer to it as the table method, but it’s really not an actual theorem so much as an organizational strategy that makes iterated integration by parts less tedious. If integration by parts is like a machine gun for integration, using a table to integrate by parts over and over and over is like an anti-aircraft gun!!!