Solution (source code)

= Solution

Fix $x$, and let $C_x$ be the union of all <connected subsets> containing $x$. Their union is connected: a separation of the union would place $x$ on one side, and every connected member meeting that side would have to lie entirely there. The other side would be empty. By the defining equivalence relation this union is exactly the <connected component> of $x$.

The <closure of a connected set> is connected as well. Indeed, if its closure had a separation into relatively open nonempty pieces, density would make both pieces meet the original set and give a separation of that connected set. Therefore $\overline{C_x}$ is a connected subset containing $x$, so maximality gives $\overline{C_x}\subseteq C_x$. The reverse inclusion is automatic. \b[Every connected component is connected and closed.]