Applying topological definition of continuity I am a physics student and have just recently started studying about topology. I am trying to apply the topological definition of continuity in this function.
$$f:(0,2)\rightarrow(0,1]\cup(2,3)$$ 
$$f(x) = \begin{cases}
x, & \text{ if } x \in (0,1]\\
x+1, &\text{ if } x \in (1,2)
\end{cases}$$
I think that the co-domain of this function is not a topological space because the co-domain itself is not an open set and so it doesn't fit in the definition of a topology. So, is it so that we can't apply topological definition in this case or am I wrong somewhere? 
 A: The set $\left(0, 1\right] = \left(0, \frac32\right) \cap \Big((0,1] \cup (2,3)\Big)$ is an open set in the codomain $(0,1] \cup (2,3)$. We have
$$f^{-1}\Big(\left(0, 1\right]\Big) = \left(0, 1\right]$$
which is not an open set in $(0,2)$. Therefore $f$ is not continuous.
A: Every subset of a topological space inherits a default topology from its containing space, called, unsurprisingly, the "subspace topology". (You can look up this term on, say, Wikipedia, or in any topology text to read more details about it.) This is certainly the topology that is intended for $(0.1] \cup (2,3)$ (considered as a subset of $\mathbb{R}$ with its usual topology), and it does make it into a valid topological space.
But you'll have to be careful, as the definition of subspace topology can lead to some surprises for a first-time student. For instance, $(0,1]$ is an open subset of $(0.1] \cup (2,3)$, even though it is not an open subset of $\mathbb{R}$. (@mechanodroid uses this fact in their proof that the function is not continuous.)
