Real functions of n variables If $f$ is a real-valued function defined in a convex open set $E$ of $\mathbb{R}^n$, such that $\frac{\partial f}{\partial x_1}$ is $0$ for every $x\in E$, prove that $f(x)$ does not depend on the coordinate $x_1$. Why do we need convexity of $E$ in order to show this?
 A: Here is an instructive example why:
Consider two disjoint open balls $B_{\frac{1}{2}}((-1,0)) \subset \mathbb{R}^2$ and $B_{\frac{1}{2}}((1,0)) \subset \mathbb{R}^2$. Let your set $E$ be their union - clearly not a convex set. Let $f:E \rightarrow \mathbb{R}$ be given by:
$$ f((x,y)) =\left\{\begin{matrix}
 y& \text{ if   } x>0\\ 
 -y& \text{ if   } x<0
\end{matrix}\right.$$
Clearly, $f$ is differentiable and $\dfrac{\partial f}{\partial x} = 0$.
Here, the non-convexity allows you to define the cases, while keeping the function continuous.
Above $E$ was disconnected. So let's suppose $E$ is an open, non-convex, connected set. Let $g:E \rightarrow \mathbb{R}^m$ be any function, such that $\frac{\partial g}{\partial x_1} = 0$. We can write any $v \in E$ as $v=(x_1,y)$, where $y$ is an $n-1$ dimensional vector. Fix some vector $y_0$, let $A = \{ (x_1,y) \in E: y = y_0 \}$. We can think of $A$ as a subset of $\mathbb{R}$ - it is just some affine line. It is clear that if $A \subset \mathbb{R}$ is connected, then $g(A) = \{ z \}$ for some $z \in \mathbb{R}^m$.
Now suppose that $A \subset \mathbb{R}$ is not connected. Suppose that in this case there are two points $(x_i,y_0), (x_j, y_0)$ such that $g(x_i,y_0) \neq g(x_j,y_0)$. Then since we assumed that $E$ is connected and open, it follows that $E$ is in fact path-connected. So there is some smooth $\gamma: [0,1] \rightarrow E$ such that $\gamma(0) = (x_i,y_0)$ and $\gamma(1) = (x_j,y_0)$. Note here that $\gamma ([0,1]) \subset E$.
Let $\gamma(c) = (x,y)$. Then by the chain rule we have that
$$[D(g \circ \gamma)(c)] = [Dg(\gamma(c))]\cdot [D\gamma(c)]$$
Here $  D(g \circ \gamma)(x,y) $ is an $m \mathbb{x} 1$ matrix. But we have that:
$$[D(g \circ \gamma)(c)]_{i1} = \sum_{k=1}^n \left ( [Dg(\gamma(c))]_{ik} \cdot [D\gamma(c)]_{k1} \right )$$
Now notice that even though $[Dg(\gamma(c))]_{i1} \cdot [D\gamma(c)]_{11}$ will always be zero, the rest of the sum doesn't have to be. This captures the fact that $E$ is not a convex set; i.e. you can change the values along the $x_1$ axis without the function having any dependency on $x_1$ whatsoever. 
So $g(x_i,y_0) \neq g(x_j,y_0)$ is possible, even though $\frac{\partial g}{\partial x_1} = 0$.
A: Imagine a line that is parallel to the x1 axis. If E were not convex, it might happen that its intersection with the line yields multiple segments. Then, f could be constant in every segment (i.e. the partial derivatives are zero where defined), but "tacitly" change its value in between segments.
