3.8 The Chain Rule

Story (The Gears of Calculus).

Imagine a physical machine comprised of interlocking gears. If the first gear (let’s call its rotation xx) drives a second gear (yy) such that one turn of xx produces 22 turns of yy, we say the rate of change is 22. If this second gear drives a third gear (zz) such that one turn of yy produces 33 turns of zz, what is the relationship between the first and third gears?

It is intuitively obvious: turning xx once turns yy twice, and each of those two turns of yy turns zz three times. Thus, one turn of xx yields 2×3=62\times 3=6 turns of zz. The rates multiply. This simple mechanical truth is the beating heart of the Chain Rule.

Before delving into infinitesimals, let us formalize this with simple linear functions. Consider a composite of two linear functions:

g⁢(x)=2⁢x+3,f⁢(y)=3⁢y+1.\begin{split}g(x)&{}=2x+3,\\ f(y)&{}=3y+1.\end{split}

If we compose them, substituting y=g⁢(x)y=g(x) into ff, we find:

f⁢(g⁢(x))=3⁢(2⁢x+3)+1=6⁢x+10.f(g(x))=3(2x+3)+1=6x+10.

Notice the slopes. The rate of change of gg is g′=2g^{\prime}=2. The rate of change of ff is f′=3f^{\prime}=3. The rate of change of the composite function f∘gf\circ g is exactly their product:

(f∘g)′=f′⋅g′=(3)⁢(2)=6.(f\circ g)^{\prime}=f^{\prime}\cdot g^{\prime}=(3)(2)=6.

For continuous ff and gg, recall the continuity of f⁢(g⁢(x))f(g(x)): a small change in xx causes a small change in g⁢(x)g(x), and that, in turn, causes a small change in f⁢(g⁢(x))f(g(x)). Now, with differentiable ff and gg, we are no longer just guaranteeing that the changes are small; we can precisely quantify these small changes.

Intuition (Linearity under the Microscope).

Every differentiable function locally behaves like a linear function, F⁢(x+h)≈F⁢(x)+F′⁢(x)⁢hF(x+h)\approx F(x)+F^{\prime}(x)h. If we compose two differentiable functions, we are locally composing two linear functions. Since the slopes of linear functions multiply upon composition, the derivatives (which are just local slopes) must also multiply.

We now state this principle rigorously.

Theorem 3.8.1 (Chain Rule).

If gg is differentiable at xx and ff is differentiable at g⁢(x)g(x), then the composite function f∘gf\circ g is differentiable at xx, and its derivative is given by

equation (3.22) (3.22)
(f∘g)′⁢(x)=f′⁢(g⁢(x))⁢g′⁢(x).(f\circ g)^{\prime}(x)=f^{\prime}(g(x))g^{\prime}(x).
Proof.

We compute the limit of the difference quotient for f∘gf\circ g:

limh→0(f∘g)⁢(x+h)−(f∘g)⁢(x)h=limh→0f⁢(g⁢(x+h))−f⁢(g⁢(x))h.\lim_{h\to 0}\frac{(f\circ g)(x+h)-(f\circ g)(x)}{h}=\lim_{h\to 0}\frac{f(g(x+% h))-f(g(x))}{h}.

To evaluate this, we use the fact that gg is differentiable at xx. We can express the local behavior of gg using little-oo notation. Namely, an increment hh in the domain yields:

g⁢(x+h)=g⁢(x)+g′⁢(x)⁢h+o⁢(h),g(x+h)=g(x)+g^{\prime}(x)h+o(h),

where o⁢(h)o(h) represents an error term that vanishes faster than hh (i.e., limh→0o⁢(h)/h=0\lim_{h\to 0}o(h)/h=0).

Substituting this into the numerator of our limit, we obtain:

limh→0f⁢(g⁢(x)+g′⁢(x)⁢h+o⁢(h))−f⁢(g⁢(x))h.\lim_{h\to 0}\frac{f\left(g(x)+g^{\prime}(x)h+o(h)\right)-f(g(x))}{h}.

Now, treat the quantity k=g′⁢(x)⁢h+o⁢(h)k=g^{\prime}(x)h+o(h) as a small perturbation to g⁢(x)g(x). Since ff is differentiable at g⁢(x)g(x), we can similarly expand f⁢(g⁢(x)+k)f(g(x)+k) as f⁢(g⁢(x))+f′⁢(g⁢(x))⁢k+o⁢(k)f(g(x))+f^{\prime}(g(x))k+o(k). Notice that as h→0h\to 0, k→0k\to 0 as well. Thus:

f⁢(g⁢(x+h))=f⁢(g⁢(x))+f′⁢(g⁢(x))⁢(g′⁢(x)⁢h+o⁢(h))⏟k+o⁢(k).\begin{split}f(g(x+h))&{}=f(g(x))+f^{\prime}(g(x))\underbrace{\big{(}g^{\prime% }(x)h+o(h)\big{)}}_{k}+o(k).\end{split}

Because kk scales linearly with hh, the error term o⁢(k)o(k) is also bounded by o⁢(h)o(h). Thus, the entire expression simplifies nicely:

limh→0f⁢(g⁢(x))+f′⁢(g⁢(x))⁢(g′⁢(x)⁢h+o⁢(h))−f⁢(g⁢(x))h\begin{split}\lim_{h\to 0}\frac{f(g(x))+f^{\prime}(g(x))\big{(}g^{\prime}(x)h+% o(h)\big{)}-f(g(x))}{h}\end{split}

The f⁢(g⁢(x))f(g(x)) terms cancel, leaving:

=limh→0f′⁢(g⁢(x))⁢g′⁢(x)⁢h+f′⁢(g⁢(x))⁢o⁢(h)h=limh→0(f′⁢(g⁢(x))⁢g′⁢(x)+f′⁢(g⁢(x))⁢o⁢(h)h).\begin{split}&{}=\lim_{h\to 0}\frac{f^{\prime}(g(x))g^{\prime}(x)h+f^{\prime}(% g(x))o(h)}{h}\\ &{}=\lim_{h\to 0}\left(f^{\prime}(g(x))g^{\prime}(x)+f^{\prime}(g(x))\frac{o(h% )}{h}\right).\end{split}

Since limh→0o⁢(h)h=0\lim_{h\to 0}\frac{o(h)}{h}=0, the second term vanishes. We are left exactly with:

f′⁢(g⁢(x))⁢g′⁢(x).f^{\prime}(g(x))g^{\prime}(x).

This completes the proof. ∎

Remark 3.8.2.

The use of little-oo notation here is not merely pedantic; it elegantly skirts a common pothole in introductory proofs where one might naively multiply and divide by g⁢(x+h)−g⁢(x)g(x+h)-g(x). That naive approach fails when g⁢(x+h)=g⁢(x)g(x+h)=g(x) for infinitely many hh near 0 (e.g., if gg is constant or highly oscillatory). The linear approximation definition of the derivative handles this flawlessly.

Moral (Look for the Bracket!).

When do we apply the chain rule? We always apply it when we can write the composition of functions with brackets:

(f∘g)⁢(x)=f⁢(g⁢(x)).(f\circ g)(x)=f\big{(}\,g(x)\,\big{)}.

Look for the bracket! If the inside of the bracket is the argument of some function, it’s time for chain rule. When taking the derivative, always work systematically from the outermost function to the innermost.

Example 3.8.3.

Consider the function (x2−x+5)4(x^{2}-x+5)^{4}. We can view this as f∘gf\circ g, where the “inner” function is g⁢(x)=x2−x+5g(x)=x^{2}-x+5 and the “outer” function is f⁢(y)=y4f(y)=y^{4}.

Using the power rule for the outer function and the polynomial rules for the inner function, the chain rule dictates:

((x2−x+5)4)′=4⁢(x2−x+5)3⋅(x2−x+5)′=4⁢(x2−x+5)3⁢(2⁢x−1).\begin{split}\left((x^{2}-x+5)^{4}\right)^{\prime}&{}=4(x^{2}-x+5)^{3}\cdot(x^% {2}-x+5)^{\prime}\\ &{}=4(x^{2}-x+5)^{3}(2x-1).\end{split}

3.8.1 The Chains of Leibniz

The chain rule can be used to differentiate compositions of more than two functions; indeed, this motivates its name, since we can think of this as a chain of functions composed with each other.

For example, given three functions f,g,h:ℝ→ℝf,g,h:\mathbb{R}\to\mathbb{R}, we can visualize the composite F=f∘g∘hF=f\circ g\circ h as in Figure 3.7 below.

A commutative diagram illustrating the chain rule of multiple functions. It shows four nodes: x, u, v, and y aligned horizontally. Straight arrows point from x to u (labeled h), u to v (labeled g), and v to y (labeled f). A curved arrow arches over the top from x to y, labeled F = f o g o h. Another curved arrow arches underneath from x to v, labeled G = g o h.
Figure 3.7: Illustration of the chain rule of multiple functions.

Writing G=f∘gG=f\circ g, we can use the chain rule to write G′G^{\prime} in terms of f′f^{\prime} and g′g^{\prime}, then again to write F′F^{\prime} in terms of G′G^{\prime} and h′h^{\prime}, obtaining:

F′⁢(x)=(G∘h)′⁢(x)=G′⁢(h⁢(x))⁢h′⁢(x)=(f∘g)′⁢(h⁢(x))⁢h′⁢(x)=f′⁢(g⁢(h⁢(x)))⋅g′⁢(h⁢(x))⋅h′⁢(x).\begin{split}F^{\prime}(x)&{}=(G\circ h)^{\prime}(x)\\ &{}=G^{\prime}(h(x))h^{\prime}(x)\\ &{}=(f\circ g)^{\prime}(h(x))h^{\prime}(x)\\ &{}=f^{\prime}(g(h(x)))\cdot g^{\prime}(h(x))\cdot h^{\prime}(x).\end{split}

It is perhaps easiest to view this using the alternate notation championed by Gottfried Wilhelm Leibniz:

equation (3.23) (3.23)
d⁢yd⁢x=d⁢yd⁢v⁢d⁢vd⁢u⁢d⁢ud⁢x,\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{\mathrm{d}y}{\mathrm{d}v}\frac{\mathrm{d% }v}{\mathrm{d}u}\frac{\mathrm{d}u}{\mathrm{d}x},

where u=h⁢(x)u=h(x), v=g⁢(u)=g⁢(h⁢(x))v=g(u)=g(h(x)), and y=f⁢(v)=f⁢(g⁢(h⁢(x)))y=f(v)=f(g(h(x))).

Caveat (The Leibniz Illusion).

We reiterate that although this notation makes it very tempting to view the chain rule as just a matter of “canceling the d⁢v\,\mathrm{d}v and the d⁢u\,\mathrm{d}u from the numerator and denominator,” this is not an actual proof of anything. The quantities d⁢yd⁢v\frac{\mathrm{d}y}{\mathrm{d}v}, d⁢vd⁢u\frac{\mathrm{d}v}{\mathrm{d}u}, and d⁢ud⁢x\frac{\mathrm{d}u}{\mathrm{d}x} are entirely unified symbols representing limits (derivatives), not algebraic fractions.

At this stage in your mathematical journey, the symbols d⁢u\,\mathrm{d}u and d⁢v\,\mathrm{d}v have no independent meaning. (Later, in the study of differential geometry and differential forms, we will give them strict algebraic definitions, but for now, treat the “cancellation” strictly as a mnemonic device).

Example 3.8.4.

The function F⁢(x)=sin⁡(e3⁢x)F(x)=\sin(\mathrm{e}^{3x}) can be elegantly differentiated by introducing intermediate variables: let u=3⁢xu=3x, let v=eu=e3⁢xv=\mathrm{e}^{u}=\mathrm{e}^{3x}, and let y=sin⁡(v)=sin⁡(e3⁢x)y=\sin(v)=\sin(\mathrm{e}^{3x}).

Applying Leibniz’s chained gears (3.23), we compute:

F′⁢(x)=d⁢yd⁢x=d⁢yd⁢v⁢d⁢vd⁢u⁢d⁢ud⁢x=(cos⁡v)⁢(eu)⁢(3)=3⁢eu⁢cos⁡v.\begin{split}F^{\prime}(x)=\frac{\mathrm{d}y}{\mathrm{d}x}&{}=\frac{\mathrm{d}% y}{\mathrm{d}v}\frac{\mathrm{d}v}{\mathrm{d}u}\frac{\mathrm{d}u}{\mathrm{d}x}% \\ &{}=(\cos v)(\mathrm{e}^{u})(3)\\ &{}=3\mathrm{e}^{u}\cos v.\end{split}

Note that although applying (3.23) gave us an expression in terms of uu, vv, and xx, this is not yet our final answer! It is always necessary to go one step further and substitute uu and vv back in terms of the original variable xx. Doing so yields:

F′⁢(x)=3⁢e3⁢x⁢cos⁡(e3⁢x).F^{\prime}(x)=3\mathrm{e}^{3x}\cos(\mathrm{e}^{3x}).

You will encounter this phenomenon—introducing variables to simplify the local geometry, then translating back to the global coordinates—in many other places as well.

Exercise 3.8.5.

Find the derivative of f⁢(x)=tan⁡(sin⁡(x2))f(x)=\tan(\sin(x^{2})).

Hint for the reader: Do not panic at the nesting. Peel it like an onion, from outermost to innermost:

  1. 1.
    ​

    The derivative of tan⁡(blob)\tan(\text{blob}) is sec2⁡(blob)⋅(blob)′\sec^{2}(\text{blob})\cdot(\text{blob})^{\prime}.

  2. 2.
    ​

    The derivative of sin⁡(stuff)\sin(\text{stuff}) is cos⁡(stuff)⋅(stuff)′\cos(\text{stuff})\cdot(\text{stuff})^{\prime}.

  3. 3.
    ​

    The derivative of x2x^{2} is 2⁢x2x.

Putting it all together:

f′⁢(x)=sec2⁡(sin⁡(x2))⋅cos⁡(x2)⋅2⁢x.f^{\prime}(x)=\sec^{2}(\sin(x^{2}))\cdot\cos(x^{2})\cdot 2x.

3.8.2 The Derivative of the Exponential Function

We now embark on a heuristic argument to derive the derivative of f⁢(x)=exf(x)=\mathrm{e}^{x}.

Story (The Price of Early Transcendentals).

Unfortunately, we will not be able to give a fully rigorous proof at this stage. This is the price we pay for the early transcendental approach to calculus. Of course, with sheer determination to overcome multiple technicalities, one can find the derivative of ex\mathrm{e}^{x} rigorously right now. However, the most mathematically natural way is to leave it until one learns the formal theory of sequences and series.

So far, we only have two pieces of information: e\mathrm{e} is a natural number approximating 2.718⁢…2.718\dots, and it beautifully satisfies Euler’s identity:

ei⁢θ=cos⁡θ+i⁢sin⁡θ.\mathrm{e}^{i\theta}=\cos\theta+i\sin\theta.

Let us calculate the derivative of this expression with respect to θ\theta:

(ei⁢θ)′=(cos⁡θ+i⁢sin⁡θ)′=(cos⁡θ)′+i⁢(sin⁡θ)′=−sin⁡θ+i⁢cos⁡θ.\begin{split}(\mathrm{e}^{i\theta})^{\prime}&{}=(\cos\theta+i\sin\theta)^{% \prime}\\ &{}=(\cos\theta)^{\prime}+i(\sin\theta)^{\prime}\\ &{}=-\sin\theta+i\cos\theta.\end{split}

Recalling that i2=−1i^{2}=-1, we can rewrite −sin⁡θ-\sin\theta as i2⁢sin⁡θi^{2}\sin\theta:

(ei⁢θ)′=i2⁢sin⁡θ+i⁢cos⁡θ=i⁢(i⁢sin⁡θ+cos⁡θ)=i⁢ei⁢θ.\begin{split}(\mathrm{e}^{i\theta})^{\prime}&{}=i^{2}\sin\theta+i\cos\theta\\ &{}=i(i\sin\theta+\cos\theta)\\ &{}=i\mathrm{e}^{i\theta}.\end{split}

But we ultimately want the derivative of ex\mathrm{e}^{x}, and the above calculation only holds for a real parameter θ\theta.

Caveat (A Leap of Faith).

We are about to boldly extrapolate. We suppose that the formula we just derived, (ei⁢z)′=i⁢ei⁢z(\mathrm{e}^{iz})^{\prime}=i\mathrm{e}^{iz}, holds for any complex number zz. While this is a leap of faith for now, complex analysis will later vindicate our bravery.

Using this assumption, we can write ex=ei⁢(−i⁢x)\mathrm{e}^{x}=\mathrm{e}^{i(-ix)}. Applying the chain rule to this carefully constructed identity yields:

(ex)′=(ei⁢(−i⁢x))′=(ei⁢z)′⋅z′where ⁢z=−i⁢x=i⁢ei⁢(−i⁢x)⋅(−i)=−i2⁢e−i2⁢x=−(−1)⁢e−(−1)⁢x=ex.\begin{split}(\mathrm{e}^{x})^{\prime}&{}=\left(\mathrm{e}^{i(-ix)}\right)^{% \prime}\\ &{}=\left(\mathrm{e}^{iz}\right)^{\prime}\cdot z^{\prime}\quad\text{where }z=-% ix\\ &{}=i\mathrm{e}^{i(-ix)}\cdot(-i)\\ &{}=-i^{2}\mathrm{e}^{-i^{2}x}\\ &{}=-(-1)\mathrm{e}^{-(-1)x}\\ &{}=\mathrm{e}^{x}.\end{split}

And there we have it: the derivative of ex\mathrm{e}^{x} is ex\mathrm{e}^{x} itself!

Let’s us warm up with a relation between logarithm and exponential, and its application. Let aa be any positive number. We want to find the derivative of axa^{x}.

Intuition (The Fundamental Philosophy of Exponential).

Before we formalize the derivative of a general exponential axa^{x}, it is instructive to look at the big picture. All exponentials are, fundamentally, the natural exponential ex\mathrm{e}^{x} wearing a disguise. By leveraging the identity a=elog⁡aa=\mathrm{e}^{\log a}, we can translate any problem involving arbitrary bases back into the familiar, natural language of e\mathrm{e}.

We write aa as elog⁡a\mathrm{e}^{\log a}. Then ax=(elog⁡a)x=e(log⁡a)⁢xa^{x}=(\mathrm{e}^{\log a})^{x}=\mathrm{e}^{(\log a)x}. Using the chain rule and the fact that the derivative of ex\mathrm{e}^{x} is ex\mathrm{e}^{x}, we get that

(ax)′=(e(log⁡a)⁢x)′=(log⁡a)⁢e(log⁡a)⁢x=(log⁡a)⁢ax.(a^{x})^{\prime}=(\mathrm{e}^{(\log a)x})^{\prime}=(\log a)\mathrm{e}^{(\log a% )x}=(\log a)a^{x}.

Notice how the change of base simply summons a scaling factor of log⁡a\log a.

Example 3.8.6.

The function ex2+1\mathrm{e}^{x^{2}+1} is a composition f⁢(g⁢(x))f(g(x)), where g⁢(x)=x2+1g(x)=x^{2}+1 and f⁢(x)=exf(x)=\mathrm{e}^{x}. By the chain rule,

(ex2+1)′=ex2+1⁢(x2+1)′=ex2+1⁢2⁢x.(\mathrm{e}^{x^{2}+1})^{\prime}=\mathrm{e}^{x^{2}+1}(x^{2}+1)^{\prime}=\mathrm% {e}^{x^{2}+1}2x.

In the dd⁢x\frac{\mathrm{d}}{\mathrm{d}x} notation, if y=ex2+1y=\mathrm{e}^{x^{2}+1} and u=x2+1u=x^{2}+1, then

d⁢yd⁢x=d⁢yd⁢u⁢d⁢ud⁢x=eu⁢(2⁢x)=ex2+1⁢2⁢x.\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{\mathrm{d}y}{\mathrm{d}u}\frac{\mathrm{d% }u}{\mathrm{d}x}=\mathrm{e}^{u}(2x)=\mathrm{e}^{x^{2}+1}2x.

More generally,

(ef⁢(x))′=ef⁢(x)⁢f′⁢(x)(\mathrm{e}^{f(x)})^{\prime}=\mathrm{e}^{f(x)}f^{\prime}(x)

for any differentiable function ff. Similarly, by the chain rule,

(f⁢(ex))′=f′⁢(ex)⁢ex(f(\mathrm{e}^{x}))^{\prime}=f^{\prime}(\mathrm{e}^{x})\mathrm{e}^{x}

for any differentiable function ff.

Exercise 3.8.7.

Find the first derivative of the following expressions:

  1. 1.
    ​

    y=2xy=2^{x}

  2. 2.
    ​

    y=103⁢xy=10^{3x}

  3. 3.
    ​

    y=ex2y=\mathrm{e}^{x^{2}}.

3.8.3 Higher Derivatives

It is quite interesting that the exponential function f⁢(x)=exf(x)=\mathrm{e}^{x} has the derivative f′⁢(x)=ex=f⁢(x)f^{\prime}(x)=\mathrm{e}^{x}=f(x). This immediately implies that we can take a derivative of the derivative of ex\mathrm{e}^{x}, ad infinitum.

Definition 3.8.8 (Higher Derivatives).

When the derivative of the derivative of ff exists at xx, it is called the second derivative of ff and is written in any of the following ways:

(f′)′⁢(x)=f′′⁢(x)=dd⁢x⁢(d⁢fd⁢x)=d2⁢fd⁢x2⁢(x).(f^{\prime})^{\prime}(x)=f^{\prime\prime}(x)=\frac{\mathrm{d}}{\mathrm{d}x}% \left(\frac{\mathrm{d}f}{\mathrm{d}x}\right)=\frac{\mathrm{d}^{2}f}{\mathrm{d}% x^{2}}(x).

Similar notation is used for higher derivatives, sometimes with superscripts enclosed in parentheses to indicate the order. For instance, the nn-th derivative is denoted f(n)⁢(x)f^{(n)}(x) or dn⁢yd⁢xn\frac{\mathrm{d}^{n}y}{\mathrm{d}x^{n}}.

Let us look at a simple polynomial example before returning to our exponential.

Example 3.8.9.

Let f⁢(x)=x4f(x)=x^{4}. Then:

f′⁢(x)=4⁢x3,f′′⁢(x)=12⁢x2,f′′′⁢(x)=24⁢x,f(4)⁢(x)=24,f(5)⁢(x)=0.f^{\prime}(x)=4x^{3},\quad f^{\prime\prime}(x)=12x^{2},\quad f^{\prime\prime% \prime}(x)=24x,\quad f^{(4)}(x)=24,\quad f^{(5)}(x)=0.

Now, let us apply this to the exponential function:

Example 3.8.10.

Let f⁢(x)=exf(x)=\mathrm{e}^{x}. Then f(2)⁢(x)=d2d⁢x2⁢(ex)=exf^{(2)}(x)=\frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}}(\mathrm{e}^{x})=\mathrm{e}^{x}. In fact, by trivial induction:

dnd⁢xn⁢(ex)=ex\frac{\mathrm{d}^{n}}{\mathrm{d}x^{n}}(\mathrm{e}^{x})=\mathrm{e}^{x}

for any positive integer nn.

We say that f⁢(x)=exf(x)=\mathrm{e}^{x} is invariant under the derivative. It is essentially the only family of functions (up to scalar multiplication) with this property.

Moral (The Birth of a New Discipline).

Because ex\mathrm{e}^{x} is entirely characterized by its invariance under differentiation, some textbooks actually define e\mathrm{e} as the unique number such that f⁢(x)=exf(x)=\mathrm{e}^{x} satisfies the equation:

f′⁢(x)=f⁢(x).f^{\prime}(x)=f(x).

This identity is an equation where the unknown is not a number, but a function, and the equation involves differentiation. Hence, mathematicians gave such equations a name: differential equation!

3.8.4 Cycles, Rotations, and Trigonometry: The Math of Oscillation

Higher derivatives of sine and cosine can be easily computed, and they reveal a beautiful underlying cyclic structure:

dd⁢x⁢sin⁡x=cos⁡x⟹d2d⁢x2sinx=dd⁢xcosx=−sinx⟹d3d⁢x3sinx=dd⁢x(−sinx)=−cosx⟹d4d⁢x4sinx=dd⁢x(−cosx)=sinx.\begin{split}\frac{\mathrm{d}}{\mathrm{d}x}\sin x=\cos x\quad&{}\implies\quad% \frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}}\sin x=\frac{\mathrm{d}}{\mathrm{d}x}% \cos x=-\sin x\\ &{}\implies\quad\frac{\mathrm{d}^{3}}{\mathrm{d}x^{3}}\sin x=\frac{\mathrm{d}}% {\mathrm{d}x}(-\sin x)=-\cos x\\ &{}\implies\quad\frac{\mathrm{d}^{4}}{\mathrm{d}x^{4}}\sin x=\frac{\mathrm{d}}% {\mathrm{d}x}(-\cos x)=\sin x.\end{split}

After this, the pattern repeats with every fourth derivative.

Intuition (Derivatives as Geometric Rotations).

It is worth comparing this 4-cycle to the observation that:

d4d⁢x4⁢ei⁢x=d3d⁢x3⁢(i⁢ei⁢x)=d2d⁢x2⁢(−ei⁢x)=dd⁢x⁢(−i⁢ei⁢x)=ei⁢x.\frac{\mathrm{d}^{4}}{\mathrm{d}x^{4}}\mathrm{e}^{ix}=\frac{\mathrm{d}^{3}}{% \mathrm{d}x^{3}}(i\mathrm{e}^{ix})=\frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}}(-% \mathrm{e}^{ix})=\frac{\mathrm{d}}{\mathrm{d}x}(-i\mathrm{e}^{ix})=\mathrm{e}^% {ix}.

This admits a profound geometric interpretation. Multiplying a complex number by ii corresponds to rotating it by 90 degrees (π/2\pi/2 radians) counter-clockwise around the origin in the complex plane.

Doing this twice corresponds to a 180-degree rotation (multiplication by −1-1). Doing it four times returns us to where we started. Since differentiating the sine function has the same cyclic property, we can view the derivative operator dd⁢x\frac{\mathrm{d}}{\mathrm{d}x} acting on trigonometric functions as a translation of the argument by π/2\pi/2:

dd⁢x⁢sin⁡x=cos⁡x=sin⁡(x+π2).\frac{\mathrm{d}}{\mathrm{d}x}\sin x=\cos x=\sin\left(x+\frac{\pi}{2}\right).

Because of this 4-cycle, computing arbitrarily high derivatives becomes an exercise in modular arithmetic.

Example 3.8.11.

We can compute d53d⁢x53⁢sin⁡x\frac{\mathrm{d}^{53}}{\mathrm{d}x^{53}}\sin x by observing that 53=4⋅13+153=4\cdot 13+1. So the first 5252 derivatives get us exactly back to sin⁡x\sin x, and we thus have:

d53d⁢x53⁢sin⁡x=dd⁢x⁢sin⁡x=cos⁡x.\frac{\mathrm{d}^{53}}{\mathrm{d}x^{53}}\sin x=\frac{\mathrm{d}}{\mathrm{d}x}% \sin x=\cos x.

Of particular physical importance is the fact that if f⁢(x)=sin⁡xf(x)=\sin x or f⁢(x)=cos⁡xf(x)=\cos x (or more generally, any linear combination f⁢(x)=a⁢sin⁡x+b⁢cos⁡xf(x)=a\sin x+b\cos x), then:

equation (3.24) (3.24)
f′′⁢(x)=−f⁢(x)for all ⁢x∈ℝ.f^{\prime\prime}(x)=-f(x)\quad\text{for all }x\in\mathbb{R}.

This is a tremendously important example of a differential equation, one which arises naturally in almost every area of physics.

Story (Newton Meets Hooke).

Consider an object on a spring that, at time tt, is displaced by a distance rr from its equilibrium resting position. The force acting on the object is given by Hooke’s Law: it has magnitude k⁢rkr, where k>0k>0 is the spring constant measuring the stiffness of the spring. Crucially, this force is a restoring force—it is directed in the opposite direction of the displacement.

If mm is the mass of the object, then Newton’s second law (F=m⁢aF=ma) gives us:

equation (3.25) (3.25)
m⁢d2⁢rd⁢t2=force=−k⁢r⟹d2⁢rd⁢t2=−km⁢r.m\frac{\mathrm{d}^{2}r}{\mathrm{d}t^{2}}=\text{force}=-kr\quad\implies\quad% \frac{\mathrm{d}^{2}r}{\mathrm{d}t^{2}}=-\frac{k}{m}r.

Let us define a natural frequency parameter ω≔k/m\omega\coloneqq\sqrt{k/m}, and consider a rescaled function f⁢(x)=r⁢(x/ω)f(x)=r(x/\omega). Using the chain rule, we can relate the derivatives of ff to the derivatives of rr:

f′⁢(x)=dd⁢x⁢r⁢(xω)=1ω⁢r′⁢(xω).f^{\prime}(x)=\frac{\mathrm{d}}{\mathrm{d}x}r\left(\frac{x}{\omega}\right)=% \frac{1}{\omega}r^{\prime}\left(\frac{x}{\omega}\right).

Differentiating a second time yields:

f′′⁢(x)=dd⁢x⁢(1ω⁢r′⁢(xω))=1ω2⁢r′′⁢(xω)=1ω2⁢(−km⁢r⁢(xω))=−r⁢(xω)=−f⁢(x).\begin{split}f^{\prime\prime}(x)&{}=\frac{\mathrm{d}}{\mathrm{d}x}\left(\frac{% 1}{\omega}r^{\prime}\left(\frac{x}{\omega}\right)\right)=\frac{1}{\omega^{2}}r% ^{\prime\prime}\left(\frac{x}{\omega}\right)\\ &{}=\frac{1}{\omega^{2}}\left(-\frac{k}{m}r\left(\frac{x}{\omega}\right)\right% )=-r\left(\frac{x}{\omega}\right)=-f(x).\end{split}

This means that ff must be a function that satisfies the exact differential equation we discovered in (3.24)! While a formal proof requires the theory of linear differential equations, we can confidently state that every function satisfying f′′⁢(x)=−f⁢(x)f^{\prime\prime}(x)=-f(x) can be written in the form f⁢(x)=a⁢sin⁡x+b⁢cos⁡xf(x)=a\sin x+b\cos x.

Returning to our physical variables, we conclude that the displacement of the mass on the spring is given by:

equation (3.26) (3.26)
r⁢(t)=f⁢(ω⁢t)=a⁢sin⁡(ω⁢t)+b⁢cos⁡(ω⁢t).r(t)=f(\omega t)=a\sin(\omega t)+b\cos(\omega t).

This system is the quintessential example of a simple harmonic oscillator.

Exercise 3.8.12.

Prove that if r⁢(t)r(t) is given by (3.26), then there exist constants A>0A>0 and ϕ∈ℝ\phi\in\mathbb{R} (an amplitude and a phase shift) such that:

r⁢(t)=A⁢sin⁡(ω⁢t+ϕ).r(t)=A\sin(\omega t+\phi).

To test your intuition on higher derivatives, polynomials, and cyclic trigonometric functions, try the following

Exercise 3.8.13.

Find f(1026)⁢(x)f^{(1026)}(x) given that

f⁢(x)=x100+sin⁡(2⁢x).f(x)=x^{100}+\sin(2x).

Hint: What happens to a polynomial of degree 100 after 101 derivatives? For the sine term, don’t forget the chain rule, and recall our modular arithmetic trick!