Limit of Composite Function

Theorem
Let $f$ and $g$ be real functions.

Let:
 * $\displaystyle \lim_{y \to \eta} f \left({y}\right) = l$
 * $\displaystyle \lim_{x \to \xi} g \left({x}\right) = \eta$

Then, if either:
 * Hypothesis 1: $f$ is continuous at $\eta$ (i.e. $l = f \left({\eta}\right)$)

or:
 * Hypothesis 2: for some open interval $I$ containing $\xi$, it is true that $g \left({x}\right) \ne \eta$ for any $x \in I$ except possibly $x = \xi$

then:
 * $\displaystyle \lim_{x \to \xi} f \left({g \left({x}\right)}\right) = l$

Proof
Let $\epsilon > 0$.

Since $\displaystyle \lim_{y \to \eta} f \left({y}\right) = l$, we can find $\Delta > 0$ such that:
 * $\left|{f \left({y}\right) - l}\right| < \epsilon$ provided $0 < \left|{y - \eta}\right| < \Delta$

Let $y = g \left({x}\right)$.

Then, provided that $0 < \left|{g \left({x}\right) - \eta}\right| < \Delta$, we have:
 * $\left|{f \left({g \left({x}\right)}\right) - l}\right| < \epsilon$

But $\displaystyle \lim_{x \to \xi} g \left({x}\right) = \eta$ and $\Delta > 0$.

Hence:
 * $\exists \delta > 0: \left|{g \left({x}\right) - \eta}\right| < \Delta$ provided that $0 < \left|{x - \xi}\right| < \delta$

We now need to establish the reason for the conditions under which $0 < \left|{x - \xi}\right| < \delta \implies \left|{f \left(g \left({x}\right)\right) - l}\right| < \epsilon$.

As it stands, this is not generally the case, as follows.

Consider the functions:
 * $g \left({x}\right) = \eta, f \left({y}\right) = \begin{cases}

y_1 & : y = \eta \\ y_2 & : y \ne \eta \end{cases}$

Then:
 * $\displaystyle \lim_{y \to \eta} f \left({y}\right) = y_2$ and $\lim_{x \to \xi} g \left({x}\right) = \eta$

But it is not true that $\displaystyle \lim_{x \to \xi} f \left({g \left({x}\right)}\right) = y_2$ because $\forall x: f \left({g \left({x}\right)}\right) = y_1$.

Now, if Hypothesis 1: $f$ is continuous at $\eta$, then $l = f \left({\eta}\right)$ and so $\left|{f \left({y}\right) - l}\right| < \epsilon$ even when $y = \eta$.

So we can write: provided that $\left|{g \left({x}\right) - \eta}\right| < \Delta$, we have:
 * $\left|{f \left({g \left({x}\right)}\right) - l}\right| < \epsilon$

and the argument holds.

Otherwise, let us assume Hypothesis 2: For some open interval $I$ containing $\xi$, it is true that $g \left({x}\right) \ne \eta$ for any $x \in I$ except possibly $x = \xi$.

Then we can be sure that $g \left({x}\right) \ne \eta$ provided that $0 < \left|{x - \xi}\right| < \delta$ for sufficiently small $\delta > 0$.

So we can write: $0 < \left|{g \left({x}\right) - \eta}\right| < \Delta$ provided that $0 < \left|{x - \xi}\right| < \delta$, and the argument holds.