Chapter VI · Derivatives and integrals

Integration by parts, and the general integral ∫R(x,X) dx\int R(x, \sqrt X)\,dx

§§141–142 40 min

The product rule read backwards, seen as two areas that fill a rectangle; its use for ∫X dx\int\sqrt{X}\,dx; and Hardy's plan for integrating any rational function of xx and the square root of a quadratic.

Why this matters

Substitution is the chain rule read backwards. Integration by parts is the product rule read backwards, and it is the second great tool of practical integration. It handles products such as xcos⁡xx\cos x and xnlog⁡xx^n\log x, it integrates inverse functions (next lesson), and it produces reduction formulas that step an integral down from one exponent to the next. In this lesson Hardy uses it to finish the integrals of §140, ∫t2±α2 dt\int\sqrt{t^2\pm\alpha^2}\,dt and ∫α2−t2 dt\int\sqrt{\alpha^2 - t^2}\,dt, and then sketches how every integral ∫R(x,ax2+2bx+c) dx\int R(x, \sqrt{ax^2+2bx+c})\,dx can be computed.

The idea

The product rule says (uv)′=u′v+uv′(uv)' = u'v + uv'. Integrating both sides,

uv=∫u′v dx+∫uv′ dx,that is∫u′v dx=uv−∫uv′ dx.uv = \int u'v\,dx + \int uv'\,dx, \qquad\text{that is}\qquad \int u'v\,dx = uv - \int uv'\,dx .

The integral we want, ∫u′v\int u'v, is traded for another one, ∫uv′\int uv', which we hope is easier. For ∫xcos⁡x dx\int x\cos x\,dx, take v=xv = x and u=sin⁡xu = \sin x: then u′=cos⁡xu' = \cos x, v′=1v' = 1, and

∫xcos⁡x dx=xsin⁡x−∫sin⁡x dx=xsin⁡x+cos⁡x.\int x\cos x\,dx = x\sin x - \int\sin x\,dx = x\sin x + \cos x .

There is a picture behind the formula. Plot the points (u,v)(u, v) as xx varies. Then ∫v du\int v\,du is the area under this curve and ∫u dv\int u\,dv the area to its left. Together they fill a rectangle of area uvuv (minus the small rectangle at the starting point).

Explore Two areas that fill a rectangle

Try this. The curve is (u,v)=(sin⁡x,x)(u, v) = (\sin x, x) for xx from 00 to bb. Its blue area is ∫v du=∫xcos⁡x dx\int v\,du = \int x\cos x\,dx, and its ochre area is ∫u dv=∫sin⁡x dx\int u\,dv = \int \sin x\,dx. Drag bb and watch both areas and the dashed rectangle. Then try the other examples.

∫v du+∫u dv=uv\int v\,du + \int u\,dv = uv
u = sin xv = x
  • area below the curve: ∫ v du
  • area left of the curve: ∫ u dv
  • rectangle u·v
Blue: ∫0bxcos⁡x dx≈0.4808\int_0^{b} x\cos x\,dx \approx 0.4808. Ochre: ∫0bsin⁡x dx=1−cos⁡b≈0.6376\int_0^{b} \sin x\,dx = 1 - \cos b \approx 0.6376. Together: 1.1181.118, and the rectangle is bsin⁡b=1.118b\sin b = 1.118. So ∫0bxcos⁡x dx=bsin⁡b+cos⁡b−1\int_0^b x\cos x\,dx = b\sin b + \cos b - 1.
What to notice

However the curve bends, the two areas always fill the rectangle u(b) v(b)u(b)\,v(b) exactly: that is integration by parts. If one area is easy to compute (here the ochre one, 1−cos⁡b1 - \cos b), the other follows by subtraction: ∫0bxcos⁡x dx=bsin⁡b−(1−cos⁡b)\int_0^b x\cos x\,dx = b\sin b - (1 - \cos b).

Precise statements

Theorem Integration by parts Hardy: §141

If ff and FF are differentiable, then

∫f′(x) F(x) dx=f(x) F(x)−∫f(x) F′(x) dx,\int f'(x)\,F(x)\,dx = f(x)\,F(x) - \int f(x)\,F'(x)\,dx ,

in the sense that if Ψ\Psi is an integral of fF′fF', then fF−ΨfF - \Psi is an integral of f′Ff'F.

Repeating the process gives a formula that Hardy records as Ex. XLIX. 10:

∫f(n)F dx=f(n−1)F−f(n−2)F′+⋯+(−1)n−1fF(n−1)+(−1)n∫fF(n) dx.\int f^{(n)}F\,dx = f^{(n-1)}F - f^{(n-2)}F' + \dots + (-1)^{n-1}fF^{(n-1)} + (-1)^n\int fF^{(n)}\,dx .

It is useful when FF is a polynomial: then F(n)F^{(n)} eventually vanishes and the last integral disappears.

Application to ∫y dx\int y\,dx, y=Xy = \sqrt X. Take f(x)=ax+bf(x) = ax + b and F(x)=yF(x) = y, so f′=af' = a and F′=(ax+b)/yF' = (ax + b)/y. Parts gives

a∫y dx=(ax+b)y−∫(ax+b)2y dx.a\int y\,dx = (ax + b)y - \int\frac{(ax+b)^2}{y}\,dx .

Now (ax+b)2=aX−(ac−b2)=ay2−(ac−b2)(ax + b)^2 = aX - (ac - b^2) = ay^2 - (ac - b^2), so the last integral is a∫y dx−(ac−b2)∫dx/ya\int y\,dx - (ac - b^2)\int dx/y. The unknown ∫y dx\int y\,dx appears on both sides, and we can solve for it:

Theorem The integral of ax2+2bx+c\sqrt{ax^2+2bx+c} Hardy: §141

With y=ax2+2bx+cy = \sqrt{ax^2 + 2bx + c} and a≠0a \ne 0,

∫y dx=(ax+b) y2a+ac−b22a∫dxy.\int y\,dx = \frac{(ax+b)\,y}{2a} + \frac{ac - b^2}{2a}\int\frac{dx}{y} .
Corollary Three standard forms with square roots Hardy: Examples XLIX, 1

For α>0\alpha > 0,

∫x2+α2 dx=12xx2+α2+12α2log⁡{x+x2+α2},∫x2−α2 dx=12xx2−α2−12α2log⁡∣x+x2−α2∣,∫α2−x2 dx=12xα2−x2+12α2arcsin⁡xα.\begin{aligned} \int\sqrt{x^2+\alpha^2}\,dx &= \tfrac12x\sqrt{x^2+\alpha^2} + \tfrac12\alpha^2\log\left\{x + \sqrt{x^2+\alpha^2}\right\},\\ \int\sqrt{x^2-\alpha^2}\,dx &= \tfrac12x\sqrt{x^2-\alpha^2} - \tfrac12\alpha^2\log\left|x + \sqrt{x^2-\alpha^2}\right|,\\ \int\sqrt{\alpha^2-x^2}\,dx &= \tfrac12x\sqrt{\alpha^2-x^2} + \tfrac12\alpha^2\arcsin\frac{x}{\alpha}. \end{aligned}

The general integral ∫R(x,X) dx\int R(x, \sqrt X)\,dx

§142 gives a plan for any real rational function RR of xx and X\sqrt X, X=ax2+2bx+cX = ax^2 + 2bx + c. It is constructive, but long, and we summarise it.

  1. Separate the square root. Since (X)2=X(\sqrt X)^2 = X is rational, any rational expression in xx and X\sqrt X can be written as E+FXE + F\sqrt X with E,FE, F rational in xx (multiply numerator and denominator by the “conjugate” C−DXC - D\sqrt X). The part EE is done by §133, and FX=FX/XF\sqrt X = FX/\sqrt X. So it is enough to integrate G/XG/\sqrt X with GG rational.
  2. Split GG into partial fractions. Three kinds of integral can appear.
    • (i) ∫xmX dx\displaystyle\int\frac{x^m}{\sqrt X}\,dx, m=0,1,2,…m = 0, 1, 2, \dots For m=0,1m = 0, 1 this was §139. For larger mm use the identity ddx(xm−1X)=ma xm+(2m−1)b xm−1+(m−1)c xm−2X,\frac{d}{dx}\left(x^{m-1}\sqrt X\right) = \frac{ma\,x^m + (2m-1)b\,x^{m-1} + (m-1)c\,x^{m-2}}{\sqrt X}, which links three consecutive integrals: a reduction formula. Starting from m=0,1m = 0, 1 we reach every mm.
    • (ii) ∫dx(x−p)mX\displaystyle\int\frac{dx}{(x-p)^m\sqrt X} with pp real: the substitution x−p=1/tx - p = 1/t turns it into an integral of type (i) in tt.
    • (iii) Terms from a pair of complex roots of the denominator of GG, such as ∫Lx+M(Ax2+2Bx+C)X dx\displaystyle\int\frac{Lx + M}{(Ax^2+2Bx+C)\sqrt X}\,dx. Hardy removes the cross terms of both quadratics at once by a substitution x=(μt+ν)/(t+1)x = (\mu t + \nu)/(t + 1), and then rationalises the two resulting integrals by t/γt2+δ=ut/\sqrt{\gamma t^2+\delta} = u and 1/γt2+δ=v1/\sqrt{\gamma t^2+\delta} = v.

So, in principle, every such integral can be expressed by algebraic functions, logarithms and inverse tangents. In practice one looks for shortcuts first.

Proofs

Proof Integration by parts
Strategy

Differentiate the proposed answer fF−ΨfF - \Psi, using the product rule.

Product rule

(fF)′=f′F+fF′(fF)' = f'F + fF' (§114).

Subtract Ψ\Psi

Since Ψ′=fF′\Psi' = fF', we get (fF−Ψ)′=f′F+fF′−fF′=f′F(fF - \Psi)' = f'F + fF' - fF' = f'F. So fF−ΨfF - \Psi is an integral of f′Ff'F.

Proof The integral of X\sqrt X
Strategy

Integrate by parts with f=ax+bf = ax + b and F=yF = y, rewrite (ax+b)2(ax+b)^2 in terms of y2y^2, and solve the resulting equation for the unknown integral.

Parts

F′=X′2y=ax+byF' = \dfrac{X'}{2y} = \dfrac{ax+b}{y}, so a∫y dx=(ax+b)y−∫(ax+b)2y dx\displaystyle a\int y\,dx = (ax+b)y - \int\frac{(ax+b)^2}{y}\,dx.

An identity

aX=a2x2+2abx+ac=(ax+b)2+(ac−b2)aX = a^2x^2 + 2abx + ac = (ax + b)^2 + (ac - b^2), so (ax+b)2=ay2−(ac−b2)(ax + b)^2 = ay^2 - (ac - b^2), and (ax+b)2y=ay−ac−b2y\dfrac{(ax+b)^2}{y} = ay - \dfrac{ac - b^2}{y}.

Substitute

a∫y dx=(ax+b)y−a∫y dx+(ac−b2)∫dxy\displaystyle a\int y\,dx = (ax + b)y - a\int y\,dx + (ac - b^2)\int\frac{dx}{y}.

Solve

Move a∫y dxa\int y\,dx to the left and divide by 2a2a. (Read as a statement about integrals: if Φ\Phi is an integral of 1/y1/y, the right-hand side with Φ\Phi in place of ∫dx/y\int dx/y has derivative yy, as differentiation confirms.)

The three standard forms follow by putting a=1a = 1, b=0b = 0, c=±α2c = \pm\alpha^2 (so ac−b2=±α2ac - b^2 = \pm\alpha^2) or a=−1a = -1, b=0b = 0, c=α2c = \alpha^2, and using §138. For α2−x2\sqrt{\alpha^2 - x^2}: (ax+b)y/2a=12xy(ax+b)y/2a = \tfrac12xy and (ac−b2)/2a=12α2(ac - b^2)/2a = \tfrac12\alpha^2.

Worked examples and exercises

Exercise The area of a circle, in advance ●●○ Hardy: Examples XLIX, 1

Derive ∫α2−x2 dx=12xα2−x2+12α2arcsin⁡(x/α)\int\sqrt{\alpha^2 - x^2}\,dx = \tfrac12x\sqrt{\alpha^2-x^2} + \tfrac12\alpha^2\arcsin(x/\alpha) directly by parts, without the general formula. What is the increase of this integral from x=−αx = -\alpha to x=αx = \alpha?

Hint
Take f(x)=xf(x) = x, F(x)=α2−x2F(x) = \sqrt{\alpha^2 - x^2}. Then ∫α2−x2=xα2−x2+∫x2α2−x2 dx\int\sqrt{\alpha^2-x^2} = x\sqrt{\alpha^2-x^2} + \int\dfrac{x^2}{\sqrt{\alpha^2-x^2}}\,dx.
Hint
Write x2=α2−(α2−x2)x^2 = \alpha^2 - (\alpha^2 - x^2) in the last numerator.

Solution

Let I=∫α2−x2 dxI = \int\sqrt{\alpha^2-x^2}\,dx. Parts with f=xf = x:

I=xα2−x2+∫x2 dxα2−x2=xα2−x2+α2∫dxα2−x2−I.I = x\sqrt{\alpha^2-x^2} + \int\frac{x^2\,dx}{\sqrt{\alpha^2-x^2}} = x\sqrt{\alpha^2-x^2} + \alpha^2\int\frac{dx}{\sqrt{\alpha^2-x^2}} - I .

So 2I=xα2−x2+α2arcsin⁡(x/α)2I = x\sqrt{\alpha^2-x^2} + \alpha^2\arcsin(x/\alpha), which is the formula. From −α-\alpha to α\alpha the first term vanishes at both ends and the second goes from −12π-\tfrac12\pi to 12π\tfrac12\pi, so the increase is 12πα2\tfrac12\pi\alpha^2. Once we know (§148) that this is the area under the semicircle, the area of the circle is πα2\pi\alpha^2.

Exercise A reduction formula at work ●●○ Hardy: §142 (i)

Find ∫x2 dxx2+1\displaystyle\int\frac{x^2\,dx}{\sqrt{x^2+1}}.

Hint
Use the identity for ddx(xm−1X)\dfrac{d}{dx}(x^{m-1}\sqrt X) with m=2m = 2, a=1a = 1, b=0b = 0, c=1c = 1.

Solution

With m=2m = 2: ddx(xx2+1)=2x2+1x2+1\dfrac{d}{dx}\left(x\sqrt{x^2+1}\right) = \dfrac{2x^2 + 1}{\sqrt{x^2+1}}. Hence

∫x2 dxx2+1=12(xx2+1−∫dxx2+1)=12xx2+1−12log⁡{x+x2+1}.\int\frac{x^2\,dx}{\sqrt{x^2+1}} = \frac12\left(x\sqrt{x^2+1} - \int\frac{dx}{\sqrt{x^2+1}}\right) = \tfrac12x\sqrt{x^2+1} - \tfrac12\log\left\{x + \sqrt{x^2+1}\right\}.

Check: the derivative is 2x2+12x2+1−12x2+1=x2x2+1\dfrac{2x^2+1}{2\sqrt{x^2+1}} - \dfrac{1}{2\sqrt{x^2+1}} = \dfrac{x^2}{\sqrt{x^2+1}}.

Exercise A linear factor outside the root ●●○ Hardy: §142 (ii)

Find ∫dxxx2+1\displaystyle\int\frac{dx}{x\sqrt{x^2+1}} for x>0x > 0, by putting x=1/tx = 1/t.

Hint
dx=−dt/t2dx = -dt/t^2 and x2+1=1+t2/t\sqrt{x^2+1} = \sqrt{1+t^2}/t for t>0t > 0.

Solution

The integrand times dx/dtdx/dt is t⋅t1+t2⋅(−1t2)=−11+t2\dfrac{t\cdot t}{\sqrt{1+t^2}}\cdot\left(-\dfrac{1}{t^2}\right) = -\dfrac{1}{\sqrt{1+t^2}}. So the integral is −log⁡{t+1+t2}-\log\{t + \sqrt{1+t^2}\}, and with t=1/xt = 1/x,

∫dxxx2+1=−log⁡1+1+x2x.\int\frac{dx}{x\sqrt{x^2+1}} = -\log\frac{1 + \sqrt{1+x^2}}{x} .
Exercise A neat closed form ●●○ Hardy: Examples L, 2

Let p≠qp \ne q. Prove that for xx greater than both pp and qq,

∫dx(x−p)(x−p)(x−q)=2q−px−qx−p.\int\frac{dx}{(x-p)\sqrt{(x-p)(x-q)}} = \frac{2}{q-p}\sqrt{\frac{x-q}{x-p}} .
Hint
Differentiating the right side is quickest. Write w=(x−q)/(x−p)w = (x-q)/(x-p); then w′=(q−p)/(x−p)2w' = (q-p)/(x-p)^2.
Solution

With w=x−qx−p>0w = \dfrac{x-q}{x-p} > 0 we have w′=(x−p)−(x−q)(x−p)2=q−p(x−p)2w' = \dfrac{(x-p) - (x-q)}{(x-p)^2} = \dfrac{q - p}{(x-p)^2}. So

ddx{2q−pw}=2q−p⋅w′2w=1(x−p)2x−px−q=1(x−p)(x−p)(x−q).\frac{d}{dx}\left\{\frac{2}{q-p}\sqrt w\right\} = \frac{2}{q-p}\cdot\frac{w'}{2\sqrt w} = \frac{1}{(x-p)^2}\sqrt{\frac{x-p}{x-q}} = \frac{1}{(x-p)\sqrt{(x-p)(x-q)}} .

(The last step uses x−p>0x - p > 0.) To find the answer rather than check it, use §142 (ii): x−p=1/tx - p = 1/t reduces the integral to −∫dt/1+(p−q)t-\int dt/\sqrt{1 + (p - q)t}, an elementary integral.

Exercise Repeated integration by parts ●●○ Hardy: Examples XLIX, 10

Use the formula for ∫f(n)F dx\int f^{(n)}F\,dx with F(x)=x2F(x) = x^2 to find ∫x2cos⁡x dx\int x^2\cos x\,dx.

Hint
Take n=3n = 3, so that F′′′=0F''' = 0 and no integral is left. You need f′′′=cos⁡xf''' = \cos x: work backwards, f′′=sin⁡xf'' = \sin x, f′=−cos⁡xf' = -\cos x, f=−sin⁡xf = -\sin x.

Solution

With f′′=sin⁡xf'' = \sin x, f′=−cos⁡xf' = -\cos x, f=−sin⁡xf = -\sin x and F=x2F = x^2, F′=2xF' = 2x, F′′=2F'' = 2, F′′′=0F''' = 0, the formula for n=3n = 3 reads ∫f′′′F=f′′F−f′F′+fF′′−∫fF′′′\int f'''F = f''F - f'F' + fF'' - \int fF''', so

∫x2cos⁡x dx=x2sin⁡x+2xcos⁡x−2sin⁡x.\int x^2\cos x\,dx = x^2\sin x + 2x\cos x - 2\sin x .

Check: the derivative is 2xsin⁡x+x2cos⁡x+2cos⁡x−2xsin⁡x−2cos⁡x=x2cos⁡x2x\sin x + x^2\cos x + 2\cos x - 2x\sin x - 2\cos x = x^2\cos x.

Exercise ∫dx/y3\int dx/y^3 ●○○ Hardy: Examples XLIX, 3

With y2=ax2+2bx+cy^2 = ax^2 + 2bx + c and Δ=ac−b2≠0\Delta = ac - b^2 \ne 0, verify that ∫dxy3=ax+bΔy\displaystyle\int\frac{dx}{y^3} = \frac{ax+b}{\Delta y}.

Hint
Differentiate (ax+b)/y(ax+b)/y by the quotient rule, using y′=(ax+b)/yy' = (ax+b)/y.

Solution

ddxax+by=ay−(ax+b)y′y2=ay2−(ax+b)2y3=Δy3\dfrac{d}{dx}\dfrac{ax+b}{y} = \dfrac{ay - (ax+b)y'}{y^2} = \dfrac{ay^2 - (ax+b)^2}{y^3} = \dfrac{\Delta}{y^3}, using ay2−(ax+b)2=ac−b2ay^2 - (ax+b)^2 = ac - b^2 from the proof above. Divide by Δ\Delta.

Check yourself

Check yourself Choose one

To find ∫xlog⁡x dx\int x\log x\,dx by parts (x>0x > 0), which choice works?

Why

With F=log⁡xF = \log x, f′=xf' = x: ∫xlog⁡x=12x2log⁡x−∫12x2⋅1x dx=12x2log⁡x−14x2\int x\log x = \tfrac12x^2\log x - \int\tfrac12x^2\cdot\tfrac1x\,dx = \tfrac12x^2\log x - \tfrac14x^2. The other choice needs ∫log⁡x\int\log x first and leaves a harder integral. The rule of thumb: differentiate the factor that gets simpler (logarithms, inverse functions, polynomials).

Check yourself Enter a number

Using ∫xcos⁡x dx=xsin⁡x+cos⁡x\int x\cos x\,dx = x\sin x + \cos x, find the increase of this integral from 00 to 12π\tfrac12\pi (to three decimals). Check it in the widget with bb at its maximum.

Why

At 12π\tfrac12\pi: 12π+0\tfrac12\pi + 0; at 00: 0+10 + 1. The increase is 12π−1≈0.5708\tfrac12\pi - 1 \approx 0.5708.

Check yourself True or false?

Integration by parts always replaces an integral by a simpler one.

Why

False. It replaces ∫f′F\int f'F by ∫fF′\int fF', which may be harder (try ∫xcos⁡x\int x\cos x with F=cos⁡xF = \cos x: you get ∫12x2sin⁡x\int\tfrac12x^2\sin x). Sometimes it returns the same integral, which can be useful: in the derivation of ∫X\int\sqrt X we solved an equation for the unknown integral.

Check yourself Choose one

The reduction identity of §142 with m=3m = 3 relates which integrals Ik=∫xk/X dxI_k = \int x^k/\sqrt X\,dx?

Why

ddx(x2X)=3ax3+5bx2+2cxX\dfrac{d}{dx}(x^2\sqrt X) = \dfrac{3ax^3 + 5bx^2 + 2cx}{\sqrt X}, so x2X=3aI3+5bI2+2cI1x^2\sqrt X = 3aI_3 + 5bI_2 + 2cI_1: three consecutive integrals. Knowing I0I_0 and I1I_1, we get I2I_2 from m=2m = 2, then I3I_3 from m=3m = 3.

Hardy’s language

Summary

Summary
  • Integration by parts: ∫f′F=fF−∫fF′\int f'F = fF - \int fF', the product rule backwards. Picture: the area under a curve plus the area to its left fill a rectangle.
  • Choose FF to be the factor that gets simpler when differentiated; repeat as needed.
  • Parts can produce an equation for the unknown integral; solving it gives ∫ax2+2bx+c dx\int\sqrt{ax^2+2bx+c}\,dx and the three standard forms with x2±α2\sqrt{x^2\pm\alpha^2}, α2−x2\sqrt{\alpha^2-x^2}.
  • Every ∫R(x,X) dx\int R(x, \sqrt X)\,dx reduces to integrals of xm/Xx^m/\sqrt X (reduction formula), of 1/{(x−p)mX}1/\{(x-p)^m\sqrt X\} (substitute x−p=1/tx - p = 1/t), and of quadratic-denominator terms (Hardy’s substitution).