How to Prove the Chain Rule for Limits Using a $\varepsilon$-$\delta$ Argument? I came across the chain rule for limits the other day and it interested me quite a bit and surprisingly I couldn't find the proof on the internet anywhere. From what I understand the chain rule for limits states that if:
$$ \lim_{x\to c} g(x)=M$$ and $$\lim_{x\to M} f(x)=L$$ then$$\lim_{x\to c} \ f(g(x))=L$$
1.Under what conditions does this hold true?
2.What is the epsilon-delta proof for the rule?
 A: Claim: Suppose $f$ and $g$ are functions such that $\lim_{x \rightarrow a} f(x) = L_1$ and $\lim_{y \rightarrow L_1} g(y) = L_2$ then $\lim_{x \rightarrow a} g ( f(x)) = L_2$. 
Proof: Let $\epsilon > 0$ and choose $\delta >0$ such that if $0<|x-a|<\delta$ then $|f(x)-L_1|< \delta_2$ where $\delta_2 >0$ is small enough to force $|g(y)-L_2| < \epsilon$ for all $y \in \mathbb{R}$ such that $0 < |y-L_1| < \delta_2$. 
We can choose $\delta_2 > 0$ as above because we were given that $\lim_{y \rightarrow L_1} g(y) = L_2$. Further, we can also choose $\delta >0$ to force $|f(x)-L_1| < \delta_2$ because we were also given that $\lim_{x \rightarrow a} f(x) = L_1$. 
Suppose that $x \in \mathbb{R}$ such that $0 < |x-a| < \delta$ and observe that $|g(f(x))-L_2 | < \epsilon$. Therefore, by the definition of the limit, $\lim_{x \rightarrow a} g ( f(x)) = L_2$. 
$\Box$ 
Thanks to Vim for correcting comment. Let me attempt a modified proof, it may be useful to locate the error in the logic above,
Modified Claim: Suppose $f$ and $g$ are continuous functions such that $\lim_{x \rightarrow a} f(x) =L_1$ and $\lim_{y \rightarrow L_1} g(y) = L_2 = g(L_1)$ then $\lim_{x \rightarrow a} g ( f(x)) = L_2$. 
Modified Proof: Since $\lim_{x \rightarrow a} f(x) = f(a)=L_1$ it follows that for each $\delta_2 >0$ there exists $\delta>0$ such that $0 < |x-a|< \delta$ implies $|f(x)-L_1| < \delta_2$. 
Let $\epsilon>0$ and pick $\delta_2>0$ such that $0< |y-L_1|< \delta_2$ implies $|g(y)-L_2| < \epsilon$. This choice of $\delta_2$ is possible since we are given that $\lim_{y \rightarrow L_1} g(y) = L_2$.
Suppose that $x \in \mathbb{R}$ such that $0 < |x-a| < \delta$ implies $|f(x)-L_1| < \delta_2$. Thus, for $y=f(x)$,we have $|y-L_1|< \delta_2$. We don't quite have what is needed to conclude just yet since we need $0<|y-L_1| < \delta_2$ in order to conclude $|g(y)-L_2|=|g(f(x))-L_2 | < \epsilon$. Consider two cases:


*

*$0=|y-L_1|$ in which case $y=L_1$ hence $|g(L_1)-L_2| = |g(L_1)-g(L_1)| = 0 < \epsilon$

*$0< |y-L_1|<\delta_2$ in which case we have $|g(y)-L_2|=|g(f(x))-L_2 | < \epsilon$


Hence, in all cases possible,$0 < |x-a| < \delta$ implies $|g(f(x))-L_2|< \epsilon$. Therefore, by the definition of the limit, $\lim_{x \rightarrow a} g ( f(x)) = L_2$. 
$\Box$ 
Of course, we can also state this result as it is often applied: the continuity of the outer function allows us to pull the limit inside out:
$$ \lim_{x \rightarrow a} g(f(x)) = g \left( lim_{x \rightarrow a} f(x) \right)$$
where once again I should emphasize, the continuity of $g$ at $lim_{x \rightarrow a} f(x)$ is assumed.
