[example: A Jump Detected by an Open Set]
Let $f:\mathbb R\to\mathbb R$ be given by
\begin{align*}
f(x) &=
\begin{cases}
0, & x<0,\\
1, & x\ge 0.
\end{cases}
\end{align*}
We test continuity by pulling back the open interval $(1/2,3/2)$ in the codomain. For $x\in\mathbb R$,
\begin{align*}
x\in f^{-1}((1/2,3/2))
&\iff f(x)\in (1/2,3/2)\\
&\iff f(x)=1\\
&\iff x\ge 0.
\end{align*}
The middle equivalence holds because the only possible values of $f$ are $0$ and $1$, with
\begin{align*}
0\notin (1/2,3/2), \qquad 1\in (1/2,3/2).
\end{align*}
Therefore
\begin{align*}
f^{-1}((1/2,3/2))&=[0,\infty).
\end{align*}
This set is not open in the usual topology on $\mathbb R$: if it were open, then since $0\in[0,\infty)$ there would be some $\varepsilon>0$ with
\begin{align*}
(-\varepsilon,\varepsilon)\subset [0,\infty).
\end{align*}
But $-\varepsilon/2\in(-\varepsilon,\varepsilon)$ and $-\varepsilon/2<0$, so $-\varepsilon/2\notin[0,\infty)$, a contradiction. Thus one [open set](/page/Open%20Set) in the target detects the jump at $0$, showing why continuity is tested by preimages of open sets.
[/example]