How does one prove that if function's partial derivative respect to every variable is zero, function is constant?

How does one prove that if function's partial derivative respect to every variable that the function defines over is zero function is constant function? I just noticed it, but I cannot prove it.


Suppose the function $f(x,y)$ is non-constant and its partial derivatives exist everywhere. Then we have some $(x,y)$ and $(x',y')$ such that $f(x,y)\ne f(x',y')$. If $f(x,y)=f(x',y)=f(x,y')$ then these are distinct from $f(x',y')$, otherwise one of $f(x',y)$ or $f(x,y')$ is not $f(x,y)$. This means we only have to worry about one of the two variables! Lets say $f(x,y)\ne f(x',y)$ (the other cases are identical). By the Mean Value Theorem, we have some $c\in (x,x')$ such that $$\frac{\partial f}{\partial x}(c,y)=\frac{f(x',y)-f(x,y)}{x'-x}\ne 0$$ thus the partial derivatives are not everywhere $0$.

You should be able to extend this to arbitrarily many variables on your own.