Show that if K is compact, then sup K and inf K both exist and are elements of K.
Since K is bounded it has a supremum. But the supremum of K is a boundary point of K. However, K is closed and therefore it contains its boundary points. Therefore, K contains its supremum, and similarly its infimum.