After noticing that function f:R→R f(x)={sin1xfor x≠00for x=0

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→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=R
But if you have answer for other, more specific cases, they may be interesting too.

**Answer**

Here is an example for R2→R:

f(x,y)={ywhen x=0 or x=1xwhen x∈(0,1) and y=01−xwhen x∈(0,1) and y=x(1−x)x(1−x)when x∉{0,1} and y/x(1−x)∉Q0otherwise

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

A similar but simpler construction, also R2→R:

g(1+rcosθ,rsinθ)=rfor r>0,θ∈Q∩[0,π]g(rcosθ,rsinθ)=rfor r>0,θ∈Q∩[π,2π]g(x,y)=0everywhere else

**Attribution***Source : Link , Question Author : Adam Latosiński , Answer Author : hmakholm left over Monica*