Note: These explanations are in the process of being adapted from my textbook.
I'm trying to make them each a "standalone" treatment of a concept, but there may still
be references to the narrative flow of the book that I have yet to remove.
This work is under development and has not yet been professionally edited.
If you catch a typo or error, or just have a suggestion, please submit a note here. Thanks!

# The Chain Rule

The most important rule of derivatives for economics is the chain rule; and it’s especially important to understand the intuition behind what it means, in addition to the mechanics of how to use it.

The mathematical formulation of the chain rule is this: if $h(x) = f(g(x))$, then

$\frac{dh}{dx} = \frac{df}{dg} \times \frac{dg}{dx}$

For example, suppose we have the function $h(x) = (3x + 2)^2$. We can rewrite this as $f(g(x))$ if $$f(g) = g^2$$ $$g(x) = 3x + 2$$ Therefore $$\frac{df}{dg} = 2g$$ $$\frac{dg}{dx} = 3$$ so we have $$\frac{dh}{dx} = \frac{df}{dg} \times \frac{dg}{dx} = 2(3x+2) \times 3 = 18x + 12$$ Note that if we had expanded $h(x)$ into $9x^2 + 12x + 4$, we would have gotten this same result by taking the simple derivative.

So, what’s the intuition here? Basically, the question is how the whole expression changes due to a small change in the exogenous variable $x$. The expression $df/dg$ describes the rate at which the outer function changes per unit change in the inner function; and $dg/dx$ describes the rate at which the inner function changes per unit change in $x$. This “multiplication of rates” is familiar to us from algebra. For example, suppose a car gets 30 miles per gallon. We can therefore write the gallons required to drive $m$ miles as $$g(m) = \frac{m}{30}$$ If we want to figure out how many gallons we’re using as a function of the number of hours driven, instead of miles, then this is further going to depend on the speed driven (i.e., how hours relate to miles). Therefore if we say that the number of miles driven in $h$ hours is given by $m(h)$, then the gallons required to drive $h$ hours becomes: $$g(m(h)) = \frac{m(h)}{30}$$ Now suppose we’re interested in the rate that we’re using gasoline per hour; this is the derivative of $g(m(h))$ with respect to $h$. In order to find that, we can use the chain rule: $$\frac{dg}{dh} = \frac{dg}{dm} \times \frac{dm}{dh}$$ which we can now interpret as $$\frac{\text{gallons}}{\text{hour}} = \frac{\text{gallons}}{\text{mile}} \times \frac{\text{miles}}{\text{hour}}$$ Therefore, for example, if the car’s fuel efficiency is given by $\frac{dg}{dm} = \frac{1}{30}$ gallons per mile, and is traveling at $\frac{dm}{dh} = 60$ miles per hour, it will use $\frac{1}{30} \times 60 = 2$ gallons per hour.

## The chain rule for multivariable functions

This same principle of multiplied rates also true if the functions in question are multivariate. For example, the function $$h(x,y) = (3x + y)^2$$ may be decomposed into $$f(g) = g^2$$ $$g(x,y) = 3x + y$$ so the partial derivative of $h$ with respect to $x$ would be $${\partial h \over \partial x} = {df \over dg} \times {\partial g \over \partial x} = 2(3x + y)\times 3 = 18x + 6y$$ Note that this is exactly the same as the example above if $y = 2$.

For more on this, Harvey Mudd College has a great explanation of how the multivariable chain rule works, which is well worth checking out.

Copyright (c) Christopher Makler / econgraphs.org