Here is problem that appeared in one of the past final exams for my introductory real analysis course, that I am having hard time to solve. It is Question 5 in 8 of the following file:
http://www.math.ubc.ca/Ugrad/pastExams/Math_321_April_2008.pdf
Let $\{f_n\}_{n\in\mathbb{N}}$ be a uniformly convergent sequence of continuous real–valued functions defined on a metric space $M$ and let $g$ be a continuous function on $\mathbb{R}.$ Define, for each $n\in\mathbb{N}$, $h_n(x) = g(f_n(x))$.
(a) Let $M = [0, 1]$. Prove that the sequence $\{h_n\}_{n\in\mathbb{N}}$ converges uniformly on $[0, 1]$.
(b) Let $M = \mathbb{R}$. Either prove that the sequence $\{h_n\}_{n\in\mathbb{N}}$ converges uniformly on $\mathbb{R}$ or provide a counterexample.
I have proved part (a). I am having trouble with part (b). It seems to me that part (b) has a counterexample. This is because, the key point in part (a) is that $g$ is uniformly continuous on $[0,1]$ (because $[0,1]$ is compact), but in part (b) compactness is removed. So my guess is that counter-example will involve something like $g(x)=x^2$ (which is an example of continuous function which is not uniformly continuous on $\mathbb{R}$). Is this guess correct? What would be an example of uniformly convergent sequence $\{f_n\}$ of functions in this case?
I would very much appreciate any help!