1
$\begingroup$

Let $U$ be an open subset of $\mathbb{R}^n$. Let $f: U \to \mathbb{R}$ be differentiable with $\nabla f(x) = 0$ for all $x \in U$.

I have already shown that if $U$ is path-connected then $f$ is constant.

In the next task I have to show, that this statement is wront, if $U$ is not path-connected. I assume that I need a counterexample here with a $f$ is above where $U$ is not path-connected and $f$ is not constant, but I am struggling to understand which function should have $\nabla f(x)=0$ and not be constant.

I would really appreciate some help.

$\endgroup$
1
  • 1
    $\begingroup$ I was going to suggest that you start by thinking about $n=1$. $\endgroup$ Dec 15, 2019 at 19:39

2 Answers 2

4
$\begingroup$

Take $f(x,y)=1$ if $(x,y) \in B((0,0),1)$

and $f(x,y)=0$ if $(x,y) \in B((3,0),1)$

So $U=B((0,0),1) \cup B((3,0),1)$

$\endgroup$
2
$\begingroup$

Take$$\begin{array}{rccc}f\colon&\mathbb R\setminus\{0\}&\longrightarrow&\mathbb R\\&x&\mapsto&\begin{cases}1&\text{ if }x>0\\0&\text{ if }x<0.\end{cases}\end{array}$$

$\endgroup$
1
  • $\begingroup$ This one is very intuitive! $\endgroup$
    – user695468
    Dec 15, 2019 at 20:22

You must log in to answer this question.