$$ \newcommand{\norm}[1]{\left\Vert#1\right\Vert} \newcommand{\abs}[1]{\left\vert#1\right\vert} \newcommand{\set}[1]{\left\{#1\right\}} \newcommand{\Comp}{\mathbb C} \newcommand{\Real}{\mathbb R} \newcommand{\Nat}{\mathbb N} \newcommand{\of}[1]{\left ( #1 \right ) } \newcommand{\To}{\rightarrow} \newcommand{\eps}{\varepsilon} $$

Integral Calculus lecture notes: Integration by parts

Eugene Kritchevski, Vanier College, last updated on March 1, 2016


Theory and basic examples

Integration by parts is the anolgue of the product rule for integrals, and is one of the most important general methods of integration. Recall that when $f$ and $g$ are differentiable functions, so is their product and $$\frac{d}{dx}[f(x)g(x)]=f(x)g'(x)+g(x)f'(x).$$ We therefore have $$\int [f(x)g'(x)+g(x)f'(x)]\,dx = f(x)g(x).$$ and, splitting the indefinite integral on the left as a sum of integrals, $$\int f(x)g'(x)\,dx \,+\int g(x)f'(x)\,dx = f(x)g(x).$$ Isolating the first integral on the left gives:
Integration by parts formula for indefinite integrals
$$\int f(x)g'(x)\,dx = f(x)g(x) - \int g(x)f'(x)\,dx $$

When we need to integrate a product, it is our job to decide which one of the factors should be called $f(x)$ and which one should be called $g'(x)$.

Example 1: Evaluate the indefinite integral $$I=\int (4x+1)e^{2x+3}\,dx .$$
Solution: Let $f(x)=4x+1$ and $g'(x)=e^{2x+3}$. The $f'(x)=4$ and we can take the antiderivative $g(x)=\frac{1}{2}e^{2x+3}$. It is not neccessary to take the most general antiderivative $g(x)=\frac{1}{2}e^{2x+3}+C$ at this step. Just a specific $g$ will do the job. The integration by parts formula gives $$ \begin{equation*} \begin{split} I&=\int f(x)g'(x)\,dx \\ &=f(x)g(x)-\int g(x)f'(x)\,dx \\ &=(4x+1)\frac{1}{2}e^{2x+3}- \int \frac{1}{2}e^{2x+3}\cdot 4\,dx \qquad \leftarrow\boxed{\textrm{this new integral is easier than the original integral } I\,\,} \\ &=(4x+1)\frac{1}{2}e^{2x+3}- \frac{1}{2}\cdot \frac{1}{2} e^{2x+3}\cdot 4 +C \\ &=(2x+\frac{1}{2})e^{2x+3}- e^{2x+3} +C \\ &=(2x-\frac{1}{2})e^{2x+3} +C \\ \end{split} \end{equation*} $$ Let us check the answer by differentiation: $$\frac{d}{dx}[(2x-\frac{1}{2})e^{2x+3}]=(2x-\frac{1}{2})'e^{2x+3} + (2x-\frac{1}{2})(e^{2x+3})'= 2e^{2x+3}+(2x-\frac{1}{2})2e^{2x+3}=(4x+1)e^{2x+3}.$$ Let us see what happens if instead of $f(x)=4x+1$ and $g'(x)=e^{2x+3}$ we take $f(x)=e^{2x+3}$ and $g'(x)=4x+1$. The product $f(x)g'(x)$ is the same in both situations. We then have $f'(x)=2e^{2x+3}$ and $g(x)=2x^2+x$. The integration by parts formula gives $$ \begin{equation*} \begin{split} I&=\int f(x)g'(x)\,dx \\ &=f(x)g(x)-\int g(x)f'(x)\,dx \\ &=2x^2+xe^{2x+3}- \int (2x^2+x)\cdot e^{2x+3}\,dx \qquad \leftarrow\boxed{\textrm{this new integral is harder than the original integral } I\,\,} \\ \end{split} \end{equation*} $$ Nothing is mathematically wrong with this alternative choice of $f(x)$ and $g'(x)$ but, instead of the integral $I$, we are now stuck with a harder integral to evaluate. In general (but not always...), we want to use integration by parts for simplifing integrals and not for making them harder.

Example 2: Evaluate the indefinite integral $$I=\int x \cos(x)\,dx .$$
Solution: Take $f(x)=x$ and $g'(x)=\cos(x)$. Then $f'(x)=1$ and we can take $g(x)=\sin(x)$. The integration by parts formula gives $$ \begin{equation*} \begin{split} I&=\int f(x)g'(x)\,dx \\ &=f(x)g(x)-\int g(x)f'(x)\,dx \\ &=x\sin(x)- \int 1\cdot \sin(x)\,dx \qquad \leftarrow\boxed{\textrm{this new integral is easier than the original integral } I\,\,} \\ &=x\sin(x)-(-\cos(x)) +C \\ &=x\sin(x)+\cos(x) +C \\ \end{split} \end{equation*} $$ Let us check the answer by differentiation: $$\frac{d}{dx}[x\sin(x)+\cos(x)]=1\cdot \sin(x)+x\cos(x)-\sin(x)=x\cos(x).$$
Integration by parts can also be done very elegantly using differentials. If $u=f(x)$ and $v=g(x)$, then $du=f'(x)\,dx$ and $dv=g'(x)\,dx$ and the integration by parts formula becomes $$\int \underbrace{f(x)}_{u}\,\underbrace{g'(x)\,dx}_{dv} = \underbrace{f(x)g(x)}_{uv} - \int \underbrace{g(x)}_{v}\,\underbrace{f'(x)\,dx}_{du}.$$ The resulting formula is very compact and easy to remember
Integration by parts formula for indefinite integrals (using differentials)
$$\int u\,dv = uv - \int v\,du$$

Using differentials, this is how examples 1 and 2 look like. Note that, except for notation, the computations end up being exactly the same.
Example 1: Let $u=4x+1$, $du=2x\,dx$ , $dv=e^{2x+3}\,dx$ and $v=\frac{1}{2}e^{2x+3}$. Then $$ \begin{equation*} \begin{split} I&=\int (\underbrace{4x+1}_{u})\,\underbrace{e^{2x+3}\,dx}_{dv} \\ &=uv-\int v\,du \\ &=(\underbrace{4x+1}_{u})\underbrace{\frac{1}{2}e^{2x+3}}_{v}- \int \underbrace{\frac{1}{2}e^{2x+3}}_{v}\cdot \underbrace{4\,dx}_{du} \qquad \leftarrow\boxed{\textrm{this new integral is easier than the original integral } I\,\,} \\ &=(4x+1)\frac{1}{2}e^{2x+3}- \frac{1}{2}\cdot \frac{1}{2} e^{2x+3}\cdot 4 +C \\ &=(2x+\frac{1}{2})e^{2x+3} - e^{2x+3} +C \\ &=(2x-\frac{1}{2})e^{2x+3} +C \\ \end{split} \end{equation*} $$

Example 2: Let $u=x$, $du=dx$, $dv=\cos(x)\,dx$ and $v=\sin(x)$. Then $$ \begin{equation*} \begin{split} I&=\int \underbrace{x}_{u}\,\underbrace{\cos(x)\,dx}_{dv} \\ &=uv-\int v\,du \\ &=\underbrace{x}_{u}\underbrace{\sin(x)}_{v}- \int \underbrace{\sin(x)}_{v}\cdot \underbrace{1\,dx}_{du} \qquad \leftarrow\boxed{\textrm{this new integral is easier than the original integral } I\,\,} \\ &=x\sin(x)-(-\cos(x)) +C \\ &=x\sin(x)+\cos(x) +C \\ \end{split} \end{equation*} $$

From now on we will be using using differentials.
Example 3: Evaluate the indefinite integral $$I=\int x\ln(x)\,dx .$$
Solution: Let $u=\ln(x)$, $du=\frac{1}{x}\,dx$, $dv=x\,dx$ and $v=\frac{1}{2}x^2$. Then $$ \begin{equation*} \begin{split} I&=\int \underbrace{\ln(x)}_{u}\,\underbrace{x\,dx}_{dv} \\ &=uv-\int v\,du \\ &=\underbrace{\ln(x)}_{u}\underbrace{(\frac{1}{2}x^2)}_{v}- \int \underbrace{\frac{1}{2}x^2}_{v}\cdot\underbrace{\frac{1}{x}\,dx}_{du} \\ &=\frac{1}{2}x^2\ln(x)-\int \frac{1}{2}x\,dx \\ &=\frac{1}{2}x^2\ln(x)-\frac{1}{4}x^2 +C \\ \end{split} \end{equation*} $$

Repeated integration by parts

Sometimes, it is necesserary to repeatedly use integration by parts, simplying the integral at each step.

Example 4: Evaluate the indefinite integral $$I=\int x^2 \sin(x)\,dx .$$
Solution: Let $u=x^2$, $du=2x\,dx$, $dv=\sin(x)\,dx$ and $v=-\cos(x)$. Then $$ \begin{equation*} \begin{split} I&=\int \underbrace{x^2}_{u}\,\underbrace{\sin(x)\,dx}_{dv} \\ &=uv-\int v\,du \\ &=\underbrace{x^2}_{u}\underbrace{(-\cos(x))}_{v}- \int \underbrace{-\cos(x)}_{v}\cdot \underbrace{2x\,dx}_{du} \\ &=-x^2\cos(x)+2\int x\cos(x)\,dx \qquad\qquad &\leftarrow \textrm{this integral is integrated by parts in example 2 }\\ &=-x^2\cos(x)+2\of{x\sin(x)+\cos(x)} +C \\ &=-x^2\cos(x)+2 x\sin(x)+2\cos(x) +C \end{split} \end{equation*} $$

Example 5: Evaluate the indefinite integral $$I=\int x^2 e^x\,dx .$$
Solution: Intgegrating $I$ by parts with $u=x^2$, $du=2x\,dx$, $dv=e^x\,dx$, and $v=e^x$ gives $$I=x^2e^x-\int e^x\cdot 2x\,dx=x^2e^x- 2J,$$ where $$J=\int x e^x\,dx.$$ In order to compute $J$, we integrate by parts again with $w=x$, $dw=1\cdot dx$, $dv=e^x\,dx$, and $v=e^x$, which gives $$J=xe^x-\int e^x \,dx=x e^x - e^x.$$ Coming back to $I$, we then have $$I=x^2e^x- 2J=x^2e^x-2xe^x+2e^x+C.$$

Example 6: Evaluate the indefinite integral $$I=\int e^x \cos(x)\,dx.$$
Solution: Integrating $I$ by parts with $u=e^x$, $du=e^x\,dx$, $dv=\cos(x)\,dx$, and $v=\sin(x)$ gives $$(1)\qquad I=e^x\sin(x)-\int e^x \sin(x)\,dx=e^x\sin(x)-J,$$ where $$J=\int e^x \sin(x)\,dx.$$ The $J$ integral is now of the same kind as the $I$ integral, with $\sin$ instead of $\cos$. It looks like we are not making progress. Let us have faith and integrate $J$ by parts again anyways with $u=e^x$, $du=e^x\,dx$, $dw=\sin(x)\,dx$, and $w=-\cos(x)$ We get $$(2)\qquad J=e^x(-\cos(x))-\int e^x(-\cos(x))\,dx=-e^x\cos(x)+\int e^x\cos(x)\,dx=-e^x\cos(x)+I.$$ This starts to look like a complete waste of time, since in order to comptute $J$, equation $(2)$ tells us that we need to compute $I$, which is where we started. However, if we substitute the equation $(2)$ into $(1)$, we get $$I=e^x\sin(x)-(-e^x\cos(x)+I)=e^x\sin(x)+e^x\cos(x)-I,$$ which allows us to solve for $I$: $$2I=e^x\sin(x)+e^x\cos(x)$$ $$I=\frac{1}{2}e^x\sin(x)+\frac{1}{2}e^x\cos(x)$$ and we conclude that $$\int e^x \cos(x)\,dx= \frac{1}{2}e^x\sin(x)+\frac{1}{2}e^x\cos(x) +C.$$

Combining Integration by Parts with Substitution

Example 7: Evaluate the indefinite integral $$I=\int x^3 e^{x^2}\,dx.$$
Solution: We first use the substitution $t=x^2$, then $dt=2x\,dx$ and $$I=\int x^2 e^{x^2} x\,dx=\int t e^{t}\frac{1}{2}\,dt=\frac{1}{2}\int t e^{t}\,dt$$ Using the $J$ integral from example 5, we have $\int t e^{t}\,dt=t e^t - e^t$ and so $$I=\frac{1}{2}\of{t e^t - e^t}=\frac{1}{2}\of{x^2 e^{x^2} - e^{x^2}}+C.$$

Example 8: Evaluate the indefinite integral $$I=\int \arctan(x)\,dx.$$
Solution: We first integrate by parts with $u=\arctan(x)$, $du=\frac{1}{1+x^2}\,dx$, $dv=1\cdot\,dx$ and $v=x$. Then $$I=x\arctan(x)-\int x\cdot\frac{1}{1+x^2}\,dx.$$ In the last integral, we use the substition $t=1+x^2$, $dt=2x\,dx$, $\frac{1}{2}dt=x\,dx$. Then $$I=x\arctan(x)-\int \frac{1}{t}\frac{1}{2}\,dt=x\arctan(x)-\frac{1}{2}\ln(|t|)+C=x\arctan(x)-\frac{1}{2}\ln(1+x^2)+C.$$

Integration by parts for definite integrals

Using $$\int [f(x)g'(x)+g(x)f'(x)]\,dx = f(x)g(x),$$ together wit FTC2, we get $$\int_a^b [f(x)g'(x)+g(x)f'(x)]\,dx = f(x)g(x)\Big|_a^b.$$ We split the definite integral on the left as the sum of two definite integrals $$\int_a^b f(x)g'(x)dx +\int_a^b g(x)f'(x)\,dx = f(x)g(x)\Big|_a^b.$$ Isolating the first integral on the left gives:
Integration by parts formula for definite integrals
$$\int_a^b f(x)g'(x)\,dx = f(x)g(x)\Big|_a^b - \int_a^b g(x)f'(x)\,dx $$ Reminder: The notation $f(x)g(x)\Big|_a^b$ means $f(b)g(b)-f(a)g(a)$.
As in the case of indefinite integrals, we can use differentials: $u=f(x)$, $du=f'(x)dx$, $dv=g'(x)dx$ and $v=g(x)$. Then the integration by parts formula can be remembered as $$\int_a^b \underbrace{f(x)}_{u}\underbrace{g'(x)\,dx}_{dv} = \underbrace{f(x)g(x)}_{uv}\Big|_a^b - \int_a^b \underbrace{g(x)}_{v}\underbrace{f'(x)\,dx}_{du}.$$ Note that, unlike in the substitution method for definite integrals, we do not have to change the limits of integration $a$ and $b$.

Example 9: Evaluate the definite integral $$I=\int_0^1 xe^x\,dx.$$
Solution: Let $u=x$, $du= dx$, $dv=e^x\,dx$ and $v=e^x$. Then $$I=xe^x\Big|_0^1-\int_0^1e^x\,dx=1e^1-0e^0-e^x\Big|_0^1=e-(e^1-e^0)=e^0=1.$$

Example 10: Assume that that $f''(x)$ and $g''(x)$ are continuous on $[a,b]$ and that $f$ and $g$ vanish at the enpoints of $[a,b]$, that is $$f(a)=f(b)=g(a)=g(b)=0.$$ Show that then $$\int_a^b f(x)g''(x)\,dx=\int_a^b f''(x)g(x)\,dx.$$ Solution: Let $$I=\int_a^b f(x)g''(x)\,dx.$$ With $u=f(x)$, $du=f'(x)dx$, $dv=g''(x)\,dx$ and $v=g'(x)$, integration by parts gives $$I=f(x)g'(x)\Big|_a^b-\int_a^b f'(x)g'(x)\,dx=\underbrace{f(b)}_{0}g'(b)-\underbrace{f(a)}_{0}g'(a)-\int_a^b f'(x)g'(x)\,dx=-\underbrace{\int_a^b f'(x)g'(x)\,dx}_J$$ We integrate $J$ by parts with $w=f'(x)$, $dw=f''(x)dx$, $dv=g'(x)\,dx$ and $v=g(x)$: $$J=\int_a^b f'(x)g'(x)\,dx=f'(x)g(x)\Big|_a^b-\int_a^b f''(x)g(x)\,dx=f'(b)\underbrace{g(b)}_{0}-f'(a)\underbrace{g(a)}_{0}-\int_a^b f''(x)g(x)\,dx=-\int_a^b f''(x)g(x)\,dx.$$ It follows that $I=-J=\int_a^b f''(x)g(x)\,dx$, as required.

Exercises

Make sure you do all your WeBWorK problems on integration by parts. You can practice integration by parts by doing the practice problems below.
Practice problems: Evaluate
  1. $\int x e^{-x/2}\,dx$
  2. $\int \ln(x)\,dx$
  3. $\int e^{-x}\sin(3x)\,dx$
  4. $\int\arccos(x)\,dx$
  5. $\int_0^2 x^3\sqrt{4-x^2}\,dx$
You can find the solution to each of the above problems in this video on integration by parts by Selwin Hollis.
Do all the problems from this worksheet on integration by parts by Isaac Sabbah.
More practice problems: solve all the problems on integration by parts from Paul's online notes.