Let $(X,d)$ be a compact metric space. Prove that there exists a number $K$ such that $d(x,y)\leq K$ for each $x,y\in X$. I'm reading Intro to Topology by Mendelson.
The problem statement is in the title.
My attempt at the proof is:
Since $X$ is a compact metric space, for each $n\in\mathbb{N}$, there exists $\{x_1^n,\dots,x_p^n\}$ such that $X\subset\bigcup\limits_{i=1}^p B(x_i^n;\frac{1}{n})$. Let $K=\frac{2p}{n}$. Then for each $x,y\in X$, $x\in B(x_i^n;\frac{1}{n})$ and $y\in B(x_j^n;\frac{1}{n})$ for some $i,j=1,\dots,p$. Thus, $d(x,y)\leq\frac{2p}{n}$.
The approach I was taking is taking $K$ to be the addition of the diameters of each open ball in the covering for $X$, that way, for any two elements in $X$, the distance between them must be less than the overall length of the covering. Did I say this mathematically or are there holes I need to fill in?
Thanks for any help or feedback!
 A: To round off the solutions, you can notice that $X\times X$ is compact, and $d:X\times X\to\mathbb{R}$ is continuous, and so obtains its max.
A: Suppose no such $K$ exists. Let $x$ be in $X$. Then for all $n\geq 1$, there exists an $N$ such that $B_N(x)\setminus B_n(x)\neq\emptyset$. let $\Lambda=\{B_n(x)\mid n\in\mathbb{N}\}$. $\Lambda$ is an open cover of $X$ but no finite subset of $\Lambda$ will cover $X$ because a finite subset has as union its largest ball, which we already know does not contain some element in some larger ball.
A: Suppose $X$ consists of two points a distance of $100$ apart. Take $n=1$ and $p=2$. Your proof implies the two points are a distance of $4$ apart.
A: Fix $p\in X$, then the function $f:X\to\mathbb{R}_+:x\mapsto d(x,p)$ is a continous function on a compact space $X$. Hence it is bounded, i.e. there exist $K>0$ such that for all $x\in X$ holds $d(x,p)\leq K/2$. Now take arbitrary $x,y\in X$, then
$$
d(x,y)\leq d(x,p)+d(p,y)\leq K
$$
A: By compactness, there are finitely many points $x_1, x_2, \ldots, x_n$ such that
$$
X = \cup_{i=1}^n B(x_i, 1)
$$
Now for any two points $x, y \in X$, choose $x_i$ and $x_j$ such that
$$
d(x, x_i) < 1 \qquad d(y,x_j) < 1
$$
Then
$$
d(x,y) \leq d(x,x_i) + d(x_i, x_j) + d(x_j, y) < 2 + d(x_i, x_j)
$$
So choose
$$
K = 2 + \max\{d(x_i,x_j) : 1\leq i, j \leq n\}
$$
