Prove that
(a) Let $X \subset \mathbb{R}^{n}$. A aplication $f: X \to \mathbb{R}^{n}$ is said locally constant when for each $x \in X$, there is a $B(x,\delta)$ such that $f|(B(x,\delta)\cap X)$ is constant. $X$ is connected if only if all aplication locally constant $f: X \to \mathbb{R}^{n}$ is constant.
(b) The closure of a set connected by paths may not be connected by paths.
For (a). $(\Longrightarrow)$ Suppose that $X$ is connected. Let $x_{0} \in X$ and $Y = \lbrace y \in X\,|\,f(y) = f(x_{0})\rbrace$. Given any $x \in X$, the neighborhood when $f$ is locally constant is contained in $Y$, so $Y$ is open. Since $f$ is locally constant, by definition of locally constant, $f$ must be continuous. Thus, $Y$ is closed because if $y_{n} \in Y$ and $y_{n} \to y$, then $\lim f(y_{n}) = f(y) = f(x_{0}) \Longrightarrow y \in Y$. But $Y^{c}$ is open and $Y \cup Y^{c} = X$, then $Y$ or $Y^{c}$ are empty sets (by hypothesis, $X$ is connected). Since $x_{0} \in Y$, so $Y = X$.
That is right?
$(\Longleftarrow)$ I have no idea.
For (b). I know the a set connected by paths is connected and the closure of a connected set is connected. A set $X$ is connected by paths if given $a,b \in X$ there is a path subset in $X$ that connects $a$ and $b$. I couldn't expand anything.
Any hint? Thanks for the advance!
PS: I don't know much about metric spaces, so I would like hints that only involve properties of $\mathbb{R}^{n}$.