Integration by Parts

...or finding antiderivatives by reversing the product rule.

The product rule

Let's say that...

  • $u$ is some function of $x$, that is $u(x)$,
  • $v$ is some function of $x$, that is $v(x)$,

Then, the derivative of $u(x)\cdot v(x)$ is given by...

The Product Rule: The derivative of the product of two functions, $u(x)$ and $v(x)$ is: $$\frac{d}{dx}[u(x)\cdot v(x)]= \left[\frac{d}{dx}u(x)\right] \cdot v(x) + u(x)\cdot\left[\frac{d}{dx}v(x)\right].$$

I'll write this more compactly as: $$(uv)'=u'v+uv'.$$

Integrating both sides... $$\int \frac{d}{dx}\left(uv \right)\,dx = \int u'v\,dx+\int uv'\,dx.$$

But $\int f'\,dx=f$, so... $$uv = \int u'v\,dx+\int uv'\,dx.$$

Solving this algebraically for $\int uv'$...

$$\int uv'\,dx=uv-\int u'v\,dx$$

Examples

All of these will use $$\int uv'\,dx=uv-\int u'v\,dx$$

Integrating $(\ln z)/z^2$

Solving... $$\int \frac{\ln z}{z^2}\,dz.$$

Try... $$u=\ln z;\ \ \ \Rightarrow u'=\frac 1z$$ and $$v'=\frac{1}{z^2}=z^{-2};\ \ \ \Rightarrow v=-z^{-1}.$$

Substituting into our expression to reverse the chain rule $$\begineq\int \frac{\ln z}{z^2}\,dz =&-\frac{\ln z}{z} -\int \frac 1z \cdot(-\frac 1z)\,dz\\ =&-\frac{\ln z}{z} +\int \frac{1}{z^2}= -\frac{\ln z}{z} -\frac{1}{z}. \endeq $$

How to choose $u$ and $v'$?

  • You had better be able to figure out $v$ given $v'$.
  • Helps if $u'v$ is simpler than $uv'$.

A definite integral

Find this integral: $$\int_0^\pi x\sin(x)\,dx.$$ Let's view this as $\int uv'\,dx$ and identify the pieces as: $u(x)=x$ and $v'(x)=\sin(x)$. Then:

  • if $u=x$, then $u'=1$.
  • if $v'=\sin(x)$, then an antiderivative is $v=-\cos(x)$.

Tip: Always write down your "dictionary" of definitions of $u$, $u'$, $v$, and $v'$! (It's too much to keep in your head...)

Our work above suggests that $$\begineq \int_0^\pi x\sin(x)\,dx =&\\ \int_0^\pi uv'\,dx =&\left.uv\right|_0^\pi-\int_0^\pi u'v\,dx\\ =&\left.-x\cos(x)\right|_0^\pi-\int_0^\pi -\cos x\,dx\\ =&-\pi\cos(\pi)+0\cos(0)+\int_0^\pi \cos x\,dx\\ =&-\pi\cdot(-1)+\left.\sin x\right|_0^\pi\\ \int_0^\pi x\sin(x)\,dx =&\pi+\sin(\pi)-\sin(0)=\pi. \endeq $$

Note that:

  • If I had chosen $v'=x$ (and then $v=x^2/2$ then I would have gotten a more complicated integral to solve.
  • Sometimes chosing $v'=1$ (and then $v=x$) is a useful thing.
  • Sometimes you have to integrate by parts more than once before you get an integral that is sufficiently easy to solve.

Now try...

  1. $$\int te^t\,dt$$ show / hide
    Let's try both ways:

    First try: $v'=t$ and $u=e^t$. This implies that $v=\frac{t^2}{2}$ and $u'=e^t$. $$\begineq \int v'u\,dt =& uv - \int u'v\,dt\\ \int te^t\,dt =& e^t\frac{t^2}{2} - \int e^t\frac{t^2}{2}\,dt \endeq $$ But--ugghh!-- that integral on the far right is no easier to carry out than what we started with!

    Second try: $\require{color}v'=e^t$ and $u=t$. This implies that $v=e^t$ and $u'=1$. $$\begineq \int v'u\,dt =& uv - \int u'v\,dt\\ \int e^tt\,dt =& te^t - \int 1\cdot e^t\,dt\\ =&te^t-e^t = \colorbox{Goldenrod}{$(t-1)e^t$}. \endeq $$ This time, the integral on the right was a lot simpler!
  2. $$\int \ln x\,dx$$ (hint: choose $v'=1$.)
    show / hide
    $\colorbox{Goldenrod}{$x\ln x - x$}$
  3. $$\int x\ln x\,dx$$ show / hide
    $\colorbox{Goldenrod}{$\frac 12 x^2\ln(x) - \frac 14x^2$}$
  4. $$\int (\ln x)^2\,dx$$ (hint: choose $v'=\ln x$ and $u=\ln x$
    show / hide
    $\int(\ln x)^2\,dx=\int (\ln x)\cdot(\ln x)\,dx$.
    If you've done problem #2 above, then you now know an antiderivative of $v'=\ln x$ is $v=x\ln x - x$. Then we'll consider the other $\ln x$ as $u=\ln x$. We know that $u'=1/x$. $$\begineq \int v'u\,dt =& uv - \int u'v\,dt\\ \int (\ln x)(\ln x)\,dt=&\ln x \cdot(x\ln x-x) - \int\frac 1x\cdot (x\ln x - x)\,dx\\ =&x(\ln x)^2-x\ln x-\int (\ln x-1)\,dx\\ =&x(\ln x)^2-x\ln x-\left[(x\ln x-x)-x\right]\\ =&x(\ln x)^2-x\ln x-x\ln x+x+x\\ =&\colorbox{Goldenrod}{$x((\ln x)^2-2\ln x + 2)$} \endeq$$
  5. $$\int \ln(x^2)\,dx$$ show / hide

    Well, gee, I'm not seeing two different functions multiplied by each other! So let's try viewing this one as $\int 1\cdot\ln(x^2)$. Therefore, $v'=1$, $v=x$, $u=\ln(x^2)$, and using the chain rule: $u'=\frac{1}{x^2}\cdot 2x=\frac{2}{x}$. $$\begineq \int v'u\,dx =& uv - \int u'v\,dx\\ \int 1\cdot\ln(x^2)\,dx=&\ln(x^2)\cdot x-\int\frac 2x\cdot x\,dx\\ =&x\ln(x^2)-2\int 1=\colorbox{Goldenrod}{$x\ln(x^2)-2x$}. \endeq$$

FAQ

Q: One of your questions was along the lines of...

I am so confused! [What do we pick for $u$ and for $v'$] in the first problem?

A: It's not always obvious! If you "show" the answer to the first one above, you'll see that I went ahead and tried one choice for $v'$ and $u$, and when that didn't work, I tried a different choice!


Q: How do we know when to use integration by parts?

A: It should probably be your last resort. In general:

  1. First see if you can see some simple functions (polynomials, sines and cosines, exponentials) for which you already know the antiderivatives,
  2. Then, see if you can see some "inside function" and its derivative in the integrand that will let you use substitution,
  3. And if none of those work, see if integration by parts might help!

Q: How should we approach Edfinity problem 4? That was...

A: I outlined an approach like this in class today:

  1. Use integration by parts to write the desired integral as: $$\begineq \int_0^3 fg'\,dx=&\left.f(x)g(x)\right|_0^3 - \int_0^3f'g\,dx \\ =&f(3)g(3)-f(0)g(0) - \int_0^3f'(x)g(x)\,dx\\ \endeq $$
  2. Since you know the formula for $f(x)$, and have the table for $g(x)$, you can calculate the term $f(3)g(3)-f(0)g(0)$.
  3. You still need to calculate, or rather estimate the integral that shows up on the right: $$\int_0^3 f'(x)g(x).$$
  4. Fill out this table. You already know the rows for $x$ and $g(x)$. Fill in a row for $f'(x)=3x^2$ and calculate the bottom row, which is the integrand for the definite integral.
    $x$ 00.51.0...
    $g(x)$ 1.01.52.1...
    $f'(x)$ 3*(0)^2
    =0
    3*(0.5)^2
    =0.75
    3*(1)^2
    =3
    ...
    $f'(x)g(x)$ 01.1256.3...
  5. Now you can use the values in the bottom row to approximate the definite integral. I recommended trying to average the seven values in the bottom row $$\int_0^3 f'g\,dx \approx 3*\text{ average of } f'g = \frac{0+1.125+6.3+....}{7}$$ But Edfinity did not like my answer!

    A different approach is to average the right and left sums.

    There are 6 intervals and the width of each interval is 0.5. So the left hand sum is $$\text{LHS}=0.5*(0+1.25+6.3+ \text{[3 more values]})$$ The right hand sum is $$\text{RHS}=0.5*(1.25+6.3+ \text{[4 more values]})$$ Now you can average the RHS and LHS to get an estimate for the integral. When I did that and filled in all the pieces, my answer differed from my first one by about 10%, and Edfinity liked my 2nd answer!

    On a test if I ask you to estimate a definite integral from a table of values, I would accept either method!