A common misconception leads to an incorrect calculation of the derivative of a composition of functions. This demo contrasts the resulting error with the correct answer, given by the chain rule.

The first window graphs two functions: `f(x)` (in gray) and its derivative, `f '(x)` (in green).

In the second window, we see three curves, a graph of the composition f(g(x)) (in gray), an incorrect calculation of the derivative of this composed function with respect to x (in green), and a correct calculation (in red).

The incorrect calculation, common among those unfamiliar with the chain rule, is given by `f '(g(x))`. (For example, one might be inclined to think that the derivative with respect to x of sin(2x) is cos(2x)).

One useful way to think about the chain rule is to consider the rate at which we are "moving through" the values of the function `f(x)`. For example, though `sin(x)` and `sin(2x)` both express rates of change as one moves through the values of the sine function, the function `sin(2x)` goes through those values twice as fast as does the function `sin(x)`, which makes the graph twice as steep, and requires us to correct our mistake (cos(2x)) by multiplying by 2. The "correction factor" of `g' (x)` tells us how fast we are moving through the values of the function `f(x)`.

The correct graph of the derivative of f(g(x)) with respect to x is shown in red.