If the partial derivatives are $0$ is a function constant? I am trying to prove that if we have a differentiable function:
$f:\mathbb{R}^2\rightarrow \mathbb{R}$, and the partial derivatives of f is 0, then f is constant on a connected set. I am using the fact that a set is connected if every point in the set can be joined by a continuous curve.
If every point could be connected by a straight line it would follow from the mean value theorem, so I guess for convex sets this is easy. But what about if we have a connected set which is not convex?
Does the possibility to connect every point together with a curve imply that every point can be connected with a finite number of straight lines, where each line is contained in the set? If so it is ok, but the last thing seems difficult to prove, how do you do it?
update:
If the set also is open, is it correct to say that for every point there is an open ball around that point. And in that open ball every straight line is contained. So the function is constant around every point in the set. And if two points where unequal we could connect those points by a curve, and on one point on that curve the value of the function has to change, and hence we have a contradiction, because in an open ball around this point we have two different values?
 A: Let $\Omega\subset{\mathbb R}^2$ be open and connected, $\>f:\>\Omega\to{\mathbb R}$ be differentiable with $f_x=f_y\equiv0$, or $\nabla f\equiv0$,  on $\Omega$. The claim is that $f$ is constant on $\Omega$.
First the abstract nonsense proof of this claim: Let $S:=f(\Omega)$ be the set of values taken by $f$. For each $s\in S$ the set $U_s:=f^{-1}(\{s\})$ is open as shown in your update. Therefore
$$\Omega=\bigcup_{s\in S} U_s$$
is a partition of $\Omega$ into disjoint open sets. Since $\Omega$ is connected it follows that $\#S=1$, by definition of "connected".
Since for open sets in ${\mathbb R}^n$ "connected" is the same as "pathwise connected" we can also argue using curves: Assume ${\bf 0}\in \Omega$. For each ${\bf a}\in\Omega$ there is a continuous curve
$$\gamma:\quad t\mapsto {\bf z}(t)\in\Omega\qquad(0\leq t\leq1)$$
with ${\bf z}(0)={\bf 0}$, $\>{\bf z}(1)={\bf a}$. Using a  compactness argument one can show that one may assume $\gamma$ to be piecewise linear. Consider the auxiliary function
$$\phi(t):=f\bigl({\bf z}(t)\bigr)\qquad(t_{k-1}\leq t\leq t_k)$$
along one of the linear pieces of $\gamma$. The chain rule implies
$$\phi'(t)=\nabla f\bigl({\bf z}(t)\bigr)\cdot{\bf z}'(t)\equiv0\qquad(t_{k-1}\leq t \leq t_k)\ .$$
Therefore we have $\phi(t_k)-\phi(t_{k-1})=0$ $\>(1\leq k\leq N)$, and as a consequence 
$$f({\bf a})-f({\bf 0})=\phi(1)-\phi(0)=\sum_{k=1}^N\bigl(\phi(t_k)-\phi(t_{k-1})\bigr)=0\ .$$
Since ${\bf a}\in\Omega$ was arbitrary the claim follows.
