2 added 183 characters in body

If you've already developed basic facts about compactness you can prove it this way:

Let [0,1] = AB with A and B closed and disjoint. Then since A × B is compact and the distance function is continuous, there is a pair (a, b) ∈ A × B at minimum distance. If that distance is zero, A and B intersect. If not, you get a contradiction by taking any point in the interval from a to b: it can't be in either A or B because its distance from b or a is smaller than the minimum.

That shows a compact interval in ℝ is connected. To prove If= A B with A and B closed and disjoint, then for any closed interval I with one endpoint in A and one in B, I = (A I) (B I) is connecteddisconnection of I. Alternatively, you could simply write ℝ as a union of closed intervals with a common point.

1

If you've already developed basic facts about compactness you can prove it this way:

Let [0,1] = AB with A and B closed and disjoint. Then since A × B is compact and the distance function is continuous, there is a pair (a, b) ∈ A × B at minimum distance. If that distance is zero, A and B intersect. If not, you get a contradiction by taking any point in the interval from a to b: it can't be in either A or B because its distance from b or a is smaller than the minimum.

That shows a compact interval in ℝ is connected. To prove ℝ is connected, you could simply write ℝ as a union of closed intervals with a common point.