We say that $K\subseteq\mathbb{R}$ is compact if for every open cover there exists a finite subcover.
We say that $K\subseteq \mathbb{R}$ is bounded if there exists $M>0$ such that for all $z\in K,$ $|z|\leq M.$
Question: Show that if $K$ is compact, then $K$ is bounded.
My attempt:
We can assume that $K$ is nonempty. Otherwise, let $M=1$ and we are done.
Let $x\in K.$ Consider the collection $$ \mathcal{O} = \{ (x-r,x+r): r>0 \}. $$ Clearly $\mathcal{O}$ is an open cover for $K.$ By compactness of $K$, there exists a natural number $N$ such that $$K \subseteq \bigcup_{k=1}^N (x-r_k,x+r_k).$$ where $r_1,...,r_N\in \mathbb{R}_+.$ Let $$M =|x| + \max_{1\leq k\leq N} r_k.$$ Clearly $M>0.$ Note that for every $z\in K,$ we have $$|z-x| < r_k$$ for some $1\leq k\leq N.$ By reverse triangle inequality, we have $$|z| - |x| \leq |z-x| < r_k \leq M-|x|.$$ It follows that $|z|\leq M$ for all $z\in K.$ Hence, $K$ is bounded.
My question is that can we take such $M$ in the proof above? Is it valid?
I think it's worthwhile adding that although there is no issue in the proof, an easier method is to take the open cover $\mathcal{O} = \{(-R, R) \mid R > 0\}$.
The argument then simplifies to the following: $K$ is compact, so there is a finite subcover $$\{(-R_i, R_i) \mid i = 1, \cdots, n\}$$
If $\overline{R} = \max R_i$ then $K \subset B_{\overline{R}}(0) = (-\overline{R}, \overline{R})$, i.e. each $x \in K$ satisfies $\lvert x \rvert \leq \overline{R}$. Note it is true in general that a compact subset of a metric space is bounded (and totally bounded).