Proof of the Lebesgue number lemma I want to prove the Lebesgue number lemma:

Let $(X, d)$ be a compact metric space. Then given an open cover $\mathcal{A}$ of $X$,  there exists $\delta \gt 0$ such that for each subset of $X$ having diameter less than $\delta$, there is an element of $\mathcal{A}$ containing it. 

How can I prove this?
 A: This is known as the Lebesgue number lemma. The $\delta > 0$ promised by it is called a Lebesgue number of the cover $\mathcal A$. Considering the importance of this result, I give two proofs for it. This answer describes an open cover based proof; another one based on my favorite extreme value theorem is in another answer. 
Since $\mathcal A$ is an open cover, for each $x \in X$, there is a member $A_x \in \mathcal A$ such that $x \in A_x$. Since $A_x$ is open, there exists $r(x) > 0$ such that $B(x, 2 r(x)) \subseteq A_x \in \mathcal A$. (Notice that the radius of the ball is $2 r(x)$, not $r(x)$.) Now $\left\{ B(x, r(x)) \right\}_{x \in X}$ is an open cover of $X$; hence by compactness, there exists a finite set $S \subseteq X$ such that $X = \bigcup _{x \in S}  \ B(x, r(x)) $. Finally, we claim that $\delta = \min \{ r(x) \, \colon \, x \in S \}$ works: 


*

*First, $\delta > 0$ since we are minimising over a finite set of strictly positive numbers. 

*Given $y \in X$, there exists $x \in S$ such that $y \in B(x, r(x))$. Then
$$
B(y, \delta) \subseteq B(y, r(x)) \stackrel{\color{Red}{(\triangle)}}{\subseteq} B(x, 2 r(x)) \subseteq A_x \in \mathcal A.
$$
[Exercise: Explain the inclusion marked with $\color{Red}{(\triangle)}$.]  $\qquad \square$

Except for some notational changes, this proof is the same as the one gary's comment points to. Check this blog page.
A: We give an approach using the extreme value theorem. The following definition is a key ingredient in the proof: $\newcommand{\diam}{\operatorname{diam}}$

For each $x \in X$, define $h(x) \in \mathbb R^{\geqslant 0}$ to be the infimum of $\diam S$ over all $S \subseteq X$ satisfying the following conditions:
  
  
*
  
*$x \in S$, and
  
*$S \nsubseteq U$ for any $U \in \mathcal A$.
  

We now study the map $h: X \to \mathbb R^{\geqslant 0}$ as defined above. Note first that $h(x) > 0$ for every $x \in X$. [Proof is left as exercise.]
Lipschitzness. The main technical idea is to show that $h$ is $1$-Lipschitz. Fix any $x, y \in X$; we want to show that $h(y) \geqslant h(x) - d(x,y)$. Further fix an arbitrary $\varepsilon > 0$. By the definition of $h(y)$, there exists $T \subseteq X$ such that 


*

*$y \in T$;

*$T$ is not contained in any $U \in \mathcal A$;

*$\diam T \leqslant h(y) + \varepsilon$.


Now, consider $S = T \cup \{ x \}$. Clearly, 


*

*$x \in S$;

*$S$ is not contained in any $U \in \mathcal A$ (why?); 

*$\diam S \stackrel{\color{Red}{(!!)}}{\leqslant} \diam T + d(x,y) \leqslant h(y)  + \varepsilon + d(x,y)$. [Exercise: Justify the inequality marked $\color{Red}{(!!)}$.]


Therefore, by definition of $h(x)$, we can see that $h(x) \leqslant h(y) + d(x,y) + \varepsilon$. Since this is true for all $\varepsilon > 0$, it follows that $h(x) \leqslant h(y) + d(x,y)$.
Wrap-up of the proof. Since $h$ is Lipschitz, it is also continuous on $X$. Furthermore, being a continuous function over a compact set, $h$ is guaranteed (by the extreme value theorem) to attains its minimum over $X$, and this minimum is strictly positive. Let $\delta > 0$ be any number that is strictly smaller than $h(x)$ for all $x \in X$. It only remains to check that such a $\delta$ satisfies the requirements of the problem. I leave that as a simple exercise. 
A: From the  open cover $\mathcal{A}= (U_i)_{i \in I}$ we get another cover with open sets $(U_{i,n})$ where
$$U_{i,n} = \{ x \in X \ | d(x, X \backslash U_i)> 1/n\}$$
Take a finite subcover 
$$\{ U_{i_1, n_1}, \ldots, U_{i_k, n_k} \}$$
Any $\delta < \min \{ 1/n_1, \ldots, 1/n_k\}$ will work. 
A: Here is another proof: 

Note: Definition of $f_A(x)$ and proof its continuity are in here.
