Continuous function between topological space mapping to a closed set A function between two topological spaces is continuous if the preimage of every open set is open. I am getting confused with constant functions. 
$$f:(X,\tau_X)\to(Y,\tau_Y) \text{ is continuous if } \forall V\in Y \text{ open } f^{-1}(V) \text{ is open in X} $$
Let $f(\mathbb{R},st)\to(\mathbb{R},st)$ be the constant function $f(x)=x_0$ with $st$ denoting standard topology. This is clearly continuous. To show this let $V$ be open in $(\mathbb{R},st)$. If $x_0 \in V$ then $f^{-1}(V)=R$, if $x_0\notin \mathbb{R}$ then $f^{-1}(V)=\varnothing$ both of which are open thus $f$ is continous. 
I am confused as to why there is such a $V$ open. The image of any non empty set under $f$ is $\{x_0\}$ which is closed.

The statement says that $f$ is continuous if and only if for each open subset $V$ of $\mathbb R$, $F^{-1}(V)$ is also an open set. Note that it says “every open subset $V$ of $\mathbb R$”, not “every subset $V$ of $f(\mathbb R)$ which happens to be an open subset of $\mathbb R$”. So, if, for instance, $f(x)=2$ and $V=(1,20)$, then $V$ is an open subset of $\mathbb R$ and $f^{-1}(V)=\mathbb R$, which is an open subset of $\mathbb R$:
