## The Chain Rule

Last update: 20 July 2012

## The Chain Rule

There are different kinds of derivatives:

$\text{What is the relation between}\phantom{\rule{1em}{0ex}}\frac{df}{dx}\phantom{\rule{1em}{0ex}}\text{and}\phantom{\rule{1em}{0ex}}\frac{df}{dg}\phantom{\rule{1em}{0ex}}\text{?}$

$\begin{array}{cc}\phantom{\rule{4em}{0ex}}⟶\frac{d}{dg}⟶& \phantom{\rule{4em}{0ex}}⟶\frac{d}{dx}⟶\\ \\ \phantom{\rule{2em}{0ex}}\frac{d{g}^{0}}{dg}=\frac{d1}{dg}=0\text{,}& \phantom{\rule{2em}{0ex}}\frac{d{g}^{0}}{dx}=\frac{d1}{dx}=0\text{,}\\ \\ \phantom{\rule{2em}{0ex}}\frac{dg}{dg}=1\text{,}& \phantom{\rule{2em}{0ex}}\frac{dg}{dx}=\frac{dg}{dx}\text{,}\\ \\ \phantom{\rule{2em}{0ex}}\frac{d{g}^{2}}{dg}=\frac{dg·g}{dg}& \phantom{\rule{2em}{0ex}}\frac{d{g}^{2}}{dx}=\frac{dg·g}{dx}\\ \phantom{\rule{3.8em}{0ex}}=g\frac{dg}{dg}+\frac{dg}{dg}g& \phantom{\rule{3.8em}{0ex}}=g\frac{dg}{dx}+\frac{dg}{dx}g\\ \phantom{\rule{3.8em}{0ex}}=g+g=2g\text{,}& \phantom{\rule{3.8em}{0ex}}=2g\frac{dg}{dx}\text{,}\\ \\ \phantom{\rule{2em}{0ex}}\frac{d{g}^{3}}{dg}=\frac{d{g}^{2}·g}{dg}& \phantom{\rule{2em}{0ex}}\frac{d{g}^{3}}{dx}=\frac{d{g}^{2}·g}{dx}\\ \phantom{\rule{3.8em}{0ex}}={g}^{2}\frac{dg}{dg}+\frac{d{g}^{2}}{dg}g& \phantom{\rule{3.8em}{0ex}}={g}^{2}\frac{dg}{dx}+\frac{d{g}^{2}}{dx}g\\ \phantom{\rule{3.8em}{0ex}}={g}^{2}+2g·g=3{g}^{2}\text{,}& \phantom{\rule{3.8em}{0ex}}={g}^{2}\frac{dg}{dx}+2g\frac{dg}{dx}g\\ & \phantom{\rule{3.8em}{0ex}}={g}^{2}\frac{dg}{dx}+2{g}^{2}\frac{dg}{dx}\\ & \phantom{\rule{3.8em}{0ex}}=3{g}^{2}\frac{dg}{dx}\text{,}\\ \\ \phantom{\rule{2em}{0ex}}\frac{d{g}^{4}}{dg}=\frac{d{g}^{3}·g}{dg}& \phantom{\rule{2em}{0ex}}\frac{d{g}^{4}}{dx}=\frac{d{g}^{3}·g}{dx}\\ \phantom{\rule{3.8em}{0ex}}={g}^{3}\frac{dg}{dg}+\frac{d{g}^{3}}{dg}g& \phantom{\rule{3.8em}{0ex}}={g}^{3}\frac{dg}{dx}+\frac{d{g}^{3}}{dx}g\\ \phantom{\rule{3.8em}{0ex}}={g}^{3}+3{g}^{2}·g=4{g}^{3}\text{,}& \phantom{\rule{3.8em}{0ex}}={g}^{3}\frac{dg}{dx}+3{g}^{2}\frac{dg}{dx}g\\ & \phantom{\rule{3.8em}{0ex}}={g}^{3}\frac{dg}{dx}+3{g}^{3}\frac{dg}{dx}\\ & \phantom{\rule{3.8em}{0ex}}=4{g}^{3}\frac{dg}{dx}\text{,}\\ \\ \phantom{\rule{4.5em}{0ex}}⋮& \phantom{\rule{4.5em}{0ex}}⋮\\ \\ \phantom{\rule{2em}{0ex}}\frac{d{g}^{6342}}{dg}=6342{g}^{6341}\text{,}& \phantom{\rule{2em}{0ex}}\frac{d{g}^{6342}}{dx}=6342{g}^{6341}\frac{dg}{dx}\text{,}\\ \\ \phantom{\rule{2em}{0ex}}\frac{d\left(3{g}^{2}+2g+7\right)}{dg}=\frac{d\left(3{g}^{2}\right)}{dg}+\frac{d\left(2g\right)}{dg}+\frac{d7}{dg}& \phantom{\rule{2em}{0ex}}\frac{d\left(3{g}^{2}+2g+7\right)}{dx}=\frac{d\left(3{g}^{2}\right)}{dx}+\frac{d\left(2g\right)}{dx}+\frac{d7}{dx}\\ \phantom{\rule{3.8em}{0ex}}=3\frac{d{g}^{2}}{dg}+2\frac{dg}{dg}+0& \phantom{\rule{3.8em}{0ex}}=3\frac{d{g}^{2}}{dx}+2\frac{dg}{dx}+0\\ \phantom{\rule{3.8em}{0ex}}=3·2g+2·1& \phantom{\rule{3.8em}{0ex}}=3·2g\frac{dg}{dx}+2\frac{dg}{dx}\\ \phantom{\rule{3.8em}{0ex}}=6g+2\text{,}& \phantom{\rule{3.8em}{0ex}}=\left(6g+2\right)\frac{dg}{dx}\text{,}\end{array}$

Thus, we are seeing that

$\frac{df}{dx}=\frac{df}{dg}\frac{dg}{dx}\text{,}\phantom{\rule{4em}{0ex}}\text{which is the chain rule.}$

## Notes

These notes are from lecture notes of Arun Ram from May 20, 2004.