Professional Documents
Culture Documents
Integration by Parts - MATLAB integrateByParts
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.
Product of Functions
Copy Command
F(x) =
∂
u( x) v( x) dx
∫ ∂x
g = integrateByParts(F,diff(u)) Get
g =
∂
u( x) v( x) − v( x) u( x) dx
∫ ∂x
Exponential Function
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)
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 )
F2 = simplify(F1) Get
F2 =
a x
e (b cos(b x) − a sin(b x))
−
2 2
a + b
Example: int(u*diff(v))
du — Differential to be integrated
symbolic variable | symbolic expression | symbolic function
Example: diff(u)
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
∫ ∫
b b
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