A sufficient condition for $U \subseteq \mathbb{R}^2$ such that $f(x,y) = f(x)$ I have another short question. Let $U \subseteq \mathbb{R}^2$ be open and $f: U \rightarrow \mathbb{R}$ be continuously differentiable. Also, $\partial_y f(x,y) = 0$ for all $(x,y) \in U$. I want to find a sufficient condition for $U$ such that $f$ only depends on $x$. Of course, the condition shouldn't be too restrictive. Is it sufficient for $U$ to be connected?
Thanks a lot for any help.
 A: It's enough for $U$ to have the property that, whenever $(x,y_1)$ and $(x,y_2)$ are in $U$, so is the line segment between them. This can be proved by applying the mean value theorem to the function $g(y)=f(x,y)$.
It is not enough for $U$ to be connected. For example, take $U=\mathbb{R} \setminus \{(x,0)|x \le 0 \}$. Let $f(x,y)=0$ for $x \ge 0$, $f(x,y)=x^2$ for $x<0, y<0$ and $f(x,y)=-x^2$ for $x<0, y>0$.
A: This is from a problem in Rudin, if I recall correctly, in the section on functions of several variables. The important point to note is that this problem relies on the mean value theorem, which is a statement about a function from $\mathbf{R}$ to $\mathbf{R}$. The trick in this situation is to restrict your domain $E$ to a single straight line, in which $x$ is fixed and $y$ is variable. By the mean value theorem, the distance between two points along this line will depend only on x, and so all points on this line will map to the same point.
There is a notion in analysis of convexity. If $(x_1,y_1)$ and $(x_2,y_2)$ are in $E$, so is the line in between them. Our proof above required this to use the mean value theorem. However, we didn't require convexity in every direction. Since we only took partials in the $y$-direction, we just required convexity in the $y$-direction. That is to say, that if two points have the same $y$ value, then the line connecting them would remain in $E$. 
