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 10.3.1 Evaluate $\ds\int x\ln x\,dx$. Let $u=\ln x$ so $du=1/x\,dx$. Then we must let $dv=x\,dx$ so $\ds 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 10.3.2 Evaluate $\ds\int x\sin x\,dx$. 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 10.3.3 Evaluate $\ds\int\sec^3 x\,dx$. 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 $\ds 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^2x-1)\sec x\,dx\cr &=\sec x\tan x-\int \sec^3x\,dx +\int\sec x\,dx.\cr } At first this looks useless—we're right back to $\ds \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 10.3.4 Evaluate $\ds\int x^2\sin x\,dx$. Let $u=x^2$, $dv=\sin x\,dx$; then $du=2x\,dx$ and $v=-\cos x$. Now $\ds \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:

 sign $u$ $dv$ $x^2$ $\sin x$ $-$ $2x$ $-\cos x$ $2$ $-\sin x$ $-$ $0$ $\cos x$
or
 $u$ $dv$ $x^2$ $\sin x$ $-2x$ $-\cos x$ $2$ $-\sin x$ $0$ $\cos x$

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 $\ds -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, $\ds (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 $\ds (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.

## Exercises 10.3

Find the antiderivatives.

Ex 10.3.1 $\ds\int x\cos x\,dx$ (answer)

Ex 10.3.2 $\ds\int x^2\cos x\,dx$ (answer)

Ex 10.3.3 $\ds\int xe^x\,dx$ (answer)

Ex 10.3.4 $\ds\int xe^{x^2}\,dx$ (answer)

Ex 10.3.5 $\ds\int \sin^2 x\,dx$ (answer)

Ex 10.3.6 $\ds\int \ln x\,dx$ (answer)

Ex 10.3.7 $\ds\int x\arctan x\,dx$ (answer)

Ex 10.3.8 $\ds\int x^3\sin x\,dx$ (answer)

Ex 10.3.9 $\ds\int x^3\cos x\,dx$ (answer)

Ex 10.3.10 $\ds\int x\sin^2 x\,dx$ (answer)

Ex 10.3.11 $\ds\int x\sin x\cos x\,dx$ (answer)

Ex 10.3.12 $\ds\int \arctan(\sqrt x)\,dx$ (answer)

Ex 10.3.13 $\ds\int \sin(\sqrt x)\,dx$ (answer)

Ex 10.3.14 $\ds\int\sec^2 x\csc^2 x\,dx$ (answer)