Why the derivative of a function must be equal to zero, on a connected open set, to say that the function is constant?

Let $$\phi$$ a differentiable function on $$\Omega \in \mathbb{R}^n$$, open connected set.

then if $$\frac{\partial\phi}{\partial x_i}=0 \; for \; i=1,..,n$$.

we have $$\phi = constant$$, because $$\Omega$$ is connected!

I didn't get why $$\Omega$$ should be connected.

• Because if the derivative is $0$, the function is only con,stant on each cinnected component of the domain, but the constant may be different from one connected component to another. Mar 24, 2019 at 22:48
• An easy example: $f(x)$ defined on $(0,1)\cup (2,3)$ by $f(x)=1$ for $x\in (0,1)$ and $f(x)=2$ for $x\in (2,3)$. It is defined on an open set, the derivative is zero everywhere but the function is not constant. Connectedness of the domain solves this problem because on a connected set a locally constant function is always globally constant.
– Mark
Mar 24, 2019 at 22:53
If $$U$$ and $$V$$ are disjoint open sets, $$\phi(x)=1$$ for all $$x \in U$$ and $$\phi(x)=0$$ for all $$x \in V$$ then all the partial derivatives are $$0$$ but $$\phi$$ is not a constant function on $$U \cup V$$.
Since $$\Omega$$ is open and connected, any two points $$x,y \in \Omega$$ can be joined by a path with a finite number of segments that are parallel to the axes. Then the mean value theorem shows that $$\phi(x)=\phi(y)$$ and hence $$\phi$$ is constant on $$\Omega$$.