Main Content

integrateByParts

Integration by parts

Description

G = integrateByParts(F,du) applies integration by parts to the integrals in F, in which the differential 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.

example

Examples

collapse all

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

syms u(x) v(x)
F = int(u*diff(v))
F(x) = 

u(x)x v(x) dx

Apply integration by parts to F.

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

u(x)v(x)-v(x)x u(x) dx

Apply integration by parts to the integral x2exdx.

Define the integral using the int function. Show the result without evaluating the integral by setting the 'Hold' option to true.

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

x2ex 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))
G = 

x2ex-2xex dx

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

x2ex-2xex+2ex dx

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

F1 = release(H)
F1 = 2ex+x2ex-2xex

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))
F2 = exx2-2x+2

Apply integration by parts to the integral eaxsin(bx)dx.

Define the integral using the int function. Show the integral without evaluating it by setting the 'Hold' option to true.

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

eaxsin(bx) dx

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

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

eaxsin(bx)a-beaxcos(bx)a dx

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

F1 = release(G)
F1 = 

eaxsin(bx)a-beaxacos(bx)+bsin(bx)aa2+b2

Simplify the result.

F2 = simplify(F1)
F2 = 

-eaxbcos(bx)-asin(bx)a2+b2

Input Arguments

collapse all

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

Example: int(u*diff(v))

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

u'(x)v(x)dx=u(x)v(x)u(x)v'(x)dx

and for definite integrals as

abu'(x)v(x)dx=u(b)v(b)u(a)v(a)abu(x)v'(x)dx.

Version History

Introduced in R2019b