If $f(x)$ is continuous at $x=g(a)$, and $g(x)$ is continuous at $x=a$, then $\lim_{x\rightarrow a} f(g(x)) = \lim_{g(x)\rightarrow g(a)} f(g(x))$
Is this proof for the above statement correct? If not, is the statement correct, and is there an easy proof of it? I ask because I think this would make the first proof of the 1-d chain rule on wikipedia more elegant, and it seems correct to me, but I'd like to check if I messed up.
If $g(x)$ is continuous at $x=a$ and $f(x)$ continuous at $x=g(a)$, then $\lim_{x\rightarrow a} f(g(x)) = f(\lim_{x\rightarrow a} g(x))$. $g(x)$ is continuous at $x=a$, and so $\lim_{x\rightarrow a} g(x) = g(a)$. Since $f$ is continuous at $g(a)$, then $\lim_{x \rightarrow g(a)} f(x) = f(g(a))$. Thus $f(g(a))$ exists. Thus $$ f(\lim_{g(x) \rightarrow g(a)} g(x)) = f(g(a)) = \lim_{g(x) \rightarrow g(a)} f(g(x))= f(g(a)) = f(\lim_{x\rightarrow a} g(x)) = \lim_{x\rightarrow a} f(g(x)) $$ QED. And so in the wikipedia proof of the chain rule, one can simply say that because $f(x)$ is differentiable (and so continuous) at $x=g(a)$, and $g(x)$ is differentiable (and so continuous) at $x=a$, then it follows that $$ (f \circ g)'(a) = \lim_{x\rightarrow a} \frac{f(g(x)) - f(g(a))}{x-a} $$ $$ = \lim_{x\rightarrow a} \frac{f(g(x)) - f(g(a))}{g(x)-g(a)} \frac{g(x) - g(a)}{x-a} $$ $$ = \lim_{x\rightarrow a} \frac{f(g(x)) - f(g(a))}{g(x)-g(a)} \lim_{x\rightarrow a}\frac{g(x) - g(a)}{x-a} $$ $$ = \lim_{g(x)\rightarrow g(a)} \frac{f(g(x)) - f(g(a))}{g(x)-g(a)} \frac{dg}{dx}(a) $$ $$ = \frac{df}{dg}(g(a))\frac{dg}{dx}(a) $$