Function $f: \Bbb{R} \to \Bbb{R}$ that's not continuous using the definition that the preimage is not open. Let $f: \Bbb{R} \to \Bbb{R}$, $$f(x)=\begin{cases} 0, &amp;x \leqslant 0, \\ 1, &amp;x&gt;0.\end{cases}$$ $f$ is not continuous, but by definition there exists an open set $V \subset \Bbb{R}$ whose preimage $f^{-1}(V)$ is not open in $\Bbb{R}$. Give an example of such an open set $V$.

I'm not sure  I understand the definition correctly I've tried plotting two real lines and finding a closed set in the domain such that the image would be open, but cannot seem to find it. I feel like $f^{-1}(V)=[-\frac12, \frac12]$ would have worked, but I'm not sure what will the image of this be since $f$ was defined piecewise. Any hints would be appreciated.
$f$ takes only two values. For $V=(-1/2,1/2)$ which is open in the codomain, $f^{-1}(V)=(-\infty,0]$ which is not open in the domain.
Note that for judging continuity of $f$, we need to look at preimages of open sets in the codomain. You may build a non-open set $S$ in the domain whose image $f(S)$ in the codomain is open, but the inverse image of $f(S)$ is not necessarily equal to $S:~S\subseteq f^{-1}(f(S))$. This is what precisely happens when you take $S=[-1/2,1/2],f(S)=\{0,1\}$ but $f^{-1}(f(S))=\Bbb R$ which is open in the domain.
Hint: Try and calculate $F^{-1}(V)$ where $V$ is any open set that includes $0$, but does not include $1$.