8.4: Integration by Parts
 Page ID
 915
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{\!\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
We have already seen that recognizing the product rule can be useful, when we noticed that
\[\int \sec^3u+\sec u \tan^2u\,du=\sec u \tan u.\]
As with substitution, we do not have to rely on insight or cleverness to discover such antiderivatives; there is a technique that will often help to uncover the product rule.
Start with the product rule:
\[{d\over dx}f(x)g(x)=f'(x)g(x)+f(x)g'(x).\]
We can rewrite this as
\[f(x)g(x)=\int f'(x)g(x)\,dx +\int f(x)g'(x)\,dx,\]
and then
\[\int f(x)g'(x)\,dx=f(x)g(x)\int f'(x)g(x)\,dx.\]
This may not seem particularly useful at first glance, but it turns out that in many cases we have an integral of the form
\[\int f(x)g'(x)\,dx\]
but that
\[\int f'(x)g(x)\,dx\]
is easier. This technique for turning one integral into another is called integration by parts, and is usually written in more compact form. If we let \(u=f(x)\) and \(v=g(x)\) then \(du=f'(x)\,dx\) and \(dv=g'(x)\,dx\) and
\[\int u\,dv = uv\int v\,du.\]
To use this technique we need to identify likely candidates for \(u=f(x)\) and \(dv=g'(x)\,dx\).
Example \(\PageIndex{1}\)
Evaluate \(\displaystyle \int x\ln x\,dx\).
Solution
Let \(u=\ln x\) so \(du=1/x\,dx\). Then we must let \(dv=x\,dx\) so \( v=x^2/2\) and
\[ \int x\ln x\,dx={x^2\ln x\over 2}\int {x^2\over2}{1\over x}\,dx= {x^2\ln x\over 2}\int {x\over2}\,dx={x^2\ln x\over 2}{x^2\over4}+C. \]
Example \(\PageIndex{2}\)
Evaluate \(\displaystyle \int x\sin x\,dx\).
Solution
Let \(u=x\) so \(du=dx\). Then we must let \(dv=\sin x\,dx\) so \(v=\cos x\) and
\[\int x\sin x\,dx=x\cos x\int \cos x\,dx= x\cos x+\int \cos x\,dx=x\cos x+\sin x+C.\]
Example \(\PageIndex{3}\)
Evaluate \(\displaystyle \int\sec^3 x\,dx\).
Solution
Of course we already know the answer to this, but we needed to be clever to discover it. Here we'll use the new technique to discover the antiderivative. Let \(u=\sec x\) and \( dv=\sec^2 x\,dx\). Then \(du=\sec x\tan x\,dx\) and \(v=\tan x\) and
\[\eqalign{ \int\sec^3 x\,dx&=\sec x\tan x\int \tan^2x\sec x\,dx\cr &=\sec x\tan x\int (\sec^2x1)\sec x\,dx\cr &=\sec x\tan x\int \sec^3x\,dx +\int\sec x\,dx.\cr }\]
At first this looks uselesswe're right back to \( \int\sec^3x\,dx\). But looking more closely:
\[\eqalign{ \int\sec^3x\,dx&=\sec x\tan x\int \sec^3x\,dx +\int\sec x\,dx\cr \int\sec^3x\,dx+\int \sec^3x\,dx&=\sec x\tan x +\int\sec x\,dx\cr 2\int\sec^3x\,dx&=\sec x\tan x +\int\sec x\,dx\cr \int\sec^3x\,dx&={\sec x\tan x\over2} +{1\over2}\int\sec x\,dx\cr &={\sec x\tan x\over2} +{\ln\sec x+\tan x\over2}+C.\cr }\]
Example \(\PageIndex{4}\)
Evaluate \( \displaystyle \int x^2\sin x\,dx\).
Solution
Let \(u=x^2\), \(dv=\sin x\,dx\); then \(du=2x\,dx\) and \(v=\cos x\). Now \( \int x^2\sin x\,dx=x^2\cos x+\int 2x\cos x\,dx\). This is better than the original integral, but we need to do integration by parts again. Let \(u=2x\), \(dv=\cos x\,dx\); then \(du=2\) and \(v=\sin x\), and
\[\eqalign{ \int x^2\sin x\,dx&=x^2\cos x+\int 2x\cos x\,dx\cr &=x^2\cos x+ 2x\sin x  \int 2\sin x\,dx\cr &=x^2\cos x+ 2x\sin x + 2\cos x + C.\cr }\]
Such repeated use of integration by parts is fairly common, but it can be a bit tedious to accomplish, and it is easy to make errors, especially sign errors involving the subtraction in the formula. There is a nice tabular method to accomplish the calculation that minimizes the chance for error and speeds up the whole process. We illustrate with the previous example. Here is the table:

or 

To form the first table, we start with \(u\) at the top of the second column and repeatedly compute the derivative; starting with \(dv\) at the top of the third column, we repeatedly compute the antiderivative. In the first column, we place a "\(\)'' in every second row. To form the second table we combine the first and second columns by ignoring the boundary; if you do this by hand, you may simply start with two columns and add a "\(\)'' to every second row.
To compute with this second table we begin at the top. Multiply the first entry in column \(u\) by the second entry in column \(dv\) to get \( x^2\cos x\), and add this to the integral of the product of the second entry in column \(u\) and second entry in column \(dv\). This gives:
\[x^2\cos x+\int 2x\cos x\,dx,\]
or exactly the result of the first application of integration by parts. Since this integral is not yet easy, we return to the table. Now we multiply twice on the diagonal, \( (x^2)(\cos x)\) and \((2x)(\sin x)\) and then once straight across, \((2)(\sin x)\), and combine these as
\[x^2\cos x+2x\sin x\int 2\sin x\,dx,\]
giving the same result as the second application of integration by parts. While this integral is easy, we may return yet once more to the table. Now multiply three times on the diagonal to get \( (x^2)(\cos x)\), \((2x)(\sin x)\), and \((2)(\cos x)\), and once straight across, \((0)(\cos x)\). We combine these as before to get
\[ x^2\cos x+2x\sin x +2\cos x+\int 0\,dx= x^2\cos x+2x\sin x +2\cos x+C. \]
Typically we would fill in the table one line at a time, until the "straight across'' multiplication gives an easy integral. If we can see that the \(u\) column will eventually become zero, we can instead fill in the whole table; computing the products as indicated will then give the entire integral, including the "\(+C\,\)'', as above.
Contributors
Integrated by Justin Marshall.