# How does one prove that a multivariate function is univariate?

The question resembles but appears to be more difficult.

Suppose that $u\colon\mathbb R^2\to\mathbb R$ is a continuous function such that at every point $(x,y)\in\mathbb R^2$ at least one of the following is true:

- the partial derivative $\displaystyle \frac{\partial u}{\partial x}$ exists and is equal to $0$.
- the partial derivative $\displaystyle \frac{\partial u}{\partial y}$ exists and is equal to $0$.

Does it follow that $u$ depends only on one of two variables $x,y$? In other words, can we prove that either 1 holds for all points or 2 holds for all points?

So far I can prove this only under the additional assumption $u\in C^1$.

**Edit:** Here is a proof of the $C^1$ case.

Claim 1: If $u_x(a,b)\ne 0$ for some $(a,b)$, then $u_x(a,y)=u_x(a,b)$ for all $y\in\mathbb R$.

Claim 2: If $u_y(c,d)\ne 0$ for some $(c,d)$, then $u_y(x,d)=u_y(c,d)$ for all $x\in\mathbb R$.

Once Claims 1 and 2 are proved, it follows that the premise of one of them never holds, otherwise both derivatives would be nonzero at $(a,d)$.

By symmetry it suffices to prove Claim 1. The set $E=\{y\in\mathbb R\colon u_x(a,y)=u_x(a,b)\}$ is closed by the continuity of $u_x$. Also, if $t\in E$ then $u_x\ne 0$ in some neighborhood of $(a,t)$ (again by continuity), which by assumption yields $u_y=0$ in this neighborhood, meaning $u$ does not depend on $y$ there. Thus, $E$ is also open. We conclude with $E=\mathbb R$, proving the claim.

Related questions