Is it true that, if $f$ is uniformly continuous in $(a,b),$ then the limits $\lim_{x\to a^+} f(x)$ and $\lim_{x\to b^-} f(x)$ exist?

Let $f$ be a continuous function in $(a,b)$.

I know that: If the limits $\lim_{x\to a^+} f(x)$ and $\lim_{x\to b^-} f(x)$ exist, then $f$ is uniformly continuous in $(a,b)$.

Is the inverse also true?


YES.

If we define $$ g(x)=\left\{ \begin{array}{ccl} \lim_{x\to a^+}f(x) & \text{if} & x=a, \\ f(x) & \text{if} & x\in (a,b), \\ \lim_{x\to b^-}f(x) & \text{if} & x=b. \end{array} \right. $$ then $g$ is continuous in $[a,b]$, and hence uniformly continuous. Consequently, so is $$ f=g|_{(a,b)} $$

INVERSE. If $f: (a,b)\to\mathbb R$ is uniformly continuous, then the limits $$ \lim_{x\to a^+}f(x)\quad\text{and}\quad \lim_{x\to b^-}f(x) $$ exist.

Proof. We need the following:

Lemma. If $f$ uniformly continuous and $\{a_n\}$ is a Cauchy sequence, then so is $\{f(a_n)\}$.

Assuming the above, let $x_n\to a$, then $\{f(x_n)\}$ is Cauchy and hence convergent. Let $\lim_{n\to\infty}f(x_n)=\ell$. We shall show that $\lim_{x\to a^+}f(x)=\ell$. If not, then there would be an $\varepsilon>0$ and a sequence $\{y_n\}\subset (a,b)$, such that $y_n\to a$ and $|f(y_n)-\ell|\ge \varepsilon$. Let $\{z_n\}$ be the sequence $$ z_1=x_1,\, z_2=y_1,\, z_3=x_2,\,z_4=y_2,\,z_5=x_3,\,z_6=y_3,\, \text{etc}, $$ then $z_n\to a$, hence $\{f(z_n)\}$ is a Cauchy sequence. Since $f(z_{2n-1})=f(x_n)\to\ell$, then $f(z_n)\to\ell$, and thus $f(z_{2n})=f(y_n)\to\ell$, contradiction.

Note. More generally, if $A\subset\mathbb R$ and $f: A\to\mathbb R$ is uniformly continuous on $A$, then the limit $\lim_{x\to a}f(x)$ exists for every $a\in \overline{A}$, and $f$ extends continuously on $\overline{A}$.