Let X be connected and $f : X → Y$ is continuous. Show that the graph, ${(x, f(x)); x ∈ x} ⊂ X × Y$, is connected, and give a counterexample to show that the converse is not true.
I think the first question can be shown by constructing a vector-valued function. But I'm stuck on the counter example. Could you please help?
Let $X=[0,\infty),$ $Y=\mathbb{R}$ and $$ f(x) =\begin{cases}\sin (1/x) & x>0 \\ 0 & x=0\end{cases}$$
Then $f$ isn't continuous, yet for any $\varepsilon>0$, there exists $x\in (0,\varepsilon)$ such that $f(x)=0$. Thus, $(x,f(x))\in B((0,0),\varepsilon)$ in $X\times Y$. However, the graph of $f|_{X\setminus \{0\}}$ is clearly connected, since this function is continuous. We get that the graph of $f$ is connected.