Extendability Theorem for Function Continuous on Open Interval

Theorem
Let $f$ be a continuous real function that is defined on an open interval $\left({a \,.\,.\, b}\right)$.

Suppose $g$ is a real function that satisfies:


 * $g$ is defined on $\left[{a \,.\,.\, b}\right]$.


 * $g$ is continuous on $\left[{a \,.\,.\, b}\right]$.


 * $g$ equals $f$ on $\left({a \,.\,.\, b}\right)$.

Then $g$ exists iff $\displaystyle \lim_{x \to a^+} f \left({x}\right)$ and $\displaystyle \lim_{x \to b^-} f \left({x}\right)$ exist.

Proof
Assume that $\displaystyle \lim_{x \to a^+} f\left({x}\right)$ and $\displaystyle \lim_{x \to b^-} f\left({x}\right)$ exist.

We need to prove that a function $g$ with the properties listed in the theorem exists.

Define $g$ to be equal to $f$ on $\left({a \,.\,.\, b}\right)$.

Define $g\left({a}\right)$ = $\displaystyle \lim_{x \to a^+} f\left({x}\right)$ and $g\left({b}\right)$ = $\displaystyle \lim_{x \to b^-} f\left({x}\right)$.

The existence of the limits on the right hand sides of these two equations ensures that $g$ is defined at $a$ and $b$.

Since $f$ is continuous on $\left({a \,.\,.\, b}\right)$ and $g$ equals $f$ there, $g$ too is continuous on $\left({a \,.\,.\, b}\right)$.

It remains to show that $g$ is continuous at $a$ and $b$.

We have per definition $g \left({a}\right)$ = $\displaystyle \lim_{x \to a^+} f\left({x}\right)$ and $g\left({b}\right)$ = $\displaystyle \lim_{x \to b^-} f\left({x}\right)$.

Since the limiting process at $a$ requires $x$ to approach $a$ from above, $x$ can be considered as being an element of $\left({a \,.\,.\, b}\right)$.

Since the limiting process at $b$ requires $x$ to approach $b$ from below, $x$ can be considered as being an element of $\left({a \,.\,.\, b}\right)$.

In $\left({a \,.\,.\, b}\right)$, $f$ equals $g$.

Therefore, the two equations above can be written: $g\left({a}\right)$ = $\displaystyle \lim_{x \to a^+} g\left({x}\right)$ and $g\left({b}\right)$ = $\displaystyle \lim_{x \to b^-} g\left({x}\right)$.

These two equations are exactly the definitions of continuity for $g$ at respectively $a$ and $b$, so $g$ is continuous at $a$ and $b$.

This finishes the first part of the proof.

Assume that $g$ exists.

We need to prove that the limits $\displaystyle \lim_{x \to a^+} f\left({x}\right)$ and $\displaystyle \lim_{x \to b^-} f\left({x}\right)$ exist.

Since $g$ is continuous, $g$ is continuous at the end points of its domain, $a$ and $b$.

$g$ is right-continuous at $a$ and left-continuous at $b$.

This means that $g\left({a}\right)$ = $\displaystyle \lim_{x \to a^+} g\left({x}\right)$ and $g\left({b}\right)$ = $\displaystyle \lim_{x \to b^-} g\left({x}\right)$.

In turn, this means that the expressions $\displaystyle \lim_{x \to a^+} g\left({x}\right)$ and $\displaystyle \lim_{x \to b^-} g\left({x}\right)$ exist.

Since $g$ = $f$ on $\left({a \,.\,.\, b}\right)$, and $x$ as being part of the two limiting processes in these expressions are confined to $\left({a \,.\,.\, b}\right)$, $g$ in the expressions can be replaced by $f$.

We conclude that $\displaystyle \lim_{x \to a^+} f\left({x}\right)$ and $\displaystyle \lim_{x \to b^-} f\left({x}\right)$ exist.

This finishes the proof.