TITLE: General proof of limit composition theorem on continuous function
QUESTION [5 upvotes]: Let $A, B \subset \mathbb{R}$, $a, b, c \in  \overline{\mathbb{R}}$, $a$ and $b$ be limit points of $A$ and $B$. Let $f: A \rightarrow B$ and $g : B \rightarrow \mathbb{R}$. I have to prove that if $b \in B$ and $g$ is cointinous in $b$ and 

$\lim \limits_{x \to a}{f(x)} = b$
$\lim \limits_{y \to b}{g(y)} = c$

then $\lim \limits_{x \to a}{(g \circ f)(x)} = c$.
How to make a proof to as general theorem as above?

REPLY [3 votes]: Let $\varepsilon>0$.
By the second limit, $|g(y)-c|<\varepsilon$ for all $|y-b|<\delta$ for a certain $\delta>0$. By the first limit, $|f(x)-b|<\delta$ for all $|x-a|<\delta'$ for a certain $\delta'>0$. And thus, if $|x-a|<\delta'$, 
$$|f(x)-b|<\delta,$$
therefore 
$$|g(f(x))-c|<\varepsilon$$ if $|x-a|<\delta'$.