Prove if nonempty $K \subset\mathbb{R}$ is compact, then both sup $K$ and inf $K$ exist and are elements of $K$. 
Prove if nonempty $K \subset \mathbb{R}$ is compact, then both sup $K$ and inf $K$ exist and are elements of $K$.

I manage to prove the existence of sup $K$ by using the Axiom of Completeness. But I failed to prove that $\sup K \in K$. Can anyone guide me ?

Consider the function $f:x\in K\mapsto x\in\mathbb R$ and use Weierstrass' theorem stating that a continuous real function on a compact space attains its supremum.
