Consider this problem:
Let $X$ be a metric space, $U$ be open, $K$ compact and $K\subset U$, show that there exists a $r>0$ such that $B(k,r)\subset U$ $\forall k\in K$
Here $B(k,r)=\{x\in X ;d(x,k)<r\}$, and note that $r$ does not depend on $k$, there is a $r$ that works for all $k$.
I saw a proof by contradiction using the fact that every sequence in $K$ have a subsequence that converges to a point on $K$. But when I'm working with compact sets, I like to investigate the problem using other features, like every continuous function defined on $K$ assumes a maximum and minimum, or every open covering of $K$ admits a finite cover. So I tried without success, for the former I defined the function $F:K\to \mathbb{R}$ by $F(k)=d(k,X-U)$, it's continuous and I tried to show that $r=\min_{k\in K}F$ works. For the latter I noticed that $k\in U$ $\forall k\in K$ and because U is open exists a $r_k$ such that $B_k(k,r_k)\subset U$ and so $\bigcup_{k\in K}B_k$ is a open covering of $K$ so I can extract a finite one, but then I got stuck.
I would like to understand and finalize the two proofs. Thanks for help!