TITLE: Convergence of composition of functions sequences
QUESTION [7 upvotes]: Let $X$ be a metric space, $f_n: X \to X$, $g_n: X \to X$,
$f_n(x) \to f(x)$, $g_n(x) \to g(x)$  ($n \to \infty$).
Is $f_n(g_n(x)) \to f(g(x))$ ?
Here: 1) pointwise convergence;
2) uniform convergence.
So, there are 2 cases in my question.
In the first case $f_n \to f$ and $g_n \to g$ pointwise.
In the second case $f_n \to f$ and $g_n \to g$ uniformly.
Thank you very much!

REPLY [4 votes]: No to both. Here are two examples:
1) Take $f_n(x)=x^n$ and $g_n(x)=1-\frac{x}{n}$ on the real interval $[0,1]$, then they converge pointwise to $f=\begin{cases}1&x=1\cr 0&x<1\end{cases}$ and $g=1$ respectively, so $f(g(x))=1$, but $f_n\circ g_n(x)\to e^{-x}$.
1+2) $f_n(x)=f(x)=\begin{cases}1&x>0\cr 0&x\le0\end{cases}$ and $g_n(x)=x/n$. They converge uniformly to $f$ and $g=0$ on $[-1,1]$ and $f\circ g(x)=0$; yet $f_n\circ g_n=f$.