# Continuity on a union

Let $X= \bigcup X_n$ be a countable union of subsets $X_1\subset X_2\subset \dots$ and let $X$ and $Y$ be topological spaces. Given a function $f\colon X\to Y$ such that $f|_{X_n}$ is continuous, is it necessarily true, that $f$ is continuous on $X$?

I have been trying to think of a counter-example but could find one although it does not quite seem to be enough information on $f$ for it to be continuous. First of all I am interested in a proof or counter-example for this statement, but after all I am also looking for a maybe similar statement that is true.

Edit: If I understood both answers right, additionally assuming that all closures $\bar X_n= X$ would suffice for the assertion?

This is true for all spaces $Y$ if and only if $X$ has the colimit topology with respect to the spaces $X_i$, more traditionally known as the coherent topology. A counterexample is given by a countable set $X$ equipped with the cofinite topology and $X_i$ an increasing sequence of finite sets whose union is $X$ (for example $X = \mathbb{Z}, X_i = [-i, i]$). The colimit topology with respect to the $X_i$ is the discrete topology.

Edit: $\overline{ X_i} = X$ (which is equivalent to $\overline{ X_1 } = X$) is also not enough to guarantee that you have the coherent topology. Take the above example $X = \mathbb{Z}, X_i = [-i, i]$ with the cofinite topology and remove all of the non-empty open sets that don't include $\{ 0 \}$ (so a combination of the cofinite topology and the particular point topology). Then each $X_i$ is dense but the above problem still stands: the colimit topology with respect to the $X_i$ is the particular point topology on $\{ 0 \}$.

• @Peter: that's sort of a strange condition, but okay. – Qiaochu Yuan May 25 '11 at 15:47
• Ah, I'm glad you did that. I wish I could upvote your answer once more... – t.b. May 25 '11 at 15:51
• I now posted my original problem in math.stackexchange.com/questions/41306/… – Peter Patzt May 25 '11 at 16:26
• @Leon: sort of, but they're defined at different levels of generality. The colimit is a topological space one can cook up given a diagram of spaces, whereas the final topology is a topology that one specifies on a set given some functions into it from spaces. So the former can be described entirely in $\text{Top}$ and does not require that you construct the space beforehand, whereas the latter requires an existing set and needs to be described in $\text{Set}$ (and $\text{Top}$). – Qiaochu Yuan Aug 6 '11 at 16:11
• @Leon: yes. Wikipedia is not perfect. – Qiaochu Yuan Aug 6 '11 at 16:24

No, it's not true. Take $f(0) = 0$ and $f(x) = 1$ if $x \neq 0$. If $X_{n} = \{0,\frac{1}{n},\frac{1}{n-1},\ldots,1\}$ and $X = \bigcup_{n} X_n$ is viewed as a subset of $\mathbb{R}$ then $f|_{X_n}$ is definitely continuous, but $f$ is clearly not continuous as a function $f:X \to \mathbb{R}$.

In fact, in order for your condition to hold for all $f: X \to Y$, where $Y$ is allowed to be any space, it is necessary and sufficient that your space $X$ be equipped with the final topology induced by the inclusions $X_{i} \to X$.

• please note the edit – Peter Patzt May 25 '11 at 15:23

If it helps, I worked out a special case of this problem, where $X$ is a metric space and $Y=\mathbb{R}$. Then having each $X_n$ be open is necessary and sufficient.