TITLE: Proving that $X$ is complete if $A\subset X$ is dense and every cauchy sequence in $A$ converges to a point in $X$.
QUESTION [5 upvotes]: I am having trouble proving the following statement:
"Let $(X,d)$ be a metric space and $A$ a dense subset such that every cauchy sequence in $A$ converges to a point in $X$. Prove that $X$ is complete". 
Let us take a cauchy sequence $\{x_i\}$ containing points from both $A$ and $X\setminus A$. 
If this cauchy sequence has a limit point, then it has to exist within $X$. Proof: Let us assume the limit $l$ exists outside $X$. Then every open set $B(l,r)$, $\forall r\in \Bbb{R}$ contains points from $\{x_i\}$, and because every open set containing any points from $X\setminus A$ contains points from $A$, every such $B(l.r)$ also contains points from $A$. Hence, $l$ should have been included in $\overline{A}=X$. 
However, I can't prove that such a limit point exists in the first place. Any help would be greatly appreciated. 
Thanks!

REPLY [9 votes]: A limit point can't "exist outside the space". You need to show that an arbitrary Cauchy sequence in $X$ converges.  To do this, the basic idea is that given a Cauchy sequence $(x_i)$ from $X$, you can consider a  sequence from $A$ that is "very close" to $(x_i)$. 
Here is an outline of how to effect this:

Given $(x_i)$ a Cauchy sequence in $X$, for each $i>0$ choose $a_i\in A$ with $d(a_i,x_i)<1/i$. 
Using the triangle inequality, show that $(a_i)$ is Cauchy (note here that you can write $$a_i-a_j=(a_i-x_i)+(x_i-x_j)+(x_j-a_j).$$ 
So $(a_i)$ converges to some $a\in X$. 
Now, using the triangle inequality again, show that $(x_i)$ converges to $a$ as well.