Solution (source code)

= Solution

A space is connected when it is not a union of two disjoint nonempty open subsets. If $f(X)$ had such a separation, its inverse images would separate connected $X$, so continuous images of <connected spaces> are connected. Equivalently, a nonconstant continuous map to discrete $\{0,1\}$ records a separation, and every separation defines such a map.

If $\mathbb R$ were separated, points in opposite pieces and the intermediate value theorem applied to the associated $\{0,1\}$-valued map would give a contradiction. Thus $\mathbb R$ is connected. Its quotient by $x\sim y$ is connected because the quotient map is continuous and surjective.

Finally let $A\subset B\subset\operatorname{Cl}(A)$ and suppose $B=U\cup V$ were a separation. Connectedness puts $A$ wholly in one side, say $U$. Every point of $V$ nevertheless lies in the closure of $A$, while $V$ is relatively open and disjoint from $A$, a contradiction. Hence $B$ is connected.