The [[Differentiation Rules#Chain Rule|Chain Rule]] for a univariate function $f(x)$ where $x$ depends on $t$ states:
$ \frac{df}{dt} = \frac{df}{dx} \cdot \frac{dx}{dt}$
Now, suppose if $f$ is a function of multiple variables, where each $x_i$ depends on the same parameter $t$.
$ f\big(x_1(t), \dots, x_n(t)\big)$
The *multivariate Chain rule* means to apply the Chain rule to each variable $x_i$ and summing all contributions. The outcome is the *Total Derivative* of $f$ with respect to $t$.
$
\frac{df(x_1,\dots,x_n)}{dt}=
\left(\frac{\partial f}{\partial x_1}*\frac{\partial x_1}{\partial t}\right)
+ \cdots +
\left(\frac{\partial f}{\partial x_n}*\frac{\partial x_n}{\partial t}\right)
$
Interpretation:
- $\frac{\partial f}{\partial x_i}$ measures how $f$ responds to changes in the variable $x_i$.
- $\frac{\partial x_i}{\partial t}$ measures how $x_i$ changes as $t$ changes.
Multiplying these and summing over all $i$ gives the "net effect" of $t$ on $f$.
**Vector notation:** If we arrange the [[Partial Derivative|partial derivatives]] $\frac{\partial f}{\partial x_i}$ into a [[Jacobian#Jacobian Vector|Jacobian vector]] (row vector by convention), and gather the rates $\frac{\partial x_i}{\partial t}$ into a column vector, we get:
$
\frac{df}{dt}=
\begin{bmatrix}
\frac{\partial f}{\partial x_1} &\cdots & \frac{\partial f}{\partial x_n}
\end{bmatrix}
*\begin{bmatrix}
\frac{\partial x_1}{\partial t} \\[4pt] \frac{\partial x_2}{\partial t} \\\vdots \\ \frac{\partial x_n}{\partial t}
\end{bmatrix}
$
The Total Derivative becomes:
$ \frac{df}{dt} = \frac{df}{dx} \cdot \frac{dx}{dt} = J_f \cdot \frac{dx}{dt}$
> [!note:]
> We have assumed all $x_i$ depend on the same parameter $t$ for simplicity, but this is not necessary. If each $x_i$ depends on different parameters, the Total Derivative can still be defined by considering how $f$ changes w.r.t. each parameter individually and then combining these changes.
## Example
Consider a function $f(x(u(t)))$, where:
+ $f(x)$ is scalar-valued, depending on $x = (x_1, x_2)$.
+ $x(u)$ is vector-valued, depending on $u=(u_1, u_2)$.
+ $u(t)$ is vector-values, depending on scalar $t$.
$
f(x) = f(x_1, x_2), \quad
x(u) = \begin{bmatrix} x_1(u_1, u_2) \\ x_2(u_1, u_2) \end{bmatrix}, \quad
u(t) = \begin{bmatrix} u_1(t) \\ u_2(t) \end{bmatrix}
$
The chain rule for this composition can be written as:
$ \frac{df}{dt} = \frac{\partial f}{\partial x} \cdot \frac{ \partial x}{\partial u} \cdot \frac{\partial u}{ \partial t} $
In matrix form:
$
\frac{df}{dt} =
\underbrace{
\begin{bmatrix}
\frac{\partial f}{\partial x_1} &
\frac{\partial f}{\partial x_2}
\end{bmatrix}}_{J_f} \quad
\underbrace{
\begin{bmatrix}
\frac{\partial x_1}{\partial u_1} & \frac{\partial x_1}{\partial u_2} \\[4pt]
\frac{\partial x_2}{\partial u_1} & \frac{\partial x_2}{\partial u_2}
\end{bmatrix}}_{J_x} \quad
\underbrace{
\begin{bmatrix}
\frac{\partial u_1}{\partial t} \\[4pt]
\frac{\partial u_2}{\partial t}
\end{bmatrix}
}_{\frac{\partial u}{\partial t}}
$
Simplified:
$ \frac{df}{dt}= J_f*J_x*\frac{\partial u}{\partial t} $