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 ?
 A: 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.
A: A compact set in $\mathbb{R}$ is equivalent to being closed and bounded. Note that $\sup K$ is a limit point of $K$ and since $K$ is closed, $\sup K \in K$ by definition of closed.
EDIT:
A limit point $\alpha$ of a set $K$ in a metric space (which in this case is $\mathbb{R}$) is a point such that every open ball around it (which in this case is open interval in $\mathbb{R}$) intersects $K$.
Let $\alpha = \sup K$, and let $\epsilon >0$. Consider an interval of radius $\epsilon$ around $\alpha$, which is $(\alpha - \epsilon, \alpha + \epsilon)$. Note that there is necessarily an element $x$ in $K$ such that $ \alpha - \epsilon < x< \alpha$. If there is no such $x$ in $K$ that satisfies the previous inequality, then there will be a contradiction. Since $\epsilon>0$ is arbitrary, $\alpha$ is a limit point of $K$.
A: Let $M:=\sup K<\infty$ since $K$ is bounded by compactness. Then there exists (by definition of sup) a sequence $x_k$ in $K$ that converges to $M$. Since $K$ is compact it is closed. Hence the limit $M$ of$x_k$ belongs to $K$
