Integration by parts is the antiderivative of the product rule:
Out[]=
∂(f(x)g(x))
∂x
g(x)
′
f
(x)+f(x)
′
g
(x)
So we have:
Out[]=
f(x)g(x)∫g(x)
′
f
(x)x+∫f(x)
′
g
(x)x
Sometimes it is easier to integrate
f(x)g'(x)
rather than
g(x)f'(x)
. And a single term like
log(x)
can always be written as a product
1·log(x)
and then integration by parts can be applied.
The focus is on understanding integration by parts for rookies.
What is the definite integral of
log(x)
from 0 to 2 using integration by parts?
In[]:=
IntegrationByParts[1,Log[x],{x,0,2}]
Integration by parts:
2
∫
0
Log[x]x=xLog[x]
2

0
-
2
∫
0
1x
f=1x, g=Log[x], f=x, g=
1
x
x
Out[]=
2
∫
0
log(x)x2log(2)-
2
∫
0
1x2log(2)-2
Compare with:
Out[]=
2
∫
0
log(x)xlog(4)-2
What is the definite integral of
xcos(x)
from 0 to
π/2
using integration by parts?
In[]:=
IntegrationByParts[Cos[x],x,{x,0,π/2}]
Integration by parts:
π
2
∫
0
xCos[x]x=xSin[x]
π
2

0
-
π
2
∫
0
Sin[x]x
f=Cos[x]x, g=x, f=Sin[x], g=1x
Out[]=
π
2
∫
0
xcos(x)x
π
2
-
π
2
∫
0
sin(x)x
π
2
-1
Of course
π/2
∫
0
sin(x)x=-cos(π/2)+cos(0)=1
Compare with:
Out[]=
π
2
∫
0
xcos(x)x
1
2
(π-2)
What is the indefinite integral of
log(x)
?
In[]:=
IntegrationByParts[1,Log[x],x]
Integration by parts: ∫gf=fg-∫fg
f=1x, g=Log[x], f=x, g=
1
x
x
Out[]=
∫log(x)xxlog(x)-∫1x
And of course
∫1x=x
.
Compare with:
Out[]=
∫log(x)xxlog(x)-x
What is the indefinite integral of
xcos(x)
?
In[]:=
IntegrationByParts[Cos[x],x,x]
Integration by parts: ∫gf=fg-∫fg
f=Cos[x]x, g=x, f=Sin[x], g=1x
Out[]=
∫xcos(x)xxsin(x)-∫sin(x)x
Of course
∫sin(x)x=-cos(x)
.
Compare with:
Out[]=
∫xcos(x)xxsin(x)+cos(x)
What is the indefinite integral of
log(x)
x
?
In[]:=
IntegrationByParts[1/x,Log[x],x]
Integration by parts: ∫gf=fg-∫fg
f=
1
x
x, g=Log[x], f=Log[x], g=
1
x
x
Out[]=

log(x)
x
x
2
log
(x)-
log(x)
x
x
Compare with:
Out[]=

log(x)
x
x
2
log
(x)
2
What is the indefinite integral of
2
sin(x)
?
In[]:=
IntegrationByParts[Sin[x],Sin[x],x]
Integration by parts: ∫gf=fg-∫fg
f=Sin[x]x, g=Sin[x], f=-Cos[x], g=Cos[x]x
Out[]=
∫
2
sin
(x)xsin(x)(-cos(x))-∫-
2
cos
(x)x
We have
∫
2
cos(x)
x=∫1-
2
sin(x)
x=x-∫
2
sin(x)
x
.So
∫
2
sin(x)
x=-cos(x)sin(x)+x-∫
2
sin(x)
x
Compare with:
Out[]=
∫
2
sin
(x)x
x
2
-
1
4
sin(2x)
And with TrigExpand:
Out[]=
∫
2
sin
(x)x
x
2
-
1
2
sin(x)cos(x)
What is the indefinite integral of
2
log(x)
?
In[]:=
IntegrationByParts[Log[x],Log[x],x]
Integration by parts: ∫gf=fg-∫fg
f=Log[x]x, g=Log[x], f=-x+xLog[x], g=
1
x
x
Out[]=
∫
2
log
(x)xx(log(x)-1)log(x)-∫(log(x)-1)x
And from above
∫log(x)=xlog(x)-x
and
∫1x=x
.Adding up to
∫
2
log(x)
x=x(log(x)-1)log(x)+x-(xlog(x)-x)
:
In[]:=
Expand[x(Log[x]-1)Log[x]-(-x+(xLog[x]-x))]
Out[]=
2x-2xLog[x]+x
2
Log[x]
Compare with:
Out[]=
∫
2
log
(x)x2x+x
2
log
(x)-2xlog(x)

Initializations


CITE THIS NOTEBOOK

Integration by parts for rookies​
by Oliver Seipel​
Wolfram Community, STAFF PICKS, May 26, 2023
​https://community.wolfram.com/groups/-/m/t/2925829