Find the partial derivative of a sphere with equation $x^2+y^2+z^2=4$ We have a sphere with the following equation:
$x^2+y^2+z^2=4$
We seek to find the partial derivative, with respect to $x$, of this equation. We think of this equation as a function of three variables
$f(x,y,z)=4$
From this equation, we can conclude the following:
$\frac{df}{dx}=0$
Using the chain rule, we have:
$0=f_x\frac{dx}{dx}+f_y\frac{dy}{dx}+f_z\frac{dz}{dx}$
$0=(2x)(1)+(2y)(0)+(2z)\frac{dz}{dx}$
Since we are treating $y$ as a constant, from the equation above, we can solve the very last variable.
$0=2x+(2z)\frac{dz}{dx}$
$-\frac{2x}{2z}=\frac{dz}{dx}$
I am quite confused regarding the treatment of $z$ and $y$. I've always assumed that when seeking a partial derivative with respect to a certain variable, we treat the other variables as constants. Can it be said that as in the example above, we were treating $z$ as a constant all along? If yes, should $\frac{dz}{dx}$ evaluate to $0$?
 A: The way I understand it is you have the equation
$$
x^2+y^2+z^2=4
$$
which is equivalent to
$$
f(x,y)=z=\pm \sqrt{4-x^2-y^2},
$$
therefore
$$
\frac{\partial{f}}{\partial{x}}=\pm \frac{x}{\sqrt{4-x^2-y^2}}
$$
Perhaps more context on where this question comes from could help clarify things.
A: We can treat other variabes as constants only when we calculate $ \frac{\partial f}{\partial x}$ or $\frac{\partial f}{\partial y}$ or $ \frac{\partial f}{\partial z} $ as to the frst order.
When we calculate $ \frac{df}{dx}$ or $\frac{df}{dy}$ or $\frac{df}{dz} $ themselves, we should not treat $x$ or $y$ or $z$ as constants.
In general $ \frac{df}{dx} \ne 0 ,\, \frac{df}{dy} \ne 0 ,\, \frac{df}{dx} \ne 0 $ and $ \frac{dz}{dx}\ne 0\,(f=z)$ .  
There are two standpoints.
Standpoint 1
If we regard $x,\,y,\,z$ as independent variables, then
$$ \frac{\partial z}{\partial x} = \frac{\partial z}{\partial y} =0 $$
Under the constraint $x^2+y^2+z^2=4$, by differentiating the both sides wrt x we get
$$ \frac{dx^2}{dx} + \frac{\partial y^2}{\partial y}\frac{dy}{dx} + \frac{\partial z^2}{\partial z}\frac{dz}{dx}=0 $$
$$  x + y\frac{dy}{dx} + z\frac{dz}{dx}=0 $$
\begin{alignat}{2}
  \frac{dz}{dx} &=&& -\frac{x}{z} - \frac{y}{z}\frac{dy}{dx} \\
&=&& \mp \frac{x}{\sqrt{4-x^2-y^2}} \mp \frac{y}{\sqrt{4-x^2-y^2}}  \frac{dy}{dx} 
\end{alignat}
Standpoint 2
If we regard $z$ as a function of $x,\,y$ 
$$ z=\pm \sqrt{4-x^2-y^2} $$
as Kuifje wrote, then
$$ \frac{\partial z}{\partial x} \ne 0 ,\quad \frac{\partial z}{\partial y} \ne 0 $$
\begin{alignat}{2}
\frac{dz}{dx} &=&& \frac{\partial z}{\partial x} + \frac{\partial z}{\partial y} \frac{dy}{dx} \\
&=&& \mp \frac{x}{\sqrt{4-x^2-y^2}} \mp \frac{y}{\sqrt{4-x^2-y^2}}  \frac{dy}{dx} 
\end{alignat}
Two standpoints give the same expression for $\frac{dz}{dx}$.
