# Compact set in the order topology

Let $$(X, \leq)$$ be a linearly ordered set and let $$\mathcal{T}$$ denote the order topology on $$X$$. Prove that $$(X, \mathcal{T})$$ is compact if and only if every nonempty set of $$X$$ has a greatest lower bound and a least upper bound.

I don't know how to apply the definition of compactness in this topology. Can anyone give an idea?

For one direction, suppose that $$A\subseteq X$$ is a non-empty set with no least upper bound. Let $$U$$ be the set of upper bounds for $$A$$; show that $$U$$ is open. ($$U$$ may of course be empty.) Then show that
$$\{U\}\cup\{(\leftarrow,a):a\in A\}$$
is an open cover of $$X$$ with no finite subcover. You can use much the same idea if you have a non-empty set with no greatest lower bound.
For the other direction suppose that every non-empty subset of $$X$$ has a greatest lower bound and a least upper bound. In particular, $$X$$ has a least element $$a$$ and a greatest element $$b$$. Now imitate the proof that $$[0,1]$$ is compact to show that $$X$$ is compact.