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.

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$. 
