Integration by parts in a loop

Integrate by parts twice and the integral you started with comes back. Treat it as an unknown and solve for it.

Level: STEP 2. Uses A-level Mathematics only.

The idea

Integration by parts usually trades an integral for a simpler one. Sometimes, after two rounds, it trades the integral for itself. That looks like going round in a circle, but it is not: the integral reappears with a different coefficient, so you get an equation that you can solve for it.

Example 1: an exponential times a sine

Find

I=∫exsin⁡x dx.I=\int e^x\sin x\,dx .

Integrate by parts, differentiating the sine and integrating the exponential:

I=exsin⁡x−∫excos⁡x dx.I=e^x\sin x-\int e^x\cos x\,dx .

The new integral is no simpler, so do the same again, still differentiating the trigonometric factor:

∫excos⁡x dx=excos⁡x+∫exsin⁡x dx=excos⁡x+I.\begin{aligned}\int e^x\cos x\,dx&=e^x\cos x+\int e^x\sin x\,dx\\&=e^x\cos x+I .\end{aligned}

Substituting back,

I=exsin⁡x−excos⁡x−I.I=e^x\sin x-e^x\cos x-I .

Now II appears on both sides with different coefficients, so collect it:

I=12ex(sin⁡x−cos⁡x)+C.I=\frac12e^x(\sin x-\cos x)+C .

Why it works, and how it fails

The exponential integrates to itself, and the sine differentiates to a cosine and then back to minus a sine. After two steps, both factors are back where they started, apart from a sign. That sign is what makes the coefficient of II change, so that the equation can be solved.

The one way to go wrong is to swap roles in the second step. If you integrate the trigonometric factor and differentiate the exponential the second time, you simply undo the first step and arrive at the true but useless statement I=II=I. Keep the same choice both times.

Example 2: the cube of secant

Find

J=∫sec⁡3x dx.J=\int\sec^3x\,dx .

Write sec⁡3x=sec⁡x⋅sec⁡2x\sec^3x=\sec x\cdot\sec^2x, and integrate sec⁡2x\sec^2x (to tan⁡x\tan x) while differentiating sec⁡x\sec x (to sec⁡xtan⁡x\sec x\tan x):

J=sec⁡xtan⁡x−∫sec⁡xtan⁡2x dx.J=\sec x\tan x-\int\sec x\tan^2x\,dx .

The loop closes through an identity rather than a second integration by parts. Using tan⁡2x=sec⁡2x−1\tan^2x=\sec^2x-1,

∫sec⁡xtan⁡2x dx=∫sec⁡3x dx−∫sec⁡x dx=J−ln⁡∣sec⁡x+tan⁡x∣.\begin{aligned}\int\sec x\tan^2x\,dx&=\int\sec^3x\,dx-\int\sec x\,dx\\&=J-\ln\lvert\sec x+\tan x\rvert .\end{aligned}

So

J=sec⁡xtan⁡x−J+ln⁡∣sec⁡x+tan⁡x∣,J=\sec x\tan x-J+\ln\lvert\sec x+\tan x\rvert ,

and

J=12(sec⁡xtan⁡x+ln⁡∣sec⁡x+tan⁡x∣)+C.\begin{aligned}J&=\frac12\Bigl(\sec x\tan x+\ln\lvert\sec x+\tan x\rvert\Bigr)+C .\end{aligned}

When to reach for it

  • A product of an exponential with a sine or cosine.
  • Odd powers of sec⁡x\sec x, where an identity brings the original integral back.
  • Any integration by parts that leaves an integral "of the same kind" as the one you started with. Before giving up, check whether it is a multiple of the original.

Try this

Show that

∫0π/2e2xcos⁡x dx=eπ−25.\int_0^{\pi/2}e^{2x}\cos x\,dx=\frac{e^{\pi}-2}{5}.
Hint

Integrate by parts twice, differentiating the cosine each time and integrating e2xe^{2x}. You should reach an equation of the form K=A−14KK=A-\tfrac14K.

Solution

Let KK be the integral. Integrating e2xe^{2x} to 12e2x\tfrac12e^{2x} each time,

K=[12e2xcos⁡x]0π/2+12∫0π/2e2xsin⁡x dx=−12+12∫0π/2e2xsin⁡x dx.\begin{aligned}K&=\Bigl[\tfrac12e^{2x}\cos x\Bigr]_0^{\pi/2}+\frac12\int_0^{\pi/2}e^{2x}\sin x\,dx\\&=-\frac12+\frac12\int_0^{\pi/2}e^{2x}\sin x\,dx .\end{aligned}

Again,

∫0π/2e2xsin⁡x dx=[12e2xsin⁡x]0π/2−12K=12eπ−12K.\begin{aligned}\int_0^{\pi/2}e^{2x}\sin x\,dx&=\Bigl[\tfrac12e^{2x}\sin x\Bigr]_0^{\pi/2}-\frac12K\\&=\frac12e^{\pi}-\frac12K .\end{aligned}

So

K=−12+14eπ−14K,K=-\frac12+\frac14e^{\pi}-\frac14K ,

which gives 54K=14eπ−12\tfrac54K=\tfrac14e^{\pi}-\tfrac12, and K=eπ−25K=\dfrac{e^{\pi}-2}{5}.

Want more like this? STEP 2 Pure: Practice Paper 1 teaches ideas of this kind in depth, with exercises and a full STEP question. The STEP Starter Pack has all four modules and three practice papers. Or start free with the STEP sample question.