Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

4/2/24, 9:54 PM Integration by parts - MATLAB integrateByParts

integrateByParts
Integration by parts
Since R2019b

Syntax

G = integrateByParts(F,du)

Description
G = integrateByParts(F,du) applies integration by parts to the integrals in F, in which the differential example
du is integrated. For more information, see Integration by Parts.

When specifying the integrals in F, you can return the unevaluated form of the integrals by using the int
function with the 'Hold' option set to true. You can then use integrateByParts to show the steps of
integration by parts.

Examples collapse all

 Product of Functions

Create a symbolic expression F that is the integral of a product of functions.


Try This Example

 Copy Command

syms u(x) v(x)  Get


F = int(u*diff(v))

F(x) =

u( x) v( x) dx
∫ ∂x

Apply integration by parts to F.

g = integrateByParts(F,diff(u))  Get

g =

u( x) v( x) − v( x) u( x) dx
∫ ∂x

 Exponential Function

Apply integration by parts to the integral ∫ x


2 x
e dx .
Try This Example

https://www.mathworks.com/help/symbolic/sym.integratebyparts.html 1/5
4/2/24, 9:54 PM Integration by parts - MATLAB integrateByParts
Define the integral using the int function. Show the result without evaluating the
 Copy Command
integral by setting the 'Hold' option to true.

syms x  Get
F = int(x^2*exp(x),'Hold',true)

F =
2 x
x e dx

To show the steps of integration, apply integration by parts to F and use exp(x) as the differential to be integrated.

G = integrateByParts(F,exp(x))  Get

G =
2 x x
x e − 2 x e dx

H = integrateByParts(G,exp(x))  Get

H =
2 x x x
x e − 2 x e + 2e dx

Evaluate the integral in H by using the release function to ignore the 'Hold' option.

F1 = release(H)  Get

F1 = 2e
x
+ x
2
e
x
− 2 x e
x

Compare the result to the integration result returned by the int function without setting the 'Hold' option to true.

F2 = int(x^2*exp(x))  Get

F2 = e
x
(x
2
− 2 x + 2)

 Exponential and Trigonometric Functions

Apply integration by parts to the integral ∫ e


ax
sin(bx) dx .
Try This Example
Define the integral using the int function. Show the integral without evaluating it
by setting the 'Hold' option to true.
 Copy Command

syms x a b  Get
F = int(exp(a*x)*sin(b*x),'Hold',true)

F =
a x
e sin(b x) dx

https://www.mathworks.com/help/symbolic/sym.integratebyparts.html 2/5
4/2/24, 9:54 PM Integration by parts - MATLAB integrateByParts

To show the steps of integration, apply integration by parts to F and use u′( x) = e
ax
as the differential to be
integrated.

G = integrateByParts(F,exp(a*x))  Get

G =
a x a x
e sin(b x) be cos(b x)
− dx
a ∫ a

Evaluate the integral in G by using the release function to ignore the 'Hold' option.

F1 = release(G)  Get

F1 =
a x a x
e sin(b x) be (a cos(b x) + b sin(b x))

2 2
a a (a + b )

Simplify the result.

F2 = simplify(F1)  Get

F2 =
a x
e (b cos(b x) − a sin(b x))

2 2
a + b

Input Arguments collapse all

F — Expression containing integrals


 symbolic expression | symbolic function | symbolic vector | symbolic matrix

Expression containing integrals, specified as a symbolic expression, function, vector, or matrix.

Example: int(u*diff(v))

du — Differential to be integrated
 symbolic variable | symbolic expression | symbolic function

Differential to be integrated, specified as a symbolic variable, expression, or function.

Example: diff(u)

More About collapse all

 Integration by Parts
Mathematically, the rule of integration by parts is formally defined for indefinite integrals as

https://www.mathworks.com/help/symbolic/sym.integratebyparts.html 3/5
4/2/24, 9:54 PM Integration by parts - MATLAB integrateByParts

u′( x) v( x) dx = u( x) v( x) − u( x) v′( x) dx
∫ ∫

and for definite integrals as

b b

u′( x) v( x) dx = u(b) v(b) − u(a) v(a) − u( x) v′( x) dx.


∫ ∫
a a

Version History
Introduced in R2019b

See Also
changeIntegrationVariable | release | int | diff | vpaintegral

https://www.mathworks.com/help/symbolic/sym.integratebyparts.html 4/5
4/2/24, 9:54 PM Integration by parts - MATLAB integrateByParts

https://www.mathworks.com/help/symbolic/sym.integratebyparts.html 5/5

You might also like