Let $(X,\tau)$ a compact metric space and $\{ U_i : i \in I \}$ an open cover of $X$. Show that there is $r>0$ such that for all $a \in X$ there is an $i \in I$ such that $B_{r}(x) \subseteq U_{i}$.
My attempt:
By definition of compactness, $X$ is covered by some finite subset of $\{ U_{i} : i \in I \}$. Let $U_{1}, \ldots , U_{n}$ be such a finite subcover of $X$.
Choose any $x\in X$. Suppose $x$ lies in $U_1$. There is some number $r_{1}(x)$ such that for any $r < r_{1}(x)$, the ball $B_{r}(x)$ lies in $U_{1}$. For any $x \in X$, we may associate to $x$ the $n$ numbers $r_{1}(x), \ldots, r_{n}(x)$, noting that at least one of these is non-negative. Let $r(x)$ be the least non-negative member of $\{ r_{1}(x), \ldots , r_{n}(x) \}$.
Below, I prove that $r: X \to \mathbb{R}$ is a continuous function. As $r$ is continuous, $r(X)$ is a continuous subset of the real numbers. Therefore $r(X)$ is a finite union of finite closed intervals in $\mathbb{R}$. In particular, $r(X)$ contains a least element which we denote by $r_{0}$. Note that as $r(x)$ is greater than zero for all $x \in X$, we know that $r_{0} > 0$. For any $p
Is this correct? Can you give me another alternative solution?