I have the following problem at hand:
Let $(X, d)$ be a complete metric space and $f: X \rightarrow Y$ be continuous. Prove that $f$ is uniformly continuous on any totally bounded subset of $X$.
My attempt is as follows:
I want to prove any totally bounded subset of complete metric space is compact. After that, proof will follow since for compact domains continuity implies uniform continuity. For this purpose, let $A$ be totally bounded subset of $X$ and let ${a_n}$ be any sequence in $A$. Since, $A$ is totally bounded, it has Cauchy subsequence, call ${a_{k_n}}$. Since X is complete, ${a_{k_n}} \rightarrow x$ for some $x$ in $X$. Now I am stuck here and cannot prove that $x$ lies in $A$.
How may I proceed after here? Or total idea from the beginning is wrong? If so, any idea on the proof?
As noted in the comments, your approach would not work because totally bounded subsets of complete metric spaces need not be compact.
Instead, if $A$ is a totally bounded subset of a complete metric space $X$, then $\overline{A}$ is totally bounded and complete, hence compact. Thus, $f$ is uniformly continuous on $\overline{A}$, which implies that $f$ is uniformly continuous on $A$.
To see this, note that $f$ being uniformly continuous on $\overline{A}$ means that for all $\epsilon > 0$ there is a $\delta > 0$ such that for $x,y \in \overline{A}$ if $d(x,y) < \delta$ then $d(f(x), f(y)) < \epsilon$. So let $\epsilon > 0$ and get a $\delta > 0$ from uniform continuity on $\overline{A}$. Notice that if $x,y \in A$ with $d(x,y) < \delta$, then $x,y \in \overline{A}$ and also $d(x,y) < \delta$; it follows that for this choice of $\delta$ we have $d(f(x), f(y)) < \epsilon$ (from uniform continuity on $\overline{A}$), which is precisely the uniform continuity of $f$ on $A$.