We know that the subsets of β that are closed and bounded are precisely those that are compact.
Continuous functions π on compact subsets π΄ of β are uniformly continuous, that is, for each positive Ξ΅, for some positive Ξ΄, for all π₯ and π¦ in π΄,
π₯βπ¦<Ξ΄ β π(π₯)βπ(π¦)<Ξ΅.
To prove this, we know that for each π in π΄ and each positive Ξ΅, for some positive Ξ΄(π), for all π₯ in π΄,
π₯βπ<Ξ΄(π) β π(π₯)βπ(π)<Ξ΅.
Then π΄ is covered by the open intervals (πβΞ΄(π), b+Ξ΄(π)).
Since π΄ is compact, it is covered by finitely many of the intervals, say when π ranges over a certain finite subset π΅ of π΄.
Now we can let Ξ΄ be the least of the Ξ΄(π), where π is in π΅.
Suppose π and π are in π΄ and πβπ<Ξ΄; we want to show π(π)βπ(π)<Ξ΅.
We know that, for some π in π΅, π is in (πβΞ΄(π), b+Ξ΄(π)), that is, πβπ<Ξ΄(π). In this case, π(π)βπ(π)<Ξ΅.
We also know πβπ<πβπ+πβπ<2Ξ΄(π).
To make our argument work, we should go back and replace (πβΞ΄(π), b+Ξ΄(π)) with (πβΞ΄(π)/2, b+Ξ΄(π)/2). Then we shall have
π(π)βπ(π)<π(π)βπ(π)+π(π)βπ(π)<2Ξ΅.
Now we can go back and replace Ξ΅ with Ξ΅/2.
By the same proof, for any compact metric space π, any continuous function from π to β is uniformly continuous.
By an exercise,the image under a continuous function of a compact set is compact. Thus if π: β β β and is continuous, then for every interval [π, π], for some interval [π, π], π([π, π]) is a closed subset of [π,π].
By the Intermediate Value Theorem, we can require then π([π, π])=[π,π].
Topologically, intervals are connected, while the union of two disjoint open intervals or closed intervals is not connected.
By definition, a topological space is connected if its only βclopenβ (closed and open) subsets are itself and the empty set.
Exercise 18. Show that the image of a connected set under a continuous function is connected.
Every connected subset of β is an interval. For, suppose π΄ is a subset of β that is not an interval. Then there are π, π, and π in β such that π<π<π, and π and π are in π΄, but π is not. In this case, in the subspace topology of π΄, the set {π₯β π΄: π₯<π} is

open,

closed (since it is the complement of the open set {π₯β π΄: π<π₯}),

nonempty,

not all of π΄.
Thus π΄ is not connected.
Conversely, every interval of β is connected. For, suppose π΄ is a subset of β that is not connected. Then there is a subset π΅ of π΄, and there are elements π and π of π΄, such that

π΅ is clopen,

π<π,

πβ π΅,

πβ π΅.
Then the set {π₯: π₯β π΅ β§ π₯<π} contains π and is bounded above by π, so it has a supremum π. Then π is a limit point of π΅, and therefore π is in π΅ since this is closed. Thus π<π and (π, π) β© π΅ is empty. But since π΅ is also open, there is some positive Ξ΄ such that the set π΄ β© (πβΞ΄, π+Ξ΄) is subset of π΅. But then π΄ β© (π, min(π,π+Ξ΄)) is a subset of (π, π) β© π΅ and is therefore empty. Since the interval (π, min(π,π+Ξ΄)) is not empty, but lies between the elements π and π of π΄, this shows π΄ is not an interval.
The foregoing proofs work generally to show that the connected sets are precisely the intervals in any complete, dense linear order.
We have used that, in any such order, the intervals are just the convex sets. A subset π΄ of a linear ordered set Ξ© is convex if π΄ contains every element of Ξ© that lies between two elements of π΄. An interval of Ξ© is then a nonempty convex subset of Ξ© that

has an infimum, if it has a lower bound;

has a supremum, if it has an upper bound.
Exercise 19. In an arbitrary topological space, write π ~ π if every connected subset of the space that contains π contains π. Show that the relation ~ is an equivalence relation.
The equivalence class of π with respect to the relation ~ in the exercise is the connected component of π. If the topological space is the Cantor set, then the connected component of an element contains only that element.