A metric space $(X,d)$ is compact iff every real valued continuous function on $X$ is bounded.
I have got the solution to it which I dont get at all.
Since in a metric space compactness is equivalent to sequential compactness let us assume that $x_n$ is a sequence in $X$ which has no convergent subsequence. So each term of the sequence will occur finite number of times.
Now if we form a subsequence of that sequence $x_n$ taking only the distinct terms and name it $A$ we can for each $n\in\mathbb N$ find $r_n$ such that $B(x_n,r_n)\cap A=\{x_n\}$.
I cant understand it from here:
A function is taken $f_n(x)=n[1-\frac{2d(x,x_n)}{r_n}] ;d(x,x_n)\leq r_n$ otherwise it is taken to be zero.
Why is such a function chosen and what is the motivation?
Please help here .What to do next?