If $K\in \Bbb{R}^n$ is compact, $\sup_{x,y\in K}|x-y|=\max_{x,y\in K}|x-y|$. Suppose $K\in \Bbb{R}^n$ is compact. Let us denote $D=\sup_{x,y\in K}|x-y|$ as $K's$ diameter. Prove there exist $a,b\in K$ such that $D=|a-b|$ i.e, that the suprimum is the maximum. 
I know there must be such points. I also know that if a function on $K$ is continuous, then it is bounded. I know that $f(x,y)=|x-y|$ is a function. I don't know how to check if it is continuous. What is more problematic is that I am not sure if the theorem that says that a continuous function on a compact set is bounded, is also admissible for 2-variables functions. I could really use some guidance. 
 A: I'll answer your second question first. You have $f:K\times K\to\mathbb R$. The space $K\times K$ is the product of two compact sets, and is therefore compact. This is not hard to prove, and is a very simple result of the Tychonoff Theorem.
Now, in order to apply the extreme value theorem, we have to show that $f$ is continuous. To do this, pick $\varepsilon>0$. Let us define the product metric on $K\times K$ as $$d((x_1,y_1),(x_2,y_2))=\max\{|x_1-x_2|,|y_1-y_2|\}.$$ This is consistent with the Euclidean norm on $\mathbb R^{2n}$. Let $\delta<\varepsilon/2$. Then if $d((x_1,y_1),(x_2,y_2))<\delta$, both $|x_1-x_2|$ and $|y_1-y_2|$ are less than $\delta$. Thus, $$|f(x_1,y_1)-f(x_2,y_2)|\leq |f(x_1,y_1)-f(x_1,y_2)|+|f(x_1,y_2)-f(x_2,y_2)|\\=||x_1-y_1|-|x_1-y_2||+||x_1-y_2|-|x_2-y_2||\leq|y_1-y_2|+|x_1-x_2|\\<\delta+\delta<\varepsilon.$$
Thus, $f$ is a continuous function on a compact set, so it achieves a maximum which is equal to the diameter of the set.
A: We can use compactness of the product $K\times K$ without mentioning it.
There is a sequence $(x_m,y_m)\in K\times K$ such that
$$
\lim_{m\to\infty}|x_m-y_m|=\sup_{x,y\in K}|x-y|
$$
by the properties of the supremum. Since $K$ is compact, the sequence $(x_m)$ has a convergent subsequence, say $(x_{m_h})$. Similarly, the sequence $(y_{m_h})$ has a convergent subsequence, say $(y_{m_{h_k}})$.
The subsequence $(x_{m_{h_k}})$ converges to the same point as $(x_{m_h})$, so we get that the sequences $(a_k)$ and $(b_k)$ are both convergent, where
$$
a_k=x_{m_{h_k}},\qquad b_k=y_{m_{h_k}}
$$
Since the sequence $(|a_k-b_k|)$ is a subsequence of $(|x_m-y_m|)$ it converges to the same limit, hence
$$
\lim_{k\to\infty}|a_k-b_k|=\sup_{x,y\in K}|x-y|
$$
But, as $K$ is closed, we have $a=\lim_{k\to\infty}a_k\in K$ and $b=\lim_{k\to\infty}b_k\in K$. Also $\lim_{k\to\infty}(a_k-b_k)=a-b$ by continuity of sum and difference in $\mathbb{R}^n$.
By continuity of the norm, we have
$$
\sup_{x,y\in K}|x-y|=\lim_{k\to\infty}|a_k-b_k|=|a-b|
$$
so the supremum is actually a maximum.
A: A two variable function can be thought of as a one-variable function on a product space.  For example, if $X,Y,Z$ are spaces, and $f(x,y)$ is a two-variable function taking values in $Z$, for $x\in X,y\in Y$, then we think of $f$ as a function $f\colon X\times Y\to Z$.  
This leaves the matter of what metric/topology to put on the product $X\times Y$.  We want to choose a metric/topology such that the continuous functions $X\times Y\to Z$ are the same as the continuous two-variable functions $f(x,y)$ for $x\in X,y\in Y$ that take values in $Z$.  In the case of a metric, if $d_X$ is a metric on $X$ and $d_Y$ is a metric on $Y$, then we take the metric $d$ on $X\times Y$ given by 
$$
d(x,y)=\max\{d_X(x),d_Y(y)\}
$$
or (sometimes more useful for subsets of $\mathbb R^n$)
$$
d(x,y)=\sqrt{d_X(x)^2+d_Y(y)^2}
$$
In your case, we have a function $f\colon K\times K\to\mathbb R$.  In order to use the result about compact spaces we need to choose an appropriate metric on the product $K\times K$.  
Since $K\subset\mathbb R^n$, an alternative to the constructions above is to observe that $K\times K\subset \mathbb R^{2n}$.  So it inherits a natural metric.  
All you have to do now is show that $K\times K$ is compact.  A general theorem in topology asserts that the product of compact spaces is always compact, but your special case will be easier to prove.  
