Limit of Composite Function

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

Let:
 * $\displaystyle \lim_{y \mathop \to \eta} \map f y = l$
 * $\displaystyle \lim_{x \mathop \to \xi} \map g x = \eta$

Then, if either:
 * Hypothesis 1: $f$ is continuous at $\eta$ (that is $l = \map f \eta$)

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

then:
 * $\displaystyle \lim_{x \mathop \to \xi} \map f {\map g x} = l$

Proof
Let $\epsilon > 0$.

Since $\displaystyle \lim_{y \mathop \to \eta} \map f y = l$, we can find $\Delta > 0$ such that:
 * $\size {\map f y - l} < \epsilon$ provided $0 < \size {y - \eta} < \Delta$

Let $y = \map g x$.

Then, provided that $0 < \size {\map g x - \eta} < \Delta$, we have:
 * $\size {\map f {\map g x} - l} < \epsilon$

But $\displaystyle \lim_{x \mathop \to \xi} \map g x = \eta$ and $\Delta > 0$.

Hence:
 * $\exists \delta > 0: \size {\map g x - \eta} < \Delta$ provided that $0 < \size {x - \xi} < \delta$

We now need to establish the reason for the conditions under which $0 < \size {x - \xi} < \delta \implies \size {\map f {\map g x} - l} < \epsilon$.

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

Consider the functions:
 * $\map g x = \eta, \map f y = \begin {cases}

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

Then:
 * $\displaystyle \lim_{y \mathop \to \eta} \map f y = y_2$ and $\lim_{x \mathop \to \xi} \map g x = \eta$

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

Now, if Hypothesis 1: $f$ is continuous at $\eta$, then $l = \map f \eta$ and so $\size {\map f y - l} < \epsilon$ even when $y = \eta$.

So we can write: provided that $\size {\map g x - \eta} < \Delta$, we have:
 * $\size {\map f {\map g x} - l} < \epsilon$

and the argument holds.

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

Then we can be sure that $\map g x \ne \eta$ provided that $0 < \size {x - \xi} < \delta$ for sufficiently small $\delta > 0$.

So we can write: $0 < \size {\map g x - \eta} < \Delta$ provided that $0 < \size {x - \xi} < \delta$, and the argument holds.