The Chain Rule

Theorem:

If $g$ is a function differentiable at some $a$, and $f$ is a function differentiable at $g(a)$, then the derivative of their composition exists and is given by

$$\frac{d}{dx} \left[ f\,(g(x)) \right] = f\,'(g(a)) g'(a)$$

Proof:

We begin by appealing to one of the possible definitions for the derivative:

$$(f \circ g)'(a) = \lim_{x \to a} \frac{f(g(x)) - f(g(a))}{x - a}$$

Assume for the moment that $g(x) \neq g(a)$ for all $x$ near $a$.

Then the previous expression is equal to the product of two factors:

$$\lim_{x \to a} \frac{f(g(x)) - f(g(a))}{g(x) - g(a)} \cdot \frac{g(x) - g(a)}{x - a}$$

When $g$ oscillates near $a$, then it might happen that no matter how close one gets to $a$, there is always an even closer $x$ such that $g(x)=g(a)$. For example, this happens for $g(x) = x^2 \sin(1/x)$ near the point $a=0$. Whenever this happens, the above expression is undefined because it involves division by zero. To work around this, introduce a function $Q$ as follows:

$$Q(y) = \left\{ \begin{array}{ccl} \displaystyle{\frac{f(y) - f(g(a))}{y - g(a)}} & , & y \neq g(a), \\\\ f\,'(g(a)) & , & y = g(a). \end{array} \right.$$

We will show that the difference quotient for $f \circ g$ is always equal to:

$$Q(g(x)) \cdot \frac{g(x) - g(a)}{x - a}.$$

Whenever $g(x) \neq g(a)$, this is clear because the factors of $g(x)-g(a)$ cancel. When $g(x) = g(a)$, then the difference quotient for $f \circ g$ is zero because $f(g(x)) = f(g(a))$, and the above product is zero because it equals $f\,'(g(a))$ times zero.

So the above product is always equal to the difference quotient, and to show that the derivative of $f \circ g$ at $a$ exists and to determine its value, we need only show that the limit as $x$ goes to $a$ of the above product exists and determine its value.

To do this, recall that the limit of a product exists if the limits of its factors exist. When this happens, the limit of the product of these two factors will equal the product of the limits of the factors. The two factors are

$$Q(g(x)) \quad \textrm{ and } \quad \frac{g(x) - g(a)}{x-a}$$

The latter is the difference quotient for $g$ at $a$, and because $g$ is differentiable at $a$ by assumption, its limit as $x$ tends to $a$ exists and equals $g'(a)$.

It remains to consider $Q(g(x))$.

Note first, $Q$ is defined wherever $f$ is. Furthermore, because $f$ is differentiable at $g(a)$ by assumption, $Q$ is continuous at $g(a)$. Also, $g$ is continuous at $a$ because it is differentiable at $a$. Therefore $Q \circ g$ is continuous at $a$, and

$$\lim_{x \rightarrow a} \ Q(g(x)) = Q(g(a)) = f\,'(g(a))$$

This shows that the limits of both factors exist and that they equal $f\,'(g(a))$ and $g'(a)$, respectively. Therefore the derivative of $f \circ g$ at $a$ exists and equals $f\,'(g(a)) g'(a)$.

QED.