Chapter VI · Derivatives and integrals

Repeated differentiation

§121 30 min

Second and higher derivatives, the few functions whose nth derivative has a closed form, and Leibniz’s theorem for the nth derivative of a product.

Why this matters

The derivative ϕ′\phi' is a function, so we can ask whether it has a derivative. Repeating the process gives the second derivative ϕ′′\phi'', the third, and in general the nnth, ϕ(n)\phi^{(n)}. Second derivatives measure how the slope changes: acceleration in dynamics, bending in geometry, and in §124 they give a test for maxima and minima. The whole sequence of derivatives at a point is the raw material of Taylor’s theorem in Chapter VII. §121 collects the cases where ϕ(n)\phi^{(n)} can be written down for every nn, and proves Leibniz’s rule for a product.

The idea

Differentiating twice is just differentiating the derivative. If ϕ(t)\phi(t) is the position of a particle at time tt, then ϕ′(t)\phi'(t) is its velocity and ϕ′′(t)\phi''(t) its acceleration, the rate at which the velocity changes. For most functions the successive derivatives quickly become unmanageable, but a few families follow a visible pattern, and spotting the pattern is the whole skill.

Explore Climb the ladder of derivatives

Try this. With sin⁡x\sin x, step nn from 00 up to 44 and watch the purple curve. Then choose x5x^5 and step up to 66, and 1/(1−x2)1/(1 - x^2) and step up to 88, watching the scale on the vertical axis.

ϕ(x)=sin⁡x\phi(x) = \sin x
xy
  • φ
  • previous derivative φ
  • φ⁽1⁾
ϕ(1)(x)=sin⁡(x+12π)=cos⁡x\phi^{(1)}(x) = \sin\left(x + \tfrac{1}{2}\pi\right)= \cos x
Each differentiation moves the graph a quarter period (½π) to the left.
What to notice

For sin⁡x\sin x each derivative is the previous graph moved a quarter period to the left, so sin⁡(n)x=sin⁡(x+12nπ)\sin^{(n)}x = \sin(x + \tfrac12 n\pi), and after four steps you are back at the start. A polynomial of degree 55 loses one degree per step and is 00 from the sixth derivative on. For 1/(1−x2)1/(1 - x^2) the shape stabilises but the size grows like n!n!.

Precise statements

Definition Higher derivatives Hardy: §121

If ϕ′\phi' has a derivative at xx, it is called the second derivative of ϕ\phi, written ϕ′′(x)\phi''(x), Dx2yD_x^2y or d2ydx2\dfrac{d^2y}{dx^2}. Inductively, the nnth derivative ϕ(n)(x)\phi^{(n)}(x), also written DxnyD_x^ny or dnydxn\dfrac{d^ny}{dx^n}, is the derivative of ϕ(n−1)\phi^{(n-1)}.

The existence of ϕ′′\phi'' is a genuinely new assumption. It does not follow from the existence of ϕ′\phi', any more than differentiability follows from continuity. For example ϕ(x)=x∣x∣\phi(x) = x|x| has ϕ′(x)=2∣x∣\phi'(x) = 2|x| everywhere, and 2∣x∣2|x| has no derivative at 00.

Theorem Standard nth derivatives Hardy: Examples XLV, 1–3, 9

For every positive integer nn:

  • dndxnxm=m(m−1)⋯(m−n+1) xm−n\dfrac{d^n}{dx^n}x^m = m(m - 1)\cdots(m - n + 1)\,x^{m-n} for rational mm (and x≠0x \ne 0 if m−n<0m - n < 0). If mm is a positive integer and n>mn > m, this is 00.
  • dndxn(ax+b)m=m(m−1)⋯(m−n+1) an(ax+b)m−n\dfrac{d^n}{dx^n}(ax + b)^m = m(m - 1)\cdots(m - n + 1)\,a^n(ax + b)^{m-n}.
  • dndxn1x−α=(−1)nn!(x−α)n+1\dfrac{d^n}{dx^n}\dfrac{1}{x - \alpha} = \dfrac{(-1)^n n!}{(x - \alpha)^{n+1}}, for real or complex α\alpha.
  • dndxnsin⁡x=sin⁡(x+12nπ)\dfrac{d^n}{dx^n}\sin x = \sin(x + \tfrac12 n\pi) and dndxncos⁡x=cos⁡(x+12nπ)\dfrac{d^n}{dx^n}\cos x = \cos(x + \tfrac12 n\pi).

With partial fractions, the third formula gives the nnth derivative of any rational function. Differentiating nn times is no harder than differentiating once, and this is where Hardy’s preference for partial fractions pays off.

Theorem Leibniz’s theorem Hardy: Examples XLV, 7

If uu and vv have nnth derivatives at xx, then so does uvuv, and

(uv)(n)=u(n)v+(n1)u(n−1)v′+(n2)u(n−2)v′′+⋯+(nr)u(n−r)v(r)+⋯+uv(n).(uv)^{(n)} = u^{(n)}v + \binom{n}{1}u^{(n-1)}v' + \binom{n}{2}u^{(n-2)}v'' + \dots + \binom{n}{r}u^{(n-r)}v^{(r)} + \dots + uv^{(n)}.

The coefficients are the binomial coefficients, exactly as in (a+b)n(a + b)^n. The resemblance is no accident. Each differentiation of a product splits every term into two, one with an extra derivative on uu and one with an extra derivative on vv, just as multiplying by a+ba + b does.

Proofs

Proof sin⁡(n)x=sin⁡(x+12nπ)\sin^{(n)}x = \sin(x + \tfrac12 n\pi)
Strategy

Induction on nn. The only fact needed is that differentiating sin⁡(x+c)\sin(x + c) gives cos⁡(x+c)=sin⁡(x+c+12π)\cos(x + c) = \sin(x + c + \tfrac12\pi): one differentiation adds 12π\tfrac12\pi to the angle.

Case n=1n = 1

(sin⁡x)′=cos⁡x=sin⁡(x+12π)(\sin x)' = \cos x = \sin(x + \tfrac12\pi).

Inductive step

Suppose sin⁡(n)x=sin⁡(x+12nπ)\sin^{(n)}x = \sin(x + \tfrac12 n\pi). By the chain rule (the inner function x+cx + c has derivative 11), sin⁡(n+1)x=cos⁡(x+12nπ)=sin⁡(x+12nπ+12π)=sin⁡{x+12(n+1)π}\sin^{(n+1)}x = \cos(x + \tfrac12 n\pi) = \sin(x + \tfrac12 n\pi + \tfrac12\pi) = \sin\{x + \tfrac12(n + 1)\pi\}.

Cosine

In the same way cos⁡(x+c)′=−sin⁡(x+c)=cos⁡(x+c+12π)\cos(x + c)' = -\sin(x + c) = \cos(x + c + \tfrac12\pi), so cos⁡(n)x=cos⁡(x+12nπ)\cos^{(n)}x = \cos(x + \tfrac12 n\pi).

Proof Leibniz’s theorem
Strategy

Induction on nn, as Hardy does. Differentiating the formula for (uv)(n)(uv)^{(n)} term by term with the product rule produces each term of the formula for n+1n + 1 twice, and the two coefficients add up by Pascal’s rule (nr)+(nr−1)=(n+1r)\binom{n}{r} + \binom{n}{r-1} = \binom{n+1}{r}.

Case n=1n = 1

(uv)′=u′v+uv′(uv)' = u'v + uv', the product rule, with coefficients (10)=(11)=1\binom10 = \binom11 = 1.

Differentiate the case nn

Assume (uv)(n)=∑r=0n(nr)u(n−r)v(r)(uv)^{(n)} = \sum_{r=0}^{n}\binom{n}{r}u^{(n-r)}v^{(r)}. Differentiating each term by the product rule gives (nr){u(n+1−r)v(r)+u(n−r)v(r+1)}\binom{n}{r}\{u^{(n+1-r)}v^{(r)} + u^{(n-r)}v^{(r+1)}\}.

Collect the terms u(n+1−r)v(r)u^{(n+1-r)}v^{(r)}

This product arises from the term with index rr (first part) and from the term with index r−1r - 1 (second part). So its coefficient is (nr)+(nr−1)\binom{n}{r} + \binom{n}{r-1}, with the convention (n−1)=(nn+1)=0\binom{n}{-1} = \binom{n}{n+1} = 0 at the ends.

Pascal’s rule

(nr)+(nr−1)=(n+1r)\binom{n}{r} + \binom{n}{r-1} = \binom{n+1}{r}. Hence (uv)(n+1)=∑r=0n+1(n+1r)u(n+1−r)v(r)(uv)^{(n+1)} = \sum_{r=0}^{n+1}\binom{n+1}{r}u^{(n+1-r)}v^{(r)}, which is the formula for n+1n + 1. By induction it holds for all nn.

Leibniz’s theorem is most useful when one factor is a polynomial, because then only a few of the n+1n + 1 terms are non-zero.

Explore Leibniz’s theorem with a polynomial factor

Try this. This is x2sin⁡xx^2\sin x. Step nn from 11 to 88 and read the formula: which binomial coefficients appear, and why only three terms?

ϕ(x)=x2sin⁡x\phi(x) = x^2\sin x
xy
  • φ
  • previous derivative φ
  • φ⁽1⁾
ϕ(1)=(10)x2sin⁡(1)x+(11)2xsin⁡(0)x+(12)2sin⁡(0)x\phi^{(1)} = \tbinom{1}{0}x^2\sin^{(1)}x + \tbinom{1}{1}2x\sin^{(0)}x + \tbinom{1}{2}2\sin^{(0)}x
Leibniz with u = sin x, v = x²: for n = 1 there are 2 terms, all present. From n = 3 on, v‴ = 0 and only three terms survive.
What to notice

With u=sin⁡xu = \sin x and v=x2v = x^2, every term with v(r)v^{(r)} for r≥3r \ge 3 vanishes, so (x2sin⁡x)(n)=x2sin⁡(x+12nπ)+2nxsin⁡{x+12(n−1)π}+n(n−1)sin⁡{x+12(n−2)π}(x^2\sin x)^{(n)} = x^2\sin(x + \tfrac12n\pi) + 2nx\sin\{x + \tfrac12(n-1)\pi\} + n(n-1)\sin\{x + \tfrac12(n-2)\pi\}. The coefficients 11, nn and (n2)\binom n2 come from the start of row nn of Pascal’s triangle.

Worked examples and exercises

Exercise ●○○ Hardy: Examples XLV, 1–2

Find the nnth derivative of (ax+b)m(ax + b)^m, and show that it is 00 when mm is a positive integer and n>mn > m.

Hint
Differentiate once and twice, and spot the pattern: each step brings down the current exponent and a factor aa.

Solution

By the chain rule, {(ax+b)m}′=ma(ax+b)m−1\{(ax + b)^m\}' = ma(ax + b)^{m-1}, and again {(ax+b)m}′′=m(m−1)a2(ax+b)m−2\{(ax + b)^m\}'' = m(m-1)a^2(ax + b)^{m-2}. By induction, {(ax+b)m}(n)=m(m−1)⋯(m−n+1)an(ax+b)m−n\{(ax + b)^m\}^{(n)} = m(m-1)\cdots(m-n+1)a^n(ax + b)^{m-n}. If mm is a positive integer and n>mn > m, the product m(m−1)⋯(m−n+1)m(m-1)\cdots(m-n+1) contains the factor m−m=0m - m = 0.

Exercise ●●○ Hardy: Examples XLV, 4

Prove that the nnth derivative of 11−x2\dfrac{1}{1 - x^2} is 12n!{(1−x)−n−1+(−1)n(1+x)−n−1}\tfrac12 n!\{(1 - x)^{-n-1} + (-1)^n(1 + x)^{-n-1}\}.

Hint
Split into partial fractions first.

Solution

11−x2=12(11−x+11+x)\dfrac{1}{1 - x^2} = \dfrac12\left(\dfrac{1}{1 - x} + \dfrac{1}{1 + x}\right). Now (1−x)−1(1 - x)^{-1} has nnth derivative (−1)(−2)⋯(−n)(−1)n(1−x)−1−n=n!(1−x)−n−1(-1)(-2)\cdots(-n)(-1)^n(1 - x)^{-1-n} = n!(1 - x)^{-n-1} (the formula for (ax+b)m(ax + b)^m with a=−1a = -1, m=−1m = -1: the signs pair off), and (1+x)−1(1 + x)^{-1} has nnth derivative (−1)nn!(1+x)−n−1(-1)^n n!(1 + x)^{-n-1}. Adding and halving gives the result.

Exercise ●○○ Hardy: Examples XLV, 11

If y=Acos⁡mx+Bsin⁡mxy = A\cos mx + B\sin mx, show that y′′+m2y=0y'' + m^2y = 0.

Solution

y′=−mAsin⁡mx+mBcos⁡mxy' = -mA\sin mx + mB\cos mx, and y′′=−m2Acos⁡mx−m2Bsin⁡mx=−m2yy'' = -m^2A\cos mx - m^2B\sin mx = -m^2y. (This is the equation of simple harmonic motion: the acceleration is proportional to the displacement and opposite to it.)

Exercise ●●● Hardy: Examples XLV, 14

Let u=arctan⁡xu = \arctan x. Show that (1+x2)u′′+2xu′=0(1 + x^2)u'' + 2xu' = 0, and hence find every derivative of uu at x=0x = 0.

Hint
Start from (1+x2)u′=1(1 + x^2)u' = 1 and differentiate. Then differentiate the new equation nn times by Leibniz’s theorem and put x=0x = 0.
Hint
You should obtain (1+x2)u(n+2)+2(n+1)xu(n+1)+n(n+1)u(n)=0(1 + x^2)u^{(n+2)} + 2(n+1)xu^{(n+1)} + n(n+1)u^{(n)} = 0.

Solution

Since u′=1/(1+x2)u' = 1/(1 + x^2), we have (1+x2)u′=1(1 + x^2)u' = 1, and differentiating gives (1+x2)u′′+2xu′=0(1 + x^2)u'' + 2xu' = 0. Now differentiate nn times by Leibniz. In {(1+x2)u′′}(n)\{(1 + x^2)u''\}^{(n)} only three terms survive: (1+x2)u(n+2)+2nxu(n+1)+n(n−1)u(n)(1 + x^2)u^{(n+2)} + 2nxu^{(n+1)} + n(n-1)u^{(n)}. In {2xu′}(n)\{2xu'\}^{(n)} only two: 2xu(n+1)+2nu(n)2xu^{(n+1)} + 2nu^{(n)}. Adding,

(1+x2)u(n+2)+2(n+1)xu(n+1)+n(n+1)u(n)=0.(1 + x^2)u^{(n+2)} + 2(n + 1)xu^{(n+1)} + n(n + 1)u^{(n)} = 0.

At x=0x = 0: u(n+2)(0)=−n(n+1)u(n)(0)u^{(n+2)}(0) = -n(n + 1)u^{(n)}(0). Since u(0)=0u(0) = 0, all even derivatives vanish at 00. Since u′(0)=1u'(0) = 1, we get u′′′(0)=−2u'''(0) = -2, u(5)(0)=−3⋅4⋅(−2)=24u^{(5)}(0) = -3\cdot4\cdot(-2) = 24, and in general u(2k+1)(0)=(−1)k(2k)!u^{(2k+1)}(0) = (-1)^k(2k)!. (These are exactly the coefficients that will give the series arctan⁡x=x−13x3+15x5−…\arctan x = x - \tfrac13x^3 + \tfrac15x^5 - \dots in Chapter IX.)

Exercise nth derivative of a complex partial fraction ●●○ Hardy: Examples XLV, 3

Find the nnth derivative of 11+x2\dfrac{1}{1 + x^2} by splitting it as 12i(1x−i−1x+i)\dfrac{1}{2i}\left(\dfrac{1}{x - i} - \dfrac{1}{x + i}\right), and check the case n=1n = 1.

Solution

The splitting is correct: 1x−i−1x+i=2ix2+1\dfrac{1}{x - i} - \dfrac{1}{x + i} = \dfrac{2i}{x^2 + 1}. By the formula for 1/(x−α)1/(x - \alpha) with α=±i\alpha = \pm i (valid for complex α\alpha, §115),

dndxn11+x2=(−1)nn!2i{1(x−i)n+1−1(x+i)n+1}.\frac{d^n}{dx^n}\frac{1}{1 + x^2} = \frac{(-1)^n n!}{2i}\left\{\frac{1}{(x - i)^{n+1}} - \frac{1}{(x + i)^{n+1}}\right\}.

For n=1n = 1: −12i⋅(x+i)2−(x−i)2(x2+1)2=−12i⋅4ix(x2+1)2=−2x(1+x2)2-\dfrac{1}{2i}\cdot\dfrac{(x + i)^2 - (x - i)^2}{(x^2 + 1)^2} = -\dfrac{1}{2i}\cdot\dfrac{4ix}{(x^2 + 1)^2} = -\dfrac{2x}{(1 + x^2)^2}, which is correct. The bracket is 2i2i times the imaginary part of (x−i)−n−1(x - i)^{-n-1}, so the answer is real, as it must be. Hardy’s Examples XLV, 15 turns this into a formula in terms of sin⁡\sin and cos⁡\cos of an angle.

Check yourself

Check yourself Enter a number

What is the 7th derivative of sin⁡x\sin x at x=0x = 0?

Why

sin⁡(7)x=sin⁡(x+72π)\sin^{(7)}x = \sin(x + \tfrac72\pi), and sin⁡72π=sin⁡(32π+2π)=−1\sin\tfrac72\pi = \sin(\tfrac32\pi + 2\pi) = -1. Equivalently, the derivatives cycle with period 44: sin⁡,cos⁡,−sin⁡,−cos⁡\sin, \cos, -\sin, -\cos, and 7=4+37 = 4 + 3 gives −cos⁡x-\cos x, which is −1-1 at 00.

Check yourself True or false?

If ϕ′(x)\phi'(x) exists for every xx, then ϕ′′(x)\phi''(x) exists for every xx.

Why

False. ϕ(x)=x∣x∣\phi(x) = x|x| has derivative 2∣x∣2|x| everywhere, which has a corner at 00. Worse, x2sin⁡(1/x)x^2\sin(1/x) has a derivative everywhere that is not even continuous at 00 (§125).

Check yourself Choose one

What is (uv)′′(uv)''?

Why

Leibniz with n=2n = 2: the coefficients are 1,2,11, 2, 1. Directly: (uv)′=u′v+uv′(uv)' = u'v + uv', and differentiating again gives u′′v+u′v′+u′v′+uv′′u''v + u'v' + u'v' + uv''. The two middle terms come from differentiating each of the two terms once more.

Check yourself Enter a number

What is the 10th derivative of (3x+1)9(3x + 1)^{9}?

Why

It is a polynomial of degree 99; its 9th derivative is the constant 9!⋅399!\cdot 3^9, and the 10th derivative is 00.

Hardy’s language

Summary

Summary
  • ϕ′′\phi'' is the derivative of ϕ′\phi', and ϕ(n)\phi^{(n)} of ϕ(n−1)\phi^{(n-1)}. Each exists only if the previous one is differentiable.
  • Closed forms: (xm)(n)=m(m−1)⋯(m−n+1)xm−n(x^m)^{(n)} = m(m-1)\cdots(m-n+1)x^{m-n}, {1/(x−α)}(n)=(−1)nn!/(x−α)n+1\{1/(x - \alpha)\}^{(n)} = (-1)^nn!/(x - \alpha)^{n+1}, sin⁡(n)x=sin⁡(x+12nπ)\sin^{(n)}x = \sin(x + \tfrac12n\pi).
  • Partial fractions give the nnth derivative of any rational function.
  • Leibniz: (uv)(n)=∑r(nr)u(n−r)v(r)(uv)^{(n)} = \sum_r\binom nr u^{(n-r)}v^{(r)}, proved by induction with Pascal’s rule; most useful when one factor is a polynomial.