Partial derivative with variables where some are dependent on each other

Say I have a function $$f(x,y,z,w)$$.

Let $$x$$ and $$y$$ each be a function of $$z$$ and $$w$$ so $$x=x(z,w)$$ and $$y=y(z,w)$$.
Then we have a function of the form

$$f(x(z,w),y(z,w),z,w)$$

Using the chain rule for functions of multiple variables I get

$$\frac{\partial f}{\partial z} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial z}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial z}+ \frac{\partial f}{\partial z}\frac{\partial z}{\partial z}+ \frac{\partial f}{\partial w}\frac{\partial w}{\partial z}$$

As $$w$$ is not dependent on $$z$$ then $$\frac{\partial w}{\partial z}=0$$

$$\frac{\partial f}{\partial z} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial z}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial z}+ \frac{\partial f}{\partial z}1+ \frac{\partial f}{\partial w}0$$

$$\frac{\partial f}{\partial z} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial z}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial z}+ \frac{\partial f}{\partial z}$$

This means $$\frac{\partial x}{\partial z}=0$$ and $$\frac{\partial y}{\partial z}=0$$ but this is not necessarily true because $$x(z,w)$$ and $$y(z,w)$$ are dependent on $$z$$.

I am unsure where this contradiction is coming from. I think I must be applying the chain rule incorrectly. I am also unsure when partially differentiating with respect to $$z$$ whether to treat just $$w$$ as a constant or $$x,y$$ and $$w$$ as constants.

I found similar problems:
Partial derivative of a two variables function, one of which dependent on the other
Partial Derivatives - constants
However these discussed functions that can be written in terms of one variable whereas the function I am confused with can be written in terms of two variables at the least ($$z$$ and $$w$$).

Please explain what I am doing wrong and thank you for any help!

$$f(x(z,w),y(z,w),z,w)=g(z,w)$$ Don't confuse $$\frac{\partial f}{\partial z}$$ with $$\frac{\partial g}{\partial z}$$

$$\frac{\partial f}{\partial z}$$ means the partial derivative of $$f$$ with respect to $$z$$ for $$x$$ independant of $$z$$, which is not the same for $$g$$.

Thus the correct expression is : $$\frac{\partial g}{\partial z} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial z}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial z}+ \frac{\partial f}{\partial z}$$

It is clear that $$\frac{\partial g}{\partial z} \neq \frac{\partial f}{\partial z}$$

However, loosely the same symbol $$f$$ is used instead of two distinct symbols $$f$$ and $$g$$. This is acceptable for people familiar with this ambiguous writting. They are aware of apparent contradictions which can arise and they avoid mistakes in mentally making the distinction between the two different signification of the symbol $$f$$.

Since this seems difficult to well understand, consider a concret example :

$$f(x,y,z,w)=5x+4y+3z+2w$$

$$\frac{\partial f}{\partial x}=5\quad;\quad \frac{\partial f}{\partial y}=4\quad;\quad \frac{\partial f}{\partial z}=3$$

Then consider another function $$g(z,w)$$ defined from the preceeding function in the particular case of $$x(z,w)=6z+7w\quad\text{and}\quad y(z,w)=8z+9w$$ $$\frac{\partial x}{\partial z}=6\quad;\quad \frac{\partial y}{\partial z}=8$$ $$g(z,w)=5(6z+7w)+4(8z+9w)+3z+2w$$ $$g(z,w)=65z+73w$$ Obviously $$5x+4y+3z+2w$$ is something else than $$65z+73w$$ . So $$f(x,y,z,w)$$ and $$g(z,w)$$ are not a same function. They cannot be confused.

$$\frac{\partial g}{\partial z}=65$$

We see that $$\frac{\partial g}{\partial z}$$ is obtained directly by partial differentiation of $$g(z,w)$$. But instead of, if we want to compute $$\frac{\partial g}{\partial z}$$ indirectly from the properties of the functions $$f(x,y,z,w)$$ , $$x(z,w)$$ and $$y(z,w)$$ we apply the chain rule of derivations : $$\frac{\partial g}{\partial z} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial z}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial z}+ \frac{\partial f}{\partial z}$$ $$\frac{\partial g}{\partial z} =5*6+4*8+3=65$$ As expected, the same result as before $$65$$ is obtained without expressing explicitely $$g(z,w)$$. This is purely a consequence of the chain rule. There is no need for more explanation insofar the theory of the chain rule was studied and understood.

• Does this mean say $\frac{\partial x}{\partial z}$ has two values? Wouldn't I get $\frac{\partial x}{\partial z}=0$ in the $f$ case, as we treat $x$ as independent of $z$, but $\frac{\partial x}{\partial z}$ could be any value in the $g$ case as we no longer treat $x$ as a constant? Is there a way of distinguishing between these two values? – Jacob Jan 17 '20 at 23:00
• Not at all ! ∂x/∂z has much more than two values, but an infinity of values. This is a function of two variables $z$ and $w$. Again do not confuse a function of four variables with a function of two variables. For $f(x,y,z,w)$ the partial derivarive wrt $z$ is related to a varation of $f$ when $z$ varies and $x,y,w$ are constant. For $g(z,w)$ the partial derivative wrt $z$ is related to a variation of $g$ when $w$ is constant. It is not correct to say that ∂x/∂z has any value in the $g$ case because there is no $x$ in $g(z,w)$. – JJacquelin Jan 18 '20 at 8:07
• $\frac{\partial g}{\partial z} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial z}+ \frac{\partial f}{\partial y}\frac{\partial y}{\partial z}+ \frac{\partial f}{\partial z}$ is a relationhip which allows to compute a partial derivative of the second function $g(z,w)$ when the partial derivatives of the first function $f(x,y,z,w)$ are known. Nothing more. – JJacquelin Jan 18 '20 at 8:11
• See the addition to my main answer. – JJacquelin Jan 18 '20 at 8:59
• So say I use subscripts to say what variables remain constant (e.g. $(\frac{\partial f}{\partial z})_{x,y,w}$ means $x,y,w$ constant) then I get $$(\frac{\partial g}{\partial z})_{w} = (\frac{\partial f}{\partial x})_{y,z,w}(\frac{\partial x}{\partial z})_{w}+ (\frac{\partial f}{\partial y})_{x,z,w}(\frac{\partial y}{\partial z})_{w}+ (\frac{\partial f}{\partial z})_{x,y,w}$$ Is this what the chain rule tells me? – Jacob Jan 19 '20 at 0:38

Call the composite function F. So F is a function of just 2 variables, x and z. F(z,w)=f(x(z,w),y(z,w),z,w)). Then all you need do is replace f by F on the left side of your equations and leave the right sides as they are.

• Does this mean $\frac{\partial F}{\partial z}$ means treat $w$ as a constant but $\frac{\partial f}{\partial z}$ means treat $x,y$ and $w$ as a constant? Then when computing say $\frac{\partial x}{\partial z}$ how would I distinguish between $\frac{\partial x}{\partial z}=0$ in the $f$ case but $\frac{\partial x}{\partial z}$ having an actual value in the F case? – Jacob Jan 17 '20 at 21:50
• F is a function of just 2 variables,z and w whereas f is a function of 4 variables. Many think it better to use subscripts for partials to avoid problems with the names of the variables in different contexts. – P. Lawrence Jan 18 '20 at 12:34
• So say I use subscripts to say what variables remain constant (e.g. $(\frac{\partial f}{\partial z})_{x,y,w}$ means $x,y,w$ constant) then I get $$(\frac{\partial F}{\partial z})_{w} = (\frac{\partial f}{\partial x})_{y,z,w}(\frac{\partial x}{\partial z})_{w}+ (\frac{\partial f}{\partial y})_{x,z,w}(\frac{\partial y}{\partial z})_{w}+ (\frac{\partial f}{\partial z})_{x,y,w}$$ Is this what the chain rule tells me? – Jacob Jan 19 '20 at 0:42
• Yes, that is correct. But the use of subscripts with this meaning is not standard. It might be a cause of confusion with the standard use of subscrips which is for examples : $f_x=\frac{\partial f}{\partial x}$, or $(\frac{\partial y}{\partial z})_w=\frac{\partial^2 y}{\partial x\partial w}$ , etc. – JJacquelin Jan 19 '20 at 7:35
• I don't think that using such subscripts is a good idea. See why, edited in a second answer because this was too long to be edited in comments. – JJacquelin Jan 19 '20 at 15:03

This is a comment but too long to be edited in the comments section.

In order to avoid ambiguity, the OP proposed to use subscripts to say what variables remain constant (e.g. $$\left(\frac{\partial f}{\partial z}\right)_{x,y,w}$$ means $$x,y,w$$ constant).

With this non-standard notation one get : $$\left(\frac{\partial f}{\partial z}\right)_{w}=\left(\frac{\partial f}{\partial x}\right)_{y,z,w}\left(\frac{\partial x}{\partial z}\right)_{w}+\left(\frac{\partial f}{\partial x}\right)_{x,z,w}\left(\frac{\partial y}{\partial z}\right)_{w}+\left(\frac{\partial f}{\partial z}\right)_{x,y,w}$$ Although this is not false, I think that this not a good idea.

As already pointed out in comment, this kind of subscripts can be confused with another kind of subscripts currently used.

Moreover the notation of the variables kept constant is superfuous. The definintion and actual symbol for partial derivative is clear. The differentiation is wrt a specified variable while all other variables present in the function are taken as constant parameters.

For example $$\frac{\partial f(x,y,z,w)}{\partial z}$$ means that the variable is $$z$$ and that $$x,y,t$$ are kept constant. There is no need to add subscript which is a repetition of the same thing.

The important point is an non-ambiguous definition and symbolism for the functions.

The starting point is a function of four variables with symbol $$f(x,y,z,w)$$

From this given function we create a new function, in fact a function of functions $$f\big(x(z,w),y(z,w),z,w\big)$$ which is a function of only two vatiables $$z,w$$. We can use any symbol for this new function : $$F(z,w)\quad\text{or}\quad g(z,w)\quad\text{or}\quad h(z,w) \quad\text{or}\quad \varphi(z,w)\quad\text{or any other symbol}.$$

It is not forbiden to use the same symbol $$f$$. This is what is often loosely done. But now we have two functions : $$f(x,y,z,w)\quad\text{and}\quad f(z,w)$$ One cannot confuse them if they are written with the respective variables instead of $$f$$ alone.

When writting $$\frac{\partial f(x,y,z,w)}{\partial z}$$ we know that the variable is $$z$$ and that $$x,y,w$$ are kept constant.

When writting $$\frac{\partial f(z,w)}{\partial z}$$ we know that the variable is $$z$$ and that $$w$$ is kept constant. There is no $$x$$ and no $$y$$ in this function.

Thus the usual symbolism is sufficient. No need for subscript.

$$\frac{\partial f(z,w)}{\partial z}= \frac{\partial f(x,y,z,w)}{\partial x} \frac{\partial x(z,w)}{\partial z}+\frac{\partial f(x,y,z,w)}{\partial y} \frac{\partial y(z,w)}{\partial z}+\frac{\partial f(x,y,z,w)}{\partial z}$$ Of course, in common use, poeple familiar with this symbolism simplifiy the typing and doesn't write all the variables.

Nevertheless it is recommended to use two different symbols for example $$F(z,w)$$ and $$f(x,y,z,w)$$ which avoid to edit a lot of variables in each function : $$\frac{\partial F}{\partial z}= \frac{\partial f}{\partial x} \frac{\partial x}{\partial z}+\frac{\partial f}{\partial y} \frac{\partial y}{\partial z}+\frac{\partial f}{\partial z}$$