How does the limit law $\lim_{x \to a}f\bigl(g(x)\bigr)=f\left(\lim_{x \to a}g(x)\right)$ work? I have $2$ questions regarding the following limit law:

Suppose that $\lim_{x \to a}g(x)$ exists and is equal to $l$, and that $f$ is
continuous at $l$. Then, $\lim_{x \to a}f\bigl(g(x)\bigr)$ exists, and
$$
\DeclareMathOperator{\epsilon}{\varepsilon} 
\lim_{x \to a}f\bigl(g(x)\bigr)=f(l)=f\left(\lim_{x \to a}g(x)\right) \, .
$$

My questions are:

*

*Have I stated this limit law correctly?

*How do you prove this limit law?

Here is my attempted proof:
Let $\epsilon>0$. We wish to find a $\delta>0$ such that, for all $x$,

If $0<|x-a|<\delta$, then $|f(g(x))-f(l)|<\epsilon$.

We are given that $f$ is continuous at $l$, i.e. that there exists a $\delta'>0$ such that, for all $y$,

If $|y-l|<\delta'$, then $|f(y)-f(l)|<\epsilon$.

We are also given that $\lim_{x \to a}g(x)=l$, meaning that there is a $\delta>0$ such that

If $0<|x-a|<\delta$, then $|g(x)-l|<\delta'$

Since $g(x)$ is a number $y$ satisfying $|y-l|<\delta'$, we get that $|f(g(x))-f(l)|<\epsilon$. Hence, if $0<|x-a|<\delta$, then $|f(g(x))-f(l)|$, and so $\lim_{x \to a}f(g(x))=f(l)=f\left(\lim_{x \to a}g(x)\right)$, completing the proof.
 A: If $g(x)$ is continuous at $a$ and $f(x)$ is continuous at $g(a)$
Then for any $\epsilon_1$ there exists a $\delta_1$ such that $|x-a|<\delta_1 \implies |g(x) - g(a)| < \epsilon_1$
and
for any $\epsilon_2$ there exists a $\delta_2$ such that $|y-g(a)|<\delta_2 \implies |f(y) - f(g(a))| < \epsilon_2$
Choose $\epsilon_1$ to be less less than $\delta_2$
A: Your proof is fine.
So my remarks would go towards minor issues for a better wording (I think).
There is no need for the $0<|x-a|$ an absolute value is always positive, and it is not mandatory that $x\neq a$.
Also I would not state the conclusion as the starting point, it is a bit confusing, start at "We are given...".
Finally I would use proper quantifiers rather than "if, then, let", and repeating it mathematically the line below.
The following formulation is less verbose, and just fine:

*

*$g$ has limit $l$ at $a$ so $\quad\forall \delta'>0,\ \exists \delta>0\text{ s.t } |x-a|<\delta\implies |g(x)-l|<\delta'$

*$f$ is continuous at $l$ so $\quad \forall \epsilon>0,\ \exists \delta'>0\text{ s.t } |y-l|<\delta'\implies |f(y)-f(l)|<\epsilon$
Consequently:
$$\forall \epsilon>0, \exists\delta>0\text{ s.t }|x-a|<\delta\implies |g(x)-l|<\delta'\implies |f(g(x))-f(l)|<\epsilon$$
And the theorem is proved.
