# is infinite connected components still true

my assignment has this question, given a topological space X with finite many connected components, a function $f:X\rightarrow Y$ is continuous if and only if it is continuous on each components. Is it still true if X has infinitely many components. The first is okay but the reverse makes me confused, so how can I prove the reverse? Moreover, if $X$ has infinite connected components, I know it is not true but I can't find an example. Anyone help?

Consider the set $X=\{1/n\mid n\in\mathbb N\}\cup\{0\}$ and the map $f:X\to\mathbb R$, $f(0)=1$, $f(1/n)=0$. Then $f$ is clearly continuous on each component since the components are just the elements of $X$. But $f$ is not continuous on $X$. The reason is that a set is not open if its intersection with each component is open, i.e. $X$ is not the topological sum of its components. It would work if all components were open, though. This is the case if there are only finitely many, but also if the space is locally connected.
Edit: If a space $X$ has the property you mention, then a map $f$ from $X$ to an arbitrary space is continuous if and only if its composition with each inclusion map $i_C:C\hookrightarrow X$ is continuous for each component $C$. Then the space has the so-called final topology with respect to all those maps. It can be shown that the topology then consists of all sets $U$ such that $i_C^{-1}(U)$ is open in $C$ for each $i_C$. Since the preimage of a component is either the component itself or empty, thus open in every component, so it must be open.
If you are not familiar yet with final topologies and the universal property, then there is also a more direct proof, which uses the idea of the counterexample above. The characteristic map $\chi_C$ of a component $C$ is constant on each component, hence it must be continuous on all of $X$. But this implies that $C=\chi_C^{-1}(1)$ is open. So $X$ has this special property iff each component is open.
• @hungtran: But that's wrong. The components are always closed. They are open if there are finitely many because then a component is the complement of a finite union of closed components, thus open. They are also open if $X$ is locally connected. – Stefan Hamcke Apr 11 '13 at 12:06