Can a nowhere continuous function have a connected graph?

After noticing that function $f: \mathbb R\rightarrow \mathbb R $ $$ f(x) = \left\{\begin{array}{l} \sin\frac{1}{x} & \text{for }x\neq 0 \\ 0 &\text{for }x=0 \end{array}\right. $$ has a graph that is a connected set, despite the function not being continuous at $x=0$, I started wondering, doest there exist a function $f: X\rightarrow Y$ that is nowhere continuous, but still has a connected graph?

I would like to consider three cases

  • $X$ and $Y$ being general topological spaces
  • $X$ and $Y$ being Hausdorff spaces
  • ADDED: $X=Y=\mathbb R$

But if you have answer for other, more specific cases, they may be interesting too.


Solution 1:

Here is an example for $\mathbb R^2 \to \mathbb R$:

$$f(x,y) = \begin{cases} y & \text{when }x=0\text{ or }x=1 \\ x & \text{when }x\in(0,1)\text{ and }y=0 \\ 1-x &\text{when }x\in(0,1)\text{ and } y=x(1-x) \\ x(1-x) & \text{when }x\notin\{0,1\}\text{ and } y/x(1-x) \notin\mathbb Q \\ 0 & \text{otherwise} \end{cases} $$

This is easily seen to be everywhere discontinuous. But its graph is path-connected.


A similar but simpler construction, also $\mathbb R^2\to\mathbb R$:

$$ \begin{align} g(1 + r\cos\theta, r\sin\theta) = r & \quad\text{for }r>0,\; \theta\in\mathbb Q\cap[0,\pi] \\ g(r\cos\theta, r\sin\theta) =r & \quad \text{for }r>0,\; \theta\in\mathbb Q\cap[\pi,2\pi] \\ g(x,y) =0 & \quad\text{everywhere else} \end{align} $$

Solution 2:

Check out this paper:

F. B. Jones, Totally discontinuous linear functions whose graphs are connected, November 23, (1940).

Abstract:

Cauchy discovered before 1821 that a function satisfying the equation $$ f(x)+f(y)=f(x+y) $$ is either continuous or totally discontinuous. After Hamel showed the existence of a discontinuous function, many mathematicians have concerned themselves with problems arising from the study of such functions. However, the following question seems to have gone unanswered: Since the plane image of such a function (the graph of $y =f(x)$) must either be connected or be totally disconnected, must the function be continuous if its image is connected? The answer is no.

In particular, Theorem 5 presents a nowhere continuous function $f:\Bbb R \rightarrow \Bbb R$ whose graph is connected.


Whether Conway base 13 function is such an example remains unknown. (at least on MSE; see Is the graph of the Conway base 13 function connected?) It turns out the graph of Conway base 13 function is totally disconnected. See this brilliant answer.