Let $X$ be connected and $f:X\to\mathbb{R}$ continuous s.t. each point $x\in X$ has a nbh $U$ with $f(x)=\min_{y\in U} f(y)$. Show $f$ is constant. 
Let $X$ be a connected topological space and $f:X\to\mathbb{R}$ a
  continuous map such that each point $x\in X$ has a neighborhood $U$
  with $f(x)=\min_{y\in U} f(y)$. Show that $f$ is constant.

My attempt:
Consider $x\in X$ and $V:=\{ y\in X: f(y) \ge f(x)\}$. There exists a neighborhood $U$ of $x$ such that $U\subseteq V$. Now $V$ is closed, since $X\backslash V = f^{-1}(]-\infty, f(x)[)$ is open. I know that $f(X)$ is an interval in $\mathbb{R}$. I want to use the connectedness of $X$, but $V$ is not open, so $X=V\cup X\backslash V$ will give no additional information. I have no idea how to proceed.

You are very close, in fact $V$ is open because $\forall y \in V$, $\exists U \subset X$ open such that $f(y) = \text{inf}_{a \in U}(f(a))$ so then $f(a) \geqslant f(y) \geqslant f(x)$ $\forall a \in U$. Hence $U \subset V$ so $V$ is open.
Therefore by conectedness of $X$ either $V$ or $X \setminus V$ is empty.
$V$ is not empty so $\forall y\in X$ , $f(y) \geqslant f(x)$ but the choice of $x$ was arbitrary so then can use the same argument to conclude that $\forall x,y \in X$ , $f(x) \geqslant f(y)$.
Hence $f$ is constant.
