# Chain rule for partial derivatives intuition

Can somebody give me an intuitive explanation for the below equations. I'm not sure how they come about and how they can be perceived logically.

$$\frac{\partial z}{\partial s} =\frac{\partial f}{\partial x}\frac{\partial x}{\partial s}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial s} \ \ \text{and} \ \ \frac{\partial z}{\partial t} =\frac{\partial f}{\partial x}\frac{\partial x}{\partial t}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial t}$$

• Presumably $z = f$. – Yuval Filmus Jan 28 '15 at 23:38
• @YuvalFilmus Yes, my apologies. – Mark Jan 28 '15 at 23:39
• @YuvalFilmus I don't think it's correct to say that $z = f$ ; rather, $z(s,t) = f(x(s,t),y(s,t))$. $f$ and $z$ aren't the same function. People often aren't careful to distinguish $z$ and $f$ in this context but I find that to be confusing. – littleO Jan 29 '15 at 0:18

Suppose for simplicity that $z = f(x,y)$ and $x,y$ are functions of $s$. The partial derivatives of $z$ given a first-order approximation for $z$: $$f(x+\Delta x,y+\Delta y) \approx f(x,y) + \frac{\partial f}{\partial x}(x,y) \Delta x + \frac{\partial f}{\partial y}(x,y) \Delta y.$$ The error in this approximation should be "small", say $o(\Delta x+\Delta y)$ (if you don't know what this means, it's not important). Similarly, $$x(s+\Delta s) \approx x(s) + \frac{\partial x}{\partial s}(s) \Delta s, \quad y(s+\Delta s) \approx y(s) + \frac{\partial y}{\partial s}(s) \Delta s.$$ Finally, $\frac{\partial f}{\partial s}$ satisfies $$f(x(s+\Delta s),y(s+\Delta s)) \approx f(x(s),y(s)) + \frac{\partial f(x,y)}{\partial s}(s) \Delta s.$$ We can now prove the formula: \begin{align*} f(x(s+\Delta s),y(s+\Delta s)) &\approx f(x(s) + \frac{\partial x}{\partial s}(s) \Delta s, y(s) + \frac{\partial y}{\partial s}(s) \Delta s) \\ &\approx f(x(s),y(s)) + \frac{\partial f}{\partial x}(x,y) \frac{\partial x}{\partial s}(s) \Delta s + \frac{\partial f}{\partial y}(x,y) \frac{\partial y}{\partial s}(s) \Delta s. \end{align*}

According to the chain rule $$(g \circ f)'(x_0) = g'(f(x_0))f'(x_0)$$

The matrix of the composition of two linear funtions is the product of their respective matrices. Hence the matrix $(g \circ f)'(x_0)$ of $d_{x_0}(g \circ f)$ is

$$\begin{pmatrix}\frac{\partial z}{\partial s} & \frac{\partial z}{\partial t}\end{pmatrix} = \begin{pmatrix}\frac{\partial f}{\partial x} & \frac{\partial f}{\partial y}\end{pmatrix} \begin{pmatrix}\frac{\partial x}{\partial s} \\\frac{\partial y}{\partial t}\end{pmatrix}$$

To illustrate suppose $f$ and $g$ are given by

$$w = g(x,y,z), \ \ x = f_1 (s,t), \ \ y = f_2(s,t), \ \ z = f_3(s,t)$$

Then by the chain rule

$$\begin{pmatrix}\frac{\partial w}{\partial s} & \frac{\partial w}{\partial t}\end{pmatrix} = \begin{pmatrix}\frac{\partial g}{\partial x} & \frac{\partial g}{\partial y}& \frac{\partial g}{\partial z}\end{pmatrix} \begin{pmatrix}\frac{\partial x}{\partial s} & \frac{\partial x}{\partial t} \\ \frac{\partial y}{\partial s} & \frac{\partial y}{\partial t}\\\frac{\partial z}{\partial s} & \frac{\partial z}{\partial t}\end{pmatrix}$$

Which yields

\begin{align}\frac{\partial w}{\partial s} &= \frac{\partial g}{\partial x}\frac{\partial x}{\partial s}+ \frac{\partial g}{\partial y}\frac{\partial y}{\partial s}+ \frac{\partial g}{\partial z}\frac{\partial z}{\partial s}\\\frac{\partial w}{\partial t} &=\frac{\partial g}{\partial x}\frac{\partial x}{\partial t}+ \frac{\partial g}{\partial y}\frac{\partial y}{\partial t}+ \frac{\partial g}{\partial z}\frac{\partial z}{\partial t} \end{align}

*Note: Take a close look to transformation matrices and Jacobian Matrices and this may also help.

Just be aware that the $\partial f$ in $\frac{\partial f}{\partial x}$ is different from (and independent of) the $\partial f$ in $\frac{\partial f}{\partial y}$. Think of the former $\partial f$ as a change in $f$ due to a change in $x$ and the latter as a change in $f$ due to a change in $y$. Because a change in $s$ causes both a change in $y$ and a change in $x$, we need to add the change in $f$ due to a change in $x$ (which in turn was caused by a change in $s$) to the change in $f$ due to a change in $y$ (which in turn was caused by a change in $s$). If you need more clarification, re-read my first sentence.

\begin{align} z(s + \Delta s, t) &= f(x(s + \Delta s, t),y(s + \Delta s, t)) \\& \approx f \left(x(s,t) + \frac{\partial x(s,t)}{\partial s} \Delta s,y(s,t) + \frac{\partial y(s,t)}{\partial s} \Delta s \right) \\ \tag{$\spadesuit$}&\approx f(x(s,t),y(s,t)) + \frac{\partial f(x(s,t),y(s,t))}{\partial x} \frac{\partial x(s,t)}{\partial s} \Delta s \\& \qquad \qquad \qquad \quad+ \frac{\partial f(x(s,t),y(s,t))}{\partial y}\frac{\partial y(s,t)}{\partial s} \Delta s. \end{align}

Comparing this with $$z(s + \Delta s, t) \approx z(s,t) + \frac{\partial z(s,t)}{\partial s} \Delta s$$ we discover that $$\frac{\partial z(s,t)}{\partial s} = \frac{\partial f(x(s,t),y(s,t))}{\partial x} \frac{\partial x(s,t)}{\partial s} + \frac{\partial f(x(s,t),y(s,t))}{\partial y}\frac{\partial y(s,t)}{\partial s} .$$

The key step is in line ($\spadesuit$), where we use the approximation $$f(x + \Delta x, y + \Delta y) \approx f(x,y) + \frac{\partial f(x,y)}{\partial x} \Delta x + \frac{\partial f(x,y)}{\partial y}{\Delta y}.$$

• Why does the approximation $\spadesuit$ hold? – fishiwhj Jul 24 '15 at 2:44