[Math] If $E \subset\mathbb R$ is compact and nonempty. Prove $\sup (E)$, $\inf (E) \in E$

metric-spacesproof-verificationreal-analysis

Suppose that $E \subset \mathbb R$ is compact and nonempty. Prove $\sup (E)$, $\inf (E)\in E$.

attempt: Suppose $E$ is compact, then $E$ is closed and bounded. Thus $\sup(E)$ and $\inf (E)$ exist.
let $a = \sup(E)$, then there is a sequence $x_n \in E$ such that $x_n \to a$. Since $E$ is closed, then $a \in E$. Thus $\sup (E) \in E$.

Is this correct? Any feedback would really help. Thank you.

Best Answer

Your proof is correct. Depending on the rigor required, the following intuition may also pass:

The supremum of a set is always either contained in the set or is a limit point of the set. Since a compact set by definition contains all its limit points, it must contain its supremum. Similar for infimum.