# Why does the chain rule apply in this problem involving iterated partials?

In the section in my multivar book covering iterated partials, there is this example:

Example

Let $$z = f(x, y) = e^xsinxy$$ and write $x = g(s, t)$, $y = h(s, t)$ for certain functions $g$ and $h$. Let $$k(s, t) = f(g(s, t), h(s, t)).$$ Calculate $k_{st}$.

Solution

By the chain rule, $$k_s = f_xg_s + f_yh_s = \ldots$$ Differentiating in $t$ using the product rule gives $$k_{st} = (f_x)_tg_s + f_xg(s)_t + (f_y)_th_s + f_y(h_s)_t.$$ Applying the chain rule again to $(f_x)_t$ and $(f_y)_t$ gives $$(f_x)_t = f_{xx}g_t + f_{xy}h_t \quad \text{and} \quad (f_y)_t = f_{yx}g_t + f_{yy}h_t$$ ... (rest of solution omitted)

This is the first time the chain rule is used in this way, and no explanation is given. I don't understand how the chain rule is used in the last step. Where do $g_t$ and $h_t$ come into the picture, since $g$ and $h$ are not related to $f$, they are only related to $k$ (which is just $f$ such that $x = g(s,t)$ and $y = h(s,t)$)? Can someone point me in the right direction?

-

You wouldn't need to apply the multivariable chain rule to find any partial derivatives of $f(x,y)=e^y \sin xy$, since $x$ and $y$ don't depend on any other variables/parameters.

Perhaps this example is trying to introduce how the multivariable chain rule is used by having you suppose that $x$ and $y$ do depend on the parameters $s$ and $t$: assume $x=g(s,t)$ and $y=h(s,t)$.

Before you try to understand why you may want to do this make sure that you understand how the chain rule works if $x$ and $y$ only depend on a single parameter $t$: $x=g(t)$ and $y=h(t)$. Why would you want to do this? Suppose $f(x,y)$ represents the temperature at a point $(x,y)$ in the plane. In addition, suppose your position is changing with respect to time $t$ according to the parametric equations $x=g(t), y=h(t)$. The chain rule here allows you to calculate the rate at which the temperature is changing along your path.

-

Well, it's because when derived in $t$ you have to take into account that $h$ also depends on it. The chain rule states that \begin{align} \frac{\partial}{\partial s} f\big(x(s,t),y(s,t)\big) &= \frac{\partial f}{\partial x} \frac{\partial x}{\partial s} + \frac{\partial f}{\partial y} \frac{\partial y}{\partial s}\\ \frac{\partial}{\partial t} f\big(x(s,t),y(s,t)\big) &= \frac{\partial f}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial f}{\partial y} \frac{\partial y}{\partial t} \end{align}

so, if instead of $f$ you have $f_x$ or $f_y$, then \begin{align} \frac{\partial}{\partial t} f_x\big(x(s,t),y(s,t)\big) &= \frac{\partial f_x}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial f_x}{\partial y} \frac{\partial y}{\partial t} = \frac{\partial^2 f}{\partial x^2} \frac{\partial x}{\partial t} + \frac{\partial^2 f}{\partial y \partial x} \frac{\partial y}{\partial t}\\ \frac{\partial}{\partial t} f_y\big(x(s,t),y(s,t)\big) &= \frac{\partial f_y}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial f_y}{\partial y} \frac{\partial y}{\partial t} = \frac{\partial^2 f}{\partial x \partial y} \frac{\partial x}{\partial t} + \frac{\partial^2 f}{\partial y^2} \frac{\partial y}{\partial t} \end{align}

In the books case $x = g$ and $y = h$. The thing is that, unless I made a huge mistake, the crossed derivatives on your last equality are reversed.

-