# What is the chain rule

Definition/Summary

The chain rule is an elementary rule of calculus, but it can be understood without any knowledge of calculus:

If $a$ depends on $b$, and $b$ depends on $c$, then the rate at which a changes with respect to b times the rate at which b changes with respect to c equals the rate at which a changes with respect to c.

In other words: small change in a per small change in b times small change in b per small change in c equals small change in a per small change in c.

In symbols, derivatives may be treated as ordinary fractions: two copies of $db$ may be cancelled in $da/db\ db/dc = da/dc$ (if you don't understand calculus, then read "d" as meaning "a small change in").

For example, if pressure depends on length, and length depends on temperature, then the speed at which pressure changes when you change the temperature equals the speed at which pressure changes when you change the length times the speed at which length changes when you change the temperature.

Equations

$$\frac{da}{dc}\ =\ \frac{da}{db}\,\frac{db}{dc}$$

$$(a\circ b)' = (a'\circ b)b'\text{, ie }(a(b(c)))' = a'(b(c))b'(c)$$

Partial derivative version (if $a$ depends on $b_1,\cdots b_n$, and $b_1,\cdots b_n$ depend only on $c$):

$$\frac{da}{dc}\ =\ \frac{\partial a}{\partial b_1}\frac{db_1}{dc}\ +\ \cdots \frac{\partial a}{\partial b_n}\frac{db_n}{dc}\ =\ (\mathbf{\nabla_b}\,a)\cdot \frac{d\mathbf{b}}{dc}$$

Partial derivative version (if $a$ depends on $b_1,\cdots b_n$, and $b_1,\cdots b_n$ depend on $c_1,\cdots c_m$):

$$\frac{\partial a}{\partial c_i}\ =\ \sum_{j\ =\ 1}^n\frac{\partial a}{\partial b_j} \frac{\partial b_j}{\partial c_i} \text{, for }i\ =\ 1,\cdots m$$

This is the same as the saying that the gradient vector of the composite function is the matrix product of the gradient vector and the Jacobian matrix:

$$(\mathbf{\nabla_c}\,a)^T\ =\ \frac{\partial a}{\partial (b_1,\cdots b_n)}\frac{\partial (b_1\cdots b_n)}{\partial (c_1,\cdots c_m)}\ =\ (\mathbf{\nabla_b}\,a)^T\frac{\partial (b_1,\cdots b_n)}{\partial (c_1,\cdots c_m)}$$

Similarly, for a vector $(a_1,\cdots a_k)$, the Jacobian matrix of the composite function is the matrix product of the two individual Jacobians:

$$\frac{\partial (a_1,\cdots a_k)}{\partial (c_1,\cdots c_m)}\ =\ \frac{\partial (a_1,\cdots a_k)}{\partial (b_1,\cdots b_n)}\frac{\partial (b_1,\cdots b_n)}{\partial (c_1,\cdots c_m)}$$

Extended explanation

Integration by substitution:

Substitution (used in evaluating integrals, or in solving differential equations) involves applying the chain rule to replace a "d" term (a differential).

We may write $$db\ =\ \frac{db}{dc}\,dc\text{ .}$$

For example, if $b = c^2$, then $db/dc\ =\ 2c\text{, or }db\ =\ 2c\,dc$, and so $\int 2c\,\sin (c^2)\,dc\ =\ \,\int\,\sin b\,db$$\ =\ -\cos b\,+\,\text{constant}\ =\ -\cos c^2\,+\,\text{constant}$

* This entry is from our old Library feature. If you know who wrote it, please let us know so we can attribute a writer. Thanks!