Continuity and Uniform Continuity on half closed intervals I have been stuck on the following problem for a long time : 

Prove that if a function $f:(a,b]\to\mathbb R$ is continuous, then it is uniformly continuous if and only if $\lim_{x\to a^+}f(x)$ exists and is finite.


Recall that $$\lim_{x\to a^+}f(x)=L$$ if and only if for all $\varepsilon>0$, there exists $\delta>0$ such that $|f(x)-L|<\varepsilon$ for all $x\in (a,b]$ with $y-a<\delta$.
First, suppose $f$ is uniformly continuous. Let $\varepsilon>0$ and let $\{x_n\}$ be a sequence in $(a,b]$ with $\lim_{n\to\infty} x_n=a$. Choose $\delta>0$ such that $|f(x)-f(y)|<\varepsilon$ for all $x,y\in(a,b]$ with $|x-y|<\delta$. Choose $N$ such that $x_n-a<\delta$ for $n\geqslant N$. Then for $n,m\geqslant N$, we have
$$|f(x_n)-f(x_m)|<\varepsilon, $$
so that $\{f(x_n)\}$ is a Cauchy sequence. Since $\mathbb R$ is complete, $$\lim_{n\to\infty}f(x_n)=\lim_{x\to a^+}f(x)$$ exists.
Conversely, suppose $\lim_{x\to a^+}f(x)$ exists. Then define $\overline f:[a,b]\to\mathbb R$ by
$$\overline f(x) = \begin{cases} f(x),& x\in(a,b]\\ \lim_{x\to a^+}f(x),& x=a.\end{cases} $$
Since $\lim_{x\to a}\overline f(x) = \overline f(x)$, $\overline f$ is continuous. Since $[a,b]$ is compact, $\overline f$ is uniformly continuous. Therefore the restriction of $\overline f$ to $(a,b]$, i.e. $f$ is uniformly continuous.
