Integration by Parts in Calculus

Tutorials, Worked Examples with Collapsible Solutions, Practice Exercises, and Answers

Examples with detailed solutions and exercises with answers on how to use the technique of integration by parts to find integrals are presented.

Review Integration by Parts

The method of integration by parts may be used to easily integrate products of functions. The main idea of integration by parts starts with the derivative of the product of two functions \( u \) and \( v \) as given by:

\[ \dfrac{d(u \cdot v)}{dx} = \dfrac{du}{dx} v + u \dfrac{dv}{dx} \]

Rewrite the above equation as:

\[ u \dfrac{dv}{dx} = \dfrac{d(u \cdot v)}{dx} - \dfrac{du}{dx} v \]

Take the integral of both sides of the equation:

\[ \int u \dfrac{dv}{dx} \, dx = \int \dfrac{d(u \cdot v)}{dx} \, dx - \int \dfrac{du}{dx} v \, dx \]

Noting that \( \int \dfrac{d(u \cdot v)}{dx} \, dx = uv \), the expression simplifies to obtain the rule of integration by parts:

\[ \int u \dfrac{dv}{dx} \, dx = u v - \int \dfrac{du}{dx} v \, dx \]

Note that any choice of which function in the integrand is chosen as \( u \) and which is chosen as \( \dfrac{dv}{dx} \) must simplify the integral on the right-hand side of the formula.

Examples with Detailed Solutions

In what follows, \( c \) is a constant of integration.

Click on each example to view its detailed solution.

Example 1: Evaluate \( \displaystyle \int 3x e^x \, dx \)

Solution to Example 1:

\( 3 \) is a constant and may therefore be taken outside the integral sign.

Let \( u = x \) and \( \dfrac{dv}{dx} = e^x \), hence \( \dfrac{du}{dx} = 1 \) and \( v = \displaystyle \int e^x \, dx = e^x \). Using the method of integration by parts:

\[ \begin{aligned} \int 3x e^x \, dx &= 3 \int x e^x \, dx \\ &= 3 \left( x e^x - \int 1 \cdot e^x \, dx \right) \\ &= 3x e^x - 3e^x + c \end{aligned} \]
Example 2: Evaluate \( \displaystyle \int x \sin(x) \, dx \)

Solution to Example 2:

Let \( u = x \) and \( \dfrac{dv}{dx} = \sin(x) \), hence \( \dfrac{du}{dx} = 1 \) and \( v = -\cos(x) \). Applying integration by parts:

\[ \begin{aligned} \int x \sin(x) \, dx &= x(-\cos(x)) - \int 1 \cdot (-\cos(x)) \, dx \\ &= -x \cos(x) + \int \cos(x) \, dx \\ &= -x \cos(x) + \sin(x) + c \end{aligned} \]
Example 3: Calculate \( \displaystyle \int x^2 \cos x \, dx \)

Solution to Example 3:

Let \( u = x^2 \) and \( \dfrac{dv}{dx} = \cos(x) \), hence \( \dfrac{du}{dx} = 2x \) and \( v = \sin(x) \). Apply integration by parts:

\[ \int x^2 \cos(x) \, dx = x^2 \sin(x) - 2 \int x \sin(x) \, dx \qquad (I) \]

We now apply integration by parts to the remaining integral \( \displaystyle \int x \sin(x) \, dx \). As evaluated in Example 2, \( \displaystyle \int x \sin(x) \, dx = -x \cos(x) + \sin(x) \). Substituting this back:

\[ \begin{aligned} &= x^2 \sin(x) - 2(-x \cos(x) + \sin(x)) + c \\ &= x^2 \sin(x) + 2x \cos(x) - 2\sin(x) + c \end{aligned} \]
Example 4: Evaluate \( \displaystyle \int x \ln x \, dx \)

Solution to Example 4:

Let \( u = \ln(x) \) and \( \dfrac{dv}{dx} = x \), hence \( \dfrac{du}{dx} = \dfrac{1}{x} \) and \( v = \dfrac{x^2}{2} \). Apply integration by parts:

\[ \begin{aligned} \int x \ln x \, dx &= \dfrac{x^2}{2} \ln x - \int \dfrac{x^2}{2} \cdot \dfrac{1}{x} \, dx \\ &= \dfrac{x^2}{2} \ln x - \int \dfrac{x}{2} \, dx \\ &= \dfrac{x^2}{2} \ln x - \dfrac{1}{4} x^2 + c \end{aligned} \]
Example 5: Calculate \( \displaystyle \int x \cos \left(\dfrac{x}{3}\right) \, dx \)

Solution to Example 5:

Let \( u = x \) and \( \dfrac{dv}{dx} = \cos\left(\dfrac{x}{3}\right) \), hence \( \dfrac{du}{dx} = 1 \) and \( v = 3 \sin\left(\dfrac{x}{3}\right) \):

\[ \begin{aligned} \int x \cos \left(\dfrac{x}{3}\right) \, dx &= x \cdot 3 \sin \left(\dfrac{x}{3}\right) - \int 1 \cdot 3 \sin \left(\dfrac{x}{3}\right) dx \\ &= 3x \sin\left(\dfrac{x}{3}\right) - 3 \left( -3 \cos\left(\dfrac{x}{3}\right) \right) + c \\ &= 3x \sin\left(\dfrac{x}{3}\right) + 9 \cos\left(\dfrac{x}{3}\right) + c \end{aligned} \]
Example 6: Use integration by parts to evaluate \( \displaystyle \int \ln x \, dx \)

Solution to Example 6:

We first rewrite the integrand \( \ln(x) \) as \( 1 \cdot \ln(x) \):

\[ \int \ln(x) \, dx = \int 1 \cdot \ln(x) \, dx \]

Let \( u = \ln(x) \) and \( \dfrac{dv}{dx} = 1 \), hence \( \dfrac{du}{dx} = \dfrac{1}{x} \) and \( v = x \). Using integration by parts:

\[ \begin{aligned} \int 1 \cdot \ln(x) \, dx &= x \ln(x) - \int x \cdot \left(\dfrac{1}{x}\right) dx \\ &= x \ln(x) - \int 1 \, dx \\ &= x \ln(x) - x + c \end{aligned} \]
Example 7: Use integration by parts to evaluate \( \displaystyle \int x^2 (\ln x)^2 \, dx \)

Solution to Example 7:

Let \( \dfrac{dv}{dx} = x^2 \) and \( u = (\ln x)^2 \), hence \( v = \dfrac{x^3}{3} \) and \( \dfrac{du}{dx} = 2 \dfrac{\ln x}{x} \). Using integration by parts:

\[ \begin{aligned} \int x^2 (\ln x)^2 \, dx &= \dfrac{x^3}{3} (\ln x)^2 - \int \dfrac{x^3}{3} \left( 2 \dfrac{\ln x}{x} \right) dx \\ &= \dfrac{x^3}{3} (\ln x)^2 - \dfrac{2}{3} \int x^2 \ln x \, dx \end{aligned} \]

Now apply integration by parts a second time on \( \int x^2 \ln x \, dx \) (where \( w = \ln x, \dfrac{dz}{dx} = x^2 \implies w' = \dfrac{1}{x}, z = \dfrac{x^3}{3} \)):

\[ \begin{aligned} &= \dfrac{x^3}{3} (\ln x)^2 - \dfrac{2}{3} \left( \dfrac{x^3}{3} \ln x - \int \dfrac{x^3}{3} \cdot \dfrac{1}{x} \, dx \right) \\ &= \dfrac{x^3}{3} (\ln x)^2 - \dfrac{2}{9} x^3 \ln x + \dfrac{2}{9} \int x^2 \, dx \\ &= \dfrac{x^3}{3} (\ln x)^2 - \dfrac{2}{9} x^3 \ln x + \dfrac{2}{27} x^3 + c \end{aligned} \]
Example 8: Evaluate \( \displaystyle \int e^x \sin(2x) \, dx \)

Solution to Example 8:

Let \( I = \int e^x \sin(2x) \, dx \).

Let \( v = \sin(2x) \) and \( \dfrac{du}{dx} = e^x \), hence \( \dfrac{dv}{dx} = 2\cos(2x) \) and \( u = e^x \). Using integration by parts:

\[ \int e^x \sin(2x) \, dx = e^x \sin(2x) - \int e^x \cdot 2\cos(2x) \, dx \] \[ = e^x \sin(2x) - 2 \int e^x \cos(2x) \, dx \]

Now apply integration by parts again on \( \int e^x \cos(2x) \, dx \) (let \( w = \cos(2x), \dfrac{dz}{dx} = e^x \implies w' = -2\sin(2x), z = e^x \)):

\[ = e^x \sin(2x) - 2 \left( e^x \cos(2x) - \int e^x(-2\sin(2x)) \, dx \right) \] \[ = e^x \sin(2x) - 2e^x \cos(2x) - 4 \int e^x \sin(2x) \, dx \]

Since the integral on the right is \( I \), we have:

\[ I = e^x \sin(2x) - 2e^x \cos(2x) - 4I \]

Solving for \( I \):

\[ 5I = e^x \sin(2x) - 2e^x \cos(2x) \] \[ \int e^x \sin(2x) \, dx = \dfrac{e^x \sin(2x) - 2e^x \cos(2x)}{5} + c \]

Exercises

Use the table of integrals and the method of integration by parts to find the integrals below. [Note that you may need to use the method of integration by parts more than once].

  1. \( \displaystyle \int x \cos(x) \, dx \)
  2. \( \displaystyle \int x e^{2x} \, dx \)
  3. \( \displaystyle \int x^{1/3} \ln x \, dx \)
  4. \( \displaystyle \int \dfrac{\ln x}{x^2} \, dx \)
  5. \( \displaystyle \int x^3 \cos x \, dx \)
  6. \( \displaystyle \int x^2 e^{-3x} \, dx \)
  7. \( \displaystyle \int e^x \cos(2x) \, dx \)

Answers to Above Exercises

  1. \( x \sin(x) + \cos(x) + c \)
  2. \( \dfrac{x}{2} e^{2x} - \dfrac{1}{4} e^{2x} + c \)
  3. \( \dfrac{3}{4} x^{4/3} \ln(x) - \dfrac{9}{16} x^{4/3} + c \)
  4. \( -\dfrac{\ln x}{x} - \dfrac{1}{x} + c \)
  5. \( 3(x^2 - 2) \cos(x) + (x^3 - 6x) \sin(x) + c \)
  6. \( -\dfrac{1}{27} (9x^2 + 6x + 2) e^{-3x} + c \)
  7. \( \dfrac{1}{5} (e^x \cos(2x) + 2e^x \sin(2x)) + c \)

More References and Links