If derivative of a function is the zero function in $\mathbb R^n$, then the function is constant when the domain is path-connected Some definitions first. Let $A \subseteq \mathbb R^n$. Let $x,y \in A$. A path between $x$ and $y$ is a continuous function $f: [0,1] \rightarrow \mathbb{R}^n$ with $f(0) = x$ and $f(1) = y$.  The set $A$ is path-connected when for every $x, y \in A$, there exists a $C^1$ path between $x$ and $y$.
Let $f: A \rightarrow \mathbb{R}^m$ be a function, with $A \subseteq \mathbb{R}^n$. Suppose that $f'(a) = 0$ for all $a \in A$. Now if $A$ is path-connected, then $f$ is constant.
In a proof I saw of this theorem the property that every path between two points is $C^1$ is used. My question is: is this necessary? If so, I'd like to see a counterexample. In other words, I'm looking for a function $f: A \rightarrow \mathbb{R}^m$ with zero derivative everywhere, $A$ such that there is a path between any two points (but the path is not necessarily $C^1$) and $f$ is NOT constant.
 A: This answer is late, but anyway: You may want to look at Hassler Whitney's paper "A function not constant on a connected set of critical points",
Duke Math. J. 1 (1935), no. 4, 514--517.
A: As pointed out in the comments, such a function cannot exist. In order to define “$f$ is differentiable”, you need your set to be open. Every pair of points in an open and connected set can be connected by a smooth path, see below. Your argument then shows that $f$ must be constant. (Alternatively, you can argue as Amitesh suggests)

Here's a proof of the fact that any two points of an open and connected set $U \subset \mathbb{R}^n$ can be connected by a piecewise smooth path:
Define an equivalence relation on $U$ by $x \sim y$ if and only if there is a piecewise smooth path $\gamma: [a,b] \to U$ such that $\gamma(a) = x$ and $\gamma(b) = y$.
Let $x \in U$ be arbitrary.
Notice that the equivalence class of $[x]$ of $x$ is open. If $y \in [x]$ there is some open ball $B_r(y) \subset U$. We may connect $y$ to any point $z \in B_{r}(y)$ using the straight line segment $(1-t)y + tz$, $t \in [0,1]$.
Since the complement of $[x]$ is a union of (open) equivalence classes, $[x]$ is closed. Thus, $[x]$ is open, closed and non-empty, hence all of $U$ by connectedness.

If you want to get “smooth paths” instead of only “piecewise smooth paths”, refine the argument slightly by allowing only paths  $\gamma: [a,b] \to U$ such that $\gamma|_{[a,a+\varepsilon)} \equiv a$ and $\gamma|_{(b-\varepsilon,b]} \equiv b$ for some $\varepsilon \gt 0$. Then the concatenation of two such paths is still a smooth path. Instead of taking the straight line segment connecting $y$ and $z$ take a smooth function $f: [0,1] \to [0,1]$ such that $f|_{[0,\varepsilon)} \equiv 0$ and $f((1-\varepsilon, 1] \equiv 1$ and take the path $(1-f(t))y + f(t)z$.
