# Characterizing connected sets of $\mathbb R^n$ is terms of differentiable maps for which zero derivative everywhere implies constant

Let $U$ be an open subset of $\mathbb R^n$ ; then how to prove that $U$ is connected iff for every differentiable

function $f:U \to \mathbb R$ , $\nabla f(x)=0 \implies f$ is constant on $U$ ?

• Can you prove that any connected open set is path-connected? Aug 26, 2015 at 15:58
• @MiloBrandt : yes , that I can , actually I'm having more trouble with the converse part that is the condition on maps implies connected ..
– user228168
Aug 26, 2015 at 16:07
• @ShaunDev Ah. It might be easier to think of the converse in terms of the following equivalent statement: "Any disconnected space has a non-constant $f$ with zero gradient." Aug 26, 2015 at 16:11
• Suppose $U = (0,1) \cup (2,3)$ in $\mathbb R ^1.$ Can you find a non constant $f$ on $U$ such that $f'\equiv 0?$
– zhw.
Aug 26, 2015 at 16:13
• @MiloBrandt , zhw : yes , that I can do if $n=1$ , but I'm having trouble for higher dimensions , please help
– user228168
Aug 26, 2015 at 16:40

Hint: Suppose that $U$ is open and disconnected. Then, we can write $U = U_1 \cup U_2$ where each $U_i$ is open and non-empty, and $U_1 \cap U_2 = \emptyset$.

Define your function by $$f(x) = \begin{cases} 1 & x \in U_1\\ 0 & x \notin U_1 \end{cases}$$ Why is this function differentiable?