The product, quotient and chain rules

We now move to some more involved properties of differentiation. To summarise, so far we have found that:

However, it turns out that:

The product, quotient and chain rules tell us how to differentiate in these three situations. We consider the three rules in turn.

The product rule

Theorem Product rule

Let \(f,g\) be differentiable functions. Then the derivative of their product is given by

\[ \dfrac{d}{dx} \bigl[ f(x)\,g(x) \bigr] = f(x)\,g'(x) + g(x)\,f'(x). \]

The product rule is also often written as

\[ \dfrac{d}{dx} \bigl(fg\bigr) = f\,\dfrac{dg}{dx} + g\,\dfrac{df}{dx}. \]

As before, we evaluate the limit which gives the derivative:

\[ \dfrac{d}{dx} \bigl[ f(x)\,g(x) \bigr] = \lim_{\Delta x \to 0} \dfrac{f(x+\Delta x)\,g(x+\Delta x) - f(x)\,g(x)}{\Delta x}. \]

The trick is to add and subtract an extra term in the numerator, so that we can factorise and obtain some familiar-looking expressions:

\begin{align*} & f(x+\Delta x)\,g(x+\Delta x) - f(x)\,g(x) \\ ={}& f(x+\Delta x)\,g(x+\Delta x) - f(x)\,g(x + \Delta x) + f(x)\,g( x + \Delta x) - f(x)\,g(x) \\ ={}& \bigl[ f(x+\Delta x) - f(x) \bigr] g(x+\Delta x) + f(x) \bigl[ g(x+\Delta x) - g(x) \bigr]. \end{align*}

We can then rewrite the limit as

\[ \lim_{\Delta x \to 0} \Bigl[ \dfrac{f(x+\Delta x) - f(x)}{\Delta x}\,g(x+\Delta x) + f(x)\,\dfrac{g(x+\Delta x) - g(x)}{\Delta x} \Bigr]. \]

Now, since the limit of a sum is the sum of the limits, and the limit of a product is the product of the limits, we obtain

\[ \Bigl(\lim_{\Delta x \to 0} \dfrac{f(x+\Delta x) - f(x)}{\Delta x}\Bigr)\Bigl(\lim_{\Delta x \to 0} g(x+\Delta x)\Bigr) + f(x)\Bigl(\lim_{\Delta x \to 0} \dfrac{g(x+\Delta x) - g(x)}{\Delta x}\Bigr). \]

We also used the fact that \(f(x)\) does not depend on \(\Delta x\). Recognising \(f'(x)\) and \(g'(x)\), and substituting \(\Delta x = 0\) into \(g(x+\Delta x)\), we obtain

\[ \dfrac{d}{dx} \bigl[ f(x)\,g(x) \bigr] = f'(x)\,g(x) + f(x)\,g'(x), \]

which is equivalent to the desired formula.


Exercise 8

Starting from the fact that the derivative of \(x\) is 1, use the product rule to prove by induction on \(n\), that for all positive integers \(n\),

\[ \dfrac{d}{dx} \bigl( x^n \bigr) = nx^{n-1}. \]


Let \(f(x) = (x^3 + 2) (x^2 + 1)\). Find \(f'(x)\).


We could expand out \(f(x)\) and differentiate term-by-term. Alternatively, with the product rule, we obtain

\begin{align*} f'(x) &= (x^3 + 2)\,\dfrac{d}{dx}\bigl(x^2 + 1\bigr) + (x^2 + 1)\,\dfrac{d}{dx}\bigl(x^3 + 2\bigr) \\ &= (x^3 + 2)\cdot 2x + (x^2 + 1)\cdot 3x^2 \\ &= 5x^4 + 3x^2 + 4x. \end{align*}
Exercise 9

Using the product rule, prove that in general, for a differentiable function \(f\colon \mathbb{R} \to \mathbb{R}\), the derivative of \((f(x))^2\) with respect to \(x\) is \(2\,f(x)\,f'(x)\).

Exercise 10

By using the product rule, prove the following 'extended product rule':

\[ \dfrac{d}{dx} \bigl[ f(x)\,g(x)\,h(x) \bigr] = f'(x)\,g(x)\,h(x) + f(x)\,g'(x)\,h(x) + f(x)\,g(x)\,h'(x). \]

Generalise to the product of any number of functions.

The chain rule

The chain rule allows us to differentiate the composition of two functions. Recall from the module Functions II that the composition of two functions \(g\) and \(f\) is

\[ (f \circ g)(x) = f(g(x)). \]

We start with \(x\), apply \(g\), then apply \(f\). The chain rule tells us how to differentiate such a function.

Theorem Chain rule

Let \(f,g\) be differentiable functions. Then the derivative of their composition is

\[ \dfrac{d}{dx} \bigl[ f(g(x)) \bigr] = f'(g(x))\,g'(x). \]

In Leibniz notation, we may write \(u = g(x)\) and \(y = f(u) = f(g(x))\); diagrammatically,

\[ x \stackrel{g}{\to} u \stackrel{f}{\to} y. \]

Then the chain rule says that 'differentials cancel' in the sense that

\[ \dfrac{dy}{dx} = \dfrac{dy}{du}\,\dfrac{du}{dx}. \]

To calculate the derivative, we must evaluate the limit

\[ \dfrac{d}{dx} \bigl[ f(g(x)) \bigr] = \lim_{\Delta x \to 0} \dfrac{f(g(x+\Delta x)) - f(g(x))}{\Delta x}. \]

The trick is to multiply and divide by an extra term in the expression above, as shown, so that we obtain two expressions which both express rates of change:

\[ \dfrac{f(g(x+\Delta x)) - f(g(x))}{\Delta x} = \dfrac{f(g(x+\Delta x)) - f(g(x))}{g(x+\Delta x) - g(x)} \, \dfrac{g(x+\Delta x) - g(x)}{\Delta x}. \]

We can then rewrite the desired limit as

\[ \Bigl(\lim_{\Delta x \to 0} \dfrac{f(g(x+\Delta x)) - f(g(x))}{g(x+\Delta x) - g(x)}\Bigr)\Bigl(\lim_{\Delta x \to 0} \dfrac{g(x+\Delta x) - g(x)}{\Delta x}\Bigr). \]

The ratio in the first limit expresses the change in the function \(f\), from its value at \(g(x)\) to its value at \(g(x+\Delta x)\), relative to the difference between \(g(x+\Delta x)\) and \(g(x)\). So as \(\Delta x \to 0\), this first term approaches the derivative of \(f\) at the point \(g(x)\), namely \(f'(g(x))\). The second limit is clearly \(g'(x)\). We conclude that

\[ \dfrac{d}{dx} \bigl[ f(g(x)) \bigr] = f'(g(x))\,g'(x), \]

as required.


The proof above is not entirely rigorous: for instance, if there are values of \(\Delta x\) close to zero such that \(g(x+\Delta x) - g(x) = 0\), then we have division by zero in the first limit. However, a fully rigorous proof is beyond the secondary school level.

The next two examples illustrate 'functional' and 'Leibniz' methods of attacking the same problem using the chain rule.


Let \(f(x) = (x^7 - x^2)^{42}\). Find \(f'(x)\).


The function \(f(x)\) is the composition of the functions \(g(x) = x^7 - x^2\) and \(h(x) = x^{42}\), that is, \(f(x) = h(g(x))\). We compute

\[ g'(x) = 7x^6 - 2x, \qquad h'(x) = 42x^{41}, \]

and the chain rule gives

\begin{align*} f'(x) &= h'(g(x))\,g'(x) \\ &= 42(x^7 - x^2)^{41}(7x^6 - 2x). \end{align*}


Let \(y = (x^7 - x^2)^{42}\). Find \(\dfrac{dy}{dx}\).


Let \(u = x^7 - x^2\), so that \(y = u^{42}\). We then have

\[ \dfrac{dy}{du} = 42u^{41}, \qquad \dfrac{du}{dx} = 7x^6 - 2x, \]

and the chain rule gives

\[ \dfrac{dy}{dx} = \dfrac{dy}{du}\,\dfrac{du}{dx} = 42u^{41} (7x^6 - 2x). \]

Rewriting \(u\) in terms of \(x\) gives

\[ \dfrac{dy}{dx} = 42(x^7 - x^2)^{41}(7x^6 - 2x). \]
Exercise 11

Find the derivative of \((x^2+7)^{100}\) with respect to \(x\).

Exercise 12

In exercise 9, we proved that the derivative of \((f(x))^2\) with respect to \(x\) is \(2\,f(x)\,f'(x)\). Re-prove this fact using the chain rule.

Exercise 13

Prove the following 'extended chain rule':

\[ \dfrac{d}{dx} \bigl[ f(g(h(x))) \bigr] = f'(g(h(x)))\,g'(h(x))\,h'(x). \]

Generalise to the composition of any number of functions.

The following exercise shows how, if you know the derivative of \(x^n\) for a positive number \(n\), you can find the derivative of \(x^{-n}\).

Exercise 14

Let \(g(x) = x^n\), where \(n\) is positive. Using the facts \(g'(x) = nx^{n-1}\) and \(\dfrac{d}{dx} \Biggl(\dfrac{1}{x}\Biggr) = -\dfrac{1}{x^2}\) and the chain rule, calculate \(\dfrac{d}{dx} \Biggl(\dfrac{1}{x^n}\Biggr)\).

The quotient rule

Theorem Quotient rule

Let \(f,g\) be differentiable functions. Then the derivative of their quotient is

\[ \dfrac{d}{dx} \Biggl(\dfrac{f(x)}{g(x)}\Biggr) = \dfrac{g(x)\,f'(x) - f(x)\,g'(x)}{(g(x))^2}. \]

Alternatively, we can write

\[ \dfrac{d}{dx} \Biggl( \dfrac{f}{g} \Biggr) = \dfrac{g\,\dfrac{df}{dx} - f\,\dfrac{dg}{dx}}{g^2}. \]


Let \(f(x) = \dfrac{x^2 + 1}{x^2 - 1}\). What is \(f'(x)\)?


Using the quotient rule, we have

\begin{align*} f'(x) &= \dfrac{(x^2 - 1)\,\dfrac{d}{dx}(x^2 + 1) - (x^2 + 1)\,\dfrac{d}{dx}(x^2 - 1)}{(x^2 - 1)^2} \\ &= \dfrac{(x^2 - 1)\cdot 2x - (x^2 + 1)\cdot 2x}{(x^2 - 1)^2} = \dfrac{-4x}{(x^2 - 1)^2}. \end{align*}


Let \(f(x) = \dfrac{x}{\sqrt{x^2+1}}\). Find \(f'(x)\).


We first apply the quotient rule:

\[ f'(x) = \dfrac{\sqrt{x^2+1}\,\dfrac{d}{dx}(x) - x\,\dfrac{d}{dx}\sqrt{x^2+1}}{x^2 + 1}. \]

To differentiate \(\sqrt{x^2 + 1}\), we use the chain rule:

\begin{align*} \dfrac{d}{dx} (x^2 + 1)^{\frac{1}{2}} &= \dfrac{1}{2}(x^2 + 1)^{-\frac{1}{2}}\,\dfrac{d}{dx}(x^2 + 1) \\ &= \dfrac{1}{2}(x^2+1)^{-\frac{1}{2}}(2x) \\ &= x (x^2 + 1)^{-\frac{1}{2}}. \end{align*}

Now returning to \(f'(x)\), we obtain

\begin{align*} f'(x) &= \dfrac{\sqrt{x^2 + 1} \cdot 1 - x \cdot x (x^2 + 1)^{-\frac{1}{2}}}{x^2 + 1} \\ &= \dfrac{(x^2 + 1) - x^2}{(x^2 + 1)^{\frac{3}{2}}} \\ &= (x^2 + 1)^{-\frac{3}{2}}. \end{align*}

The quotient rule can be proved using the product and chain rules, as the next two exercises show.

Exercise 15

Let \(g\) be a differentiable function. Using the chain rule, show that

\[ \dfrac{d}{dx} \Biggl( \dfrac{1}{g(x)} \Biggr) = -\dfrac{g'(x)}{(g(x))^2}. \]

(This is a generalisation of exercise 14.)

Exercise 16

Using the previous exercise and the product rule, find the derivative of \(f(x) \cdot \dfrac{1}{g(x)}\), and hence prove the quotient rule.

Next page - Content - Summary of differentiation rules