Chain Rule

Overview


The chain rule is a formula for computing the derivative of a function which is the composition of two other functions.

In particular, given
{% h(x) = f(g(x)) %}
the chain rule provides an analytic method for determining {% h'(x) %}.

Single Variable


When the functions in question are functions of a single variable {% x %}, the chain rule takes the form:
{% [f(g(x))]' = f'(g(x)) \times g'(x) %}

Multi Variable Chain Rule


When the function {% f %} is a function of multiple inputs
{% f(x_1, ... ,x_n) %}
The chain rule is
{% \frac{\partial{\vec{f}}}{\partial{\vec{x}}} = \frac{\partial{\vec{f}}}{\partial{\vec{g}}} \times \frac{\partial{\vec{g}}}{\partial{\vec{x}}} %}
Where the Jacobian of a multivariable function is given by:
{% \frac{\partial{\vec{f}}}{\partial{\vec{x}}} =\begin{bmatrix} \frac{\partial{f_1}}{\partial{x_1}} & \frac{\partial{f_1}}{\partial{x_2}} & ... & \frac{\partial{f_1}}{\partial{x_n}} \\ \frac{\partial{f_2}}{\partial{x_1}} & \frac{\partial{f_2}}{\partial{x_2}} & ... & \frac{\partial{f_2}}{\partial{x_n}} \\ ... \\ \frac{\partial{f_m}}{\partial{x_1}} & \frac{\partial{f_m}}{\partial{x_2}} & ... & \frac{\partial{f_m}}{\partial{x_n}} \\ \end{bmatrix} %}

Examples