Confusion on multivariable partial differentiation from textbook I am very confused about a use of the partial differential multivariable chain rule. The textbook first describes the formula:
$\frac{\partial f}{\partial s} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial s} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial s} + \frac{\partial f}{\partial z}\frac{\partial z}{\partial s}$
But then, as shown in the image provided, they set $s = x$ and call x to be a function of x, y to be a function of y, z to be a function of x and y, and make:
$f = x^2 + y^2 + z^2 = 4$. 
But then on one side they claim:
$ \frac{\partial f}{\partial x} = 0$ *
And on the other side they have:
$\frac{\partial f}{\partial x}\frac{\partial x}{\partial x} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial x} + \frac{\partial f}{\partial x}\frac{\partial z}{\partial x} = (2x)(0) + (\frac{\partial f}{\partial y})(0) + (2z)(\frac{\partial z}{\partial x})$ (1)
So then $ \frac{\partial f}{\partial x} = 2x$, but this is in direct contradiction with (*) above. This leads to large issues in equation (1), since the $ \frac{\partial f}{\partial x}$ should cancel from both sides, but it does not for some reason.
Can someone please explain what is going on?
textbook image
 A: We have $$x^2+y^2+z^2=4.\tag{1}$$ As the book says, we can view this equation as defining $z$ as a function of the independent variables $x$ and $y$.  Obviously, there is more than one possible function $z.$  Now if we consider the explicit function $f(x,y,z) = x^2+y^2+z^2$ where $z$ is the implicit function we just discussed, then we have$${\partial f\over \partial x} = 2x\cdot1+2y\cdot0+2z\cdot{\partial z\over\partial x}\tag{2}$$ This is true regardless of $(1)$.
As I understand your question, you are asking, "If we know from $(1)$ that $f_x=0$ why don't we have $0$ instead of $2x$ on the right-hand side of $(2)?$"  The short answer is that it would be premature.  Equation $(2)$ expresses a general rule, which is true whenever $z$ is a function of $x$ and $y$.  It has nothing to do with an implicitly defined function.  You could substitute $z=\sin(xy)$ and $(2)$ would be true.
Now, we know from $(1)$ that with this particular value of $z,$ we have $f_x=0,$ so we can substitute this on the left-hand side of $(2)$ and solve for ${\partial z\over\partial x}.$
I'm sure there's a better way to express what I'm trying to say, but I hope this will make things a bit clearer to you.   
A: In my opinion, it's very bad notation to use $\partial f/\partial x$ and $f_x$ for two different things, as they do. And in general it often leads to confusion when one uses the same name for the quantity that depends on some other quantities as for the function which describes this dependence.
If you want to clean it up, write $z=Z(y,z)$ instead of $z=z(x,y)$ (so that the function's name is $Z$, different from the variable name $z$), and write
$$
F(x,y) = f(x,y,Z(x,y)) = x^2 + y^2 + Z(x,y)^2
$$
for the composite function, which is actually the constant function $F(x,y)=4$ since that's how $Z(x,y)$ is defined. This function $F$ is a function of two variables, so it's clearly not the same as the three-variable function $f$, so it should have a different name.
Then what they denote by $\partial f/\partial x$ is really $\partial F/\partial x$, and it's zero on the one hand (since $F$ is constant), and given by the chain rule on the other hand (since $F$ is a composite function):
$$
\begin{split}
0 = F_x(x,y)
& = f_x(x,y,Z(x,y)) + f_z(x,y,Z(x,y)) \, Z_x(x,y)
\\
& = 2x + 2 Z(x,y) \, Z_x(x,y)
.
\end{split}
$$
This shows that
$$
Z_x(x,y)
= - \frac{f_x(x,y,Z(x,y))}{f_z(x,y,Z(x,y))}
= - \frac{x}{Z(x,y)}
.
$$
