prove: a complete metric space $X$ is compact if and only if ... 
Let $X$ be a complete metric space. Suppose that for any infinite subset $A$ of $X$ and for any $\epsilon>0$ there are $x_1,x_2 \in A$ such that $d(x_1,x_2)< \epsilon$. Show that $X$ is compact.

I've shown the right to left claim (if $X$ is compact...).
Here I've tried to prove by contradiction but with no success.
Thank you in advance.
 A: How to prove this depends a great deal on what tools you already have. The first answer assumes that you know that a metric metric space is compact if and only if it’s complete and totally bounded, but I shouldn’t be at all surprised if this exercise were intended to prepare for that result.
Suppose that whenever $A$ is an infinite subset of $X$ and $\epsilon>0$, there are $x,y\in A$ such that $d(x,y)<\epsilon$. For each $n\in\Bbb N$ we can construct a subset $D_n$ of $X$ as follows. Let $x_0^{(n)}$ be any point of $X$. Suppose that $m\in\Bbb Z^+$, and we’ve chosen points $x_k^{(n)}\in X$ for $k<m$ in such a way that $d\left(x_k^{(n)},x_\ell^{(n)}\right)\ge 2^{-n}$ for $0\le k<\ell<m$. If $$\bigcup_{k<m}B_d\left(x_k^{(n)},2^{-n}\right)=X\;,$$ let $D_n=\{x_k^{(n)}:k<m\}$, and stop. Otherwise, pick any point
$$x_m^{(n)}\in X\setminus\bigcup_{k<m}B_d\left(x_k^{(n)},2^{-n}\right)\;,$$
and continue. If this process did not stop after some finite number of steps, we’d end up with an infinite set $\{x_k^{(n)}:k\in\Bbb N\}$ such that $d\left(x_k^{(n)},x_\ell^{(n)}\right)\ge 2^{-n}$ whenever $k,\ell\in\Bbb N$ and $k\ne\ell$, contradicting our assumption about $X$. Thus, the process must stop after a finite number of steps, and we end up with a finite set $D_n$ such that
$$\bigcup_{x\in D_n}B_d(x,2^{-n})=X\;.$$
(In fact we’ve simply shown that $\langle X,d\rangle$ is totally bounded.)
Now let $\sigma=\langle x_n:n\in\Bbb N\rangle$ be any sequence in $X$. $D_0$ is finite, so there are a $y_0\in D_0$ and an infinite $N_0\subseteq\Bbb N$ such that $x_k\in B_d(y_0,1)$ for each $k\in N_0$. Similarly, $D_1$ is finite, so there are a $y_1\in D_1$ and an infinite $N_1\subseteq\Bbb N$ such that $x_k\in B_d(y_1,2^{-1})$ for each $k\in N_1$. Continuing in this fashion, we find for each $n\in\Bbb N$ a $y_n\in D_n$ and an infinite $N_n\subseteq\Bbb N$ such that $x_k\in B_d(y_n,2^{-n})$ for each $k\in N_n$, and moreover $N_n\supseteq N_{n+1}$ for each $n\in\Bbb N$.
Now choose a subsequence $\langle x_{n_k}:k\in\Bbb N\rangle$ of $\sigma$ in such a way that $n_k\in N_k$ for each $k\in\Bbb N$. I leave it to you to show that this subsequence is necessarily Cauchy and therefore must converge, since $X$ is complete.
A: A metric space $X$ is compact if and only if it is complete and totally bounded. If your $X$ is not compact, it can't be totally bounded. That means there's an infinite $\varepsilon$-packing $A$, which is exactly the set you need.
