Partial differentiation in transformed coordinates Following lecture notes from MIT it says that, given some variable $A = A(x, y, z(x, y, r, t), t)$ where $r$ is a transformed vertical coordinate
$\left. \frac{\partial A}{\partial x} \right|_r = \left. \frac{\partial A}{\partial x} \right|_z + \frac{\partial A}{\partial z} \left. \frac{\partial z}{\partial x} \right|_r $
I can see this works by trying concrete examples, and I think I can see the second term on the right is due to the chain rule (because $A$ is a function of $z$ is a function of $x$).  But where does the first term on the right come from?   Is it because $A$ is also a function of $x$ explicitly?  Can someone point me to a piece of theory that underpins this?

I think that the confusion comes from transforming from $(x,z) \rightarrow (x,r)$. These 2 $x$s are not the same in terms of partial derivatives because, the first assumes that $z$ remains constant and the second assumes that $r$ remains constant. So if instead we were to start with:
$$A(x(x^\prime), z(x^\prime,r))$$
Then the chain rule would give us:
$$\frac{\partial A}{\partial x^\prime}
 =\frac{\partial A}{\partial x} \frac{\partial x}{\partial x^\prime}
 +\frac{\partial A}{\partial z} \frac{\partial z}{\partial x^\prime}$$
where what you previously wrote as
$\frac{\partial A}{\partial x}\big\bracevert_r$ is now written $\frac{\partial A}{\partial x^\prime}$ and what you previously wrote as $\frac{\partial A}{\partial x}\big\bracevert_z$ is now written as just $\frac{\partial A}{\partial x}$. And of course $\frac{\partial x}{\partial x^\prime}=1$
