Integration by Parts: Formula and Step-by-Step Examples

Integration by parts is one of the main methods used to evaluate indefinite integrals. It is used when the integrand contains a product of functions or can conveniently be rewritten as one. The goal of the method is simple: to replace the original integral with another one that is easier to evaluate.

The main formula follows directly from the product rule for differentiation. Therefore, we will first see how this formula is derived. Then, we will consider how to choose its components correctly.

The Formula: How Integration by Parts Is Derived

Consider the integral

\[
\int u(x)\cdot v'(x)\,dx.
\]

To transform it, we use the product rule for differentiation:

\[
\left(u(x)\cdot v(x)\right)’
=
u'(x)\cdot v(x)
+
u(x)\cdot v'(x).
\]

The right-hand side of this equation contains the expression \( u(x)\cdot v'(x) \), which appears in the original integral. Let us express it in terms of the other components:

\[
u(x)\cdot v'(x)
=
\left(u(x)\cdot v(x)\right)’

v(x)\cdot u'(x).
\]

Now integrate both sides of the equation:

\[
\int u(x)\cdot v'(x)\,dx
=
\int
\left(u(x)\cdot v(x)\right)’
\,dx

\int v(x)\cdot u'(x)\,dx.
\]

Integration recovers a function from its derivative up to an arbitrary constant. The constants of integration that appear during the transformations are combined into a single arbitrary constant \( C \). Therefore,

\[
\int u(x)\cdot v'(x)\,dx
=
u(x)\cdot v(x)

\int v(x)\cdot u'(x)\,dx.
\]

This is the main formula for integration by parts. It is usually written in the shorter differential form:

\[
\int u\,dv
=
u\cdot v

\int v\,du.
\]

Here,

\[
du=u'(x)\,dx,
\qquad
dv=v'(x)\,dx.
\]

After evaluating the indefinite integral, an arbitrary constant \( C \) is added to the result.

Choosing the Components: How to Prepare the Integrand

To use the formula we have derived, we need to identify \( u \) and \( dv \). The function \( u \) is differentiated:

\[
du=u'(x)\,dx.
\]

The expression \( dv \), on the other hand, is integrated:

\[
v=\int dv.
\]

When finding \( v \), the constant of integration is omitted.

In general, \( u \) should be a function whose derivative has a simpler form. The other part of the integrand, together with \( dx \), is chosen as \( dv \) if it can be integrated easily. A good choice is one that makes the integral

\[
\int v\,du
\]

simpler than the original integral.

Consider the integral

\[
\int x^2\cdot\ln(x)\,dx.
\]

It is reasonable to choose the logarithmic function as \( u \) because its derivative has a simpler form:

\[
u=\ln(x),
\qquad
du=\frac{1}{x}\,dx.
\]

For \( dv \), we choose the power function together with the differential \( dx \):

\[
dv=x^2\,dx.
\]

Then,

\[
v
=
\int x^2\,dx
=
\frac{x^3}{3}.
\]

Would the opposite choice be convenient? Suppose that

\[
u=x^2,
\qquad
dv=\ln(x)\,dx.
\]

In this case, to find \( v \), we would need to evaluate the integral

\[
v=\int\ln(x)\,dx.
\]

However, this integral itself requires integration by parts. Therefore, the opposite choice does not simplify the original problem.

Practical Part: Integration by Parts in Examples

The best way to learn how to choose the components correctly is to work through specific integrals. Let us consider problems of varying difficulty and see how the original integral is gradually transformed into a simpler one. In some cases, the method only needs to be applied once, while in others it must be applied repeatedly.

Example 1. Find the indefinite integral
\[
\int x\cdot e^x\,dx.
\]

It is reasonable to choose \( x \) as \( u \) because its derivative is \( 1 \):

\[
u=x,
\qquad
du=dx.
\]

For \( dv \), we choose the exponential function together with \( dx \):

\[
dv=e^x\,dx.
\]

Let us find \( v \):

\[
v
=
\int e^x\,dx
=
e^x.
\]

Substitute the chosen components into the integration by parts formula:

\[
\int x\cdot e^x\,dx
=
x\cdot e^x

\int e^x\,dx.
\]

The integral on the right-hand side is a standard integral:

\[
\int e^x\,dx
=
e^x.
\]

Therefore,

\[
\int x\cdot e^x\,dx
=
x\cdot e^x-e^x+C.
\]

Factor out \( e^x \):

\[
\int x\cdot e^x\,dx
=
e^x\cdot(x-1)+C.
\]

Example 2. Find the indefinite integral
\[
\int x\cdot\cos(3\cdot x)\,dx.
\]

Let us choose \( x \) as \( u \):

\[
u=x,
\qquad
du=dx.
\]

For \( dv \), we choose the trigonometric function together with \( dx \):

\[
dv=\cos(3\cdot x)\,dx.
\]

When finding \( v \), we need to take the coefficient \( 3 \) in the cosine argument into account:

\[
v
=
\int\cos(3\cdot x)\,dx
=
\frac{1}{3}\cdot\sin(3\cdot x).
\]

Substitute the chosen components into the formula:

\[
\int x\cdot\cos(3\cdot x)\,dx
=
\frac{x}{3}\cdot\sin(3\cdot x)

\frac{1}{3}\int\sin(3\cdot x)\,dx.
\]

Since

\[
\int\sin(3\cdot x)\,dx
=
-\frac{1}{3}\cdot\cos(3\cdot x),
\]

we obtain

\[
\int x\cdot\cos(3\cdot x)\,dx
=
\frac{x}{3}\cdot\sin(3\cdot x)

\frac{1}{3}\cdot
\left(
-\frac{1}{3}\cdot\cos(3\cdot x)
\right)
+
C.
\]

After simplifying, we get

\[
\int x\cdot\cos(3\cdot x)\,dx
=
\frac{x}{3}\cdot\sin(3\cdot x)
+
\frac{1}{9}\cdot\cos(3\cdot x)
+
C.
\]

Example 3. Find the indefinite integral
\[
\int\ln(x)\,dx.
\]

A product of two functions does not appear explicitly in this integral. However, the logarithmic function can be treated as the product

\[
\ln(x)\cdot 1.
\]

Let us choose the logarithmic function as \( u \):

\[
u=\ln(x),
\qquad
du=\frac{1}{x}\,dx.
\]

The second factor is \( 1 \), so together with the differential it gives

\[
dv=dx.
\]

Let us find \( v \):

\[
v
=
\int dx
=
x.
\]

Substitute the chosen components into the formula:

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

\int x\cdot\frac{1}{x}\,dx.
\]

Since

\[
x\cdot\frac{1}{x}=1,
\]

we obtain

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

\int dx.
\]

Therefore,

\[
\int\ln(x)\,dx
=
x\cdot\ln(x)-x+C.
\]

This formula is valid for \(x>0\), since \(\ln(x)\) is defined only for positive real values of \(x\).

Example 4. Find the indefinite integral
\[
\int x\cdot\arctan(x)\,dx.
\]

It is reasonable to choose \( \arctan(x) \) as \( u \) because its derivative has a rational form:

\[
u=\arctan(x),
\qquad
du=\frac{1}{1+x^2}\,dx.
\]

For \( dv \), we choose the power function together with \( dx \):

\[
dv=x\,dx.
\]
Then,
\[
v
=
\int x\,dx
=
\frac{x^2}{2}.
\]

Substitute the chosen components into the formula:

\[
\int x\cdot\arctan(x)\,dx
=
\frac{x^2}{2}\cdot\arctan(x)

\frac{1}{2}
\int
\frac{x^2}{1+x^2}\,dx.
\]

The new integral can be simplified. Rewrite the numerator as

\[
x^2
=
1+x^2-1.
\]

Then,

\[
\frac{x^2}{1+x^2}
=
\frac{1+x^2-1}{1+x^2}
=
1-\frac{1}{1+x^2}.
\]

This decomposition turns the new integral into a combination of standard integrals. Therefore,

\[
\int x\cdot\arctan(x)\,dx
=
\frac{x^2}{2}\cdot\arctan(x)

\frac{1}{2}
\int
\left(
1-\frac{1}{1+x^2}
\right)
dx.
\]

Separate the integral:

\[
\int x\cdot\arctan(x)\,dx
=
\frac{x^2}{2}\cdot\arctan(x)

\frac{1}{2}\int dx
+
\frac{1}{2}
\int
\frac{1}{1+x^2}\,dx.
\]

Evaluate the standard integrals:

\[
\int dx=x,
\qquad
\int\frac{1}{1+x^2}\,dx=\arctan(x).
\]

Therefore,

\[
\int x\cdot\arctan(x)\,dx
=
\frac{x^2}{2}\cdot\arctan(x)

\frac{x}{2}
+
\frac{1}{2}\cdot\arctan(x)
+
C.
\]

Combine the terms containing \( \arctan(x) \):

\[
\int x\cdot\arctan(x)\,dx
=
\frac{x^2+1}{2}\cdot\arctan(x)

\frac{x}{2}
+
C.
\]

Example 5. Find the indefinite integral
\[
\int e^x\cdot\sin(x)\,dx.
\]

In this case, integration by parts must be applied twice. Denote the original integral by \( I \):

\[
I
=
\int e^x\cdot\sin(x)\,dx.
\]

We will not write the arbitrary constant during the intermediate transformations. It will be added to the final result.

Let us choose the trigonometric function as \( u \):

\[
u=\sin(x),
\qquad
du=\cos(x)\,dx.
\]

For \( dv \), we choose the exponential function together with \( dx \):

\[
dv=e^x\,dx,
\qquad
v=e^x.
\]

After applying the method for the first time, we obtain

\[
I
=
e^x\cdot\sin(x)

\int e^x\cdot\cos(x)\,dx.
\]

We will evaluate the new integral by parts as well. Denote it by \( J \):

\[
J
=
\int e^x\cdot\cos(x)\,dx.
\]

For the integral \( J \), choose

\[
\begin{gathered}
u=\cos(x),
\qquad
du=-\sin(x)\,dx,\\[4pt]
dv=e^x\,dx,
\qquad
v=e^x.
\end{gathered}
\]

Then,

\[
J
=
e^x\cdot\cos(x)

\int e^x\cdot\left(-\sin(x)\right)\,dx.
\]

The minus sign before the integral and the minus sign in the expression for \( du \) produce a plus sign:

\[
J
=
e^x\cdot\cos(x)
+
\int e^x\cdot\sin(x)\,dx.
\]

The last integral is the same as the original integral \( I \). Therefore, it does not need to be evaluated separately:

\[
J
=
e^x\cdot\cos(x)+I.
\]

Substitute this expression into the original equation:

\[
I
=
e^x\cdot\sin(x)

\left(
e^x\cdot\cos(x)+I
\right).
\]

Expand the parentheses:

\[
I
=
e^x\cdot\sin(x)

e^x\cdot\cos(x)

I.
\]

Now the integral \( I \) can be treated as an unknown quantity. Move \( -I \) to the left-hand side:

\[
2\cdot I
=
e^x\cdot\sin(x)

e^x\cdot\cos(x).
\]

Factor out \( e^x \):

\[
2\cdot I
=
e^x\cdot
\left(
\sin(x)-\cos(x)
\right).
\]

Divide both sides of the equation by \( 2 \):

\[
I
=
\frac{e^x}{2}\cdot
\left(
\sin(x)-\cos(x)
\right).
\]

Therefore,

\[
\int e^x\cdot\sin(x)\,dx
=
\frac{e^x}{2}\cdot
\left(
\sin(x)-\cos(x)
\right)
+
C.
\]

Next Step: Topics for Further Study

Integration by parts is only one of the methods used to evaluate integrals. What should you study next? The following topics will help you understand other common types of integrands.

  1. Integrating Rational Functions: Partial Fraction Decomposition β€” This article will explain how to decompose rational functions into simpler fractions and evaluate the resulting integrals step by step.
  2. Integrals of Trigonometric Functions: Main Methods β€” This material will explore how to integrate products and powers of trigonometric functions using identities and algebraic transformations.
  3. Integrals Involving Radicals: Common Substitutions β€” This article will show how suitable substitutions can simplify expressions containing radicals and reduce them to familiar integrals.

Integration by Parts: From Flowchart to Code

Do you enjoy programming? Then try implementing the algorithm shown in the flowchart using your favorite programming language. The program should evaluate the antiderivative you found, approximate its derivative, and compare the result with the original integrand.

Pascal, Python, JavaScript, or C++β€”the choice is yours. This way, you can verify the result and see how a sequence of mathematical calculations is transformed into a programming algorithm.

Flowchart of the algorithm for checking an antiderivative found using integration by parts