# Is any function taking compact sets to compact sets, and connected sets to connected sets, necessarily continuous?

It is well-known that continuous image of any compact set is compact, and that continuous image of any connected set is connected. How far is the converse of the above statements true?

More precisely: Let X be a topological space. Suppose there is a map f from X into itself which takes compact sets to compact sets and connected sets to connected sets. Do these conditions imply that f is continuous?

If not in general, atleast when X is a metric space? or, when f is a bijection? or both? or under any other additional conditions?

My apologies if my question in boringly elementary.

• Not in general. For example, let $X= \omega+1$ (a convergent sequence), and let $f$ be discontinuous with finite (hence compact) image. – Goldstern Nov 16 '15 at 7:58
• Thanks for the answer, Goucher. I have a small doubt - for your statement to be true, don't we assume that f is continuous and a bijection on a locally compact Hausdorff space? This will give f is a homeomorphism. I do not assume the continuity of f to begin with. – Mathie Nov 16 '15 at 11:10
• I'm voting to close this question as off-topic because answered in the comments. – András Bátkai Nov 17 '15 at 7:30
• Mathie, your question is elementary, but certainly not boring. There are many related open questions, see the link in my answer. – Lajos Soukup Nov 17 '15 at 15:22
• @AndrasBatkai I think the fact that the question is answered in the comments is a bad reason to close it (and doubly so because it was only partially answered). Especially in light of the interesting responses that were given, this seems to be an interesting question, and it should be reopened. – Tim Campion Nov 19 '15 at 4:14

There are highly non-trivial positive results.

Let us call a function $f$ from a space $X$ into a space $Y$ preserving if the image of every compact subspace of $X$ is compact in $Y$ and the image of every connected subspace of $X$ is connected in $Y$.

McMillan [On continuity conditions for functions, Pacific J. Math. 32 (1970) 479-494] proved the following result:

Theorem: If $X$ is Hausdorff, locally connected and Fréchet, and $Y$ is Hausdorff (e.g. if $X=Y=\mathbb R$), then any preserving function $f:X\to Y$ is continuous.

Our main result is the following:

Theorem: If $X$ is any product of connected linearly ordered spaces (e.g., if $X = \mathbb R^\kappa$ ) and $f:X \to Y$ is a preserving function into a regular space $Y$, then $f$ is continuous.

Replace [connected sets map to connected sets] with [point preimages are closed], and we have the following.

Theorem. Suppose $X$ and $Y$ are compactly generated weakly Hausdorff spaces and suppose $f:X\rightarrow Y$ is a function.

Then $f$ is continuous if and only if conditions 1) and 2) hold:

1) $f(C)$ is compact for each compact Hausdorff $C \subset X$.

2) $f^{-1}(y)$ is closed for each $y\in Y$.

Proof. The crucial case is when $X$ and $Y$ are compact Hausdorff. Brian Scott posted a nice proof.

https://math.stackexchange.com/questions/1527612/a-characterizion-of-continuity-for-functions-between-hausdorff-compacta

Recall the definition of a compactly generated weakly Hausdorff space (CGWH). The space $X$ is CGWH provided

A) $g(K) \subset X$ is closed in $X$ for each compact Hausdorff space $K$ and each map $g:K \rightarrow X$.

B) $A \subset X$ is closed in $X$ iff $A \cap C$ is closed in $X$ for all compact Hausdorff subspaces $C \subset X$.

Consequently to test continuity of $f$ it suffices to test the restrictions $f \mid C$ to compact Hausdorff subspaces $C \subset X$. https://neil-strickland.staff.shef.ac.uk/courses/homotopy/cgwh.pdf.