In page 291 of "Cracking the GRE Mathematics Subject Test" I came upon the following Topology example:
$$f(x) = \begin{cases} -2, \text{ if } x<0 \\ \;\;\; 2,\text{ if } x \geq 0 \end{cases}$$
Consider the open set $O=(1,3)$, which contains the point $f(0) = 2$. The inverse image of $O$ is the set $[0,\infty)$, which is not open. Therefore the topological definition tells us that $f$ is not continuous at $x=0$.
My question is, can the same argument be used to prove that $f$ is discontinuous for all $x \geq 0$?
From Calculus, I know that $f$ would be discontinuous only at 0. Is it different when using the continuity definition in Topology? Which from Munkres is:
Let $X$ and $Y$ be topological spaces. A function $f:X \to Y$ is said to be continuous if for each open subset $V$ of $Y$, the set $f^{−1}(V)$ is an open subset of $X$.
No, it doesn't. For example, consider $f:[a,b] \to \mathbb{R}$ where $f(x) = c$. Naively, you might think that this is problematic, since the preimage of any open set containing $c$ is $[a,b]$ which is a closed subset of $\mathbb{R}$.
What's the explanation? We're considering $[a,b]$ equipped with the subspace topology, in which it is clopen.
Therefore, if you restrict your function to the non-negative reals, it is continuous.