TITLE: Show f is uniformly continuous on $(a,b)$ if it is continuous and $\lim\limits_{x\to a^+}f(x)$ and $\lim\limits_{x\to b^-}f(x)$ exist
QUESTION [11 upvotes]: Let $f:(a,b)\to\mathbb{R}$ be continuous at all $x\in(a,b)$. If $\lim\limits_{x\to b^-}f(x)$ and $\lim\limits_{x\to a^+}f(x)$ exist in $\mathbb R$, how can we prove that $f$ is uniformly continuous on $(a,b)$?
This is my attempt, but I'm just not certain it is correct: 
Let $\epsilon>0$. It is clear that $[a+\epsilon,b-\epsilon]\subseteq(a,b)$. It is known that $f(x)$ is continuous on $(a,b)$, so it is uniformly continuous on the bounded interval $[a+\epsilon,b-\epsilon]$. But, $[a+\epsilon,b-\epsilon] \iff (a,b)$. Thus $f$ is uniformly continuous on $(a,b)$. 
Is my proof correct? Is there a better way?

REPLY [8 votes]: Your proof is incorrect, because $f$ being uniformly continuous on all closed subintervals of $(a,b)$ doesn't imply it is so on $(a,b)$ itself.
Here is one way to do it. Extend the function $f$ to the function $g:[a,b]\to\mathbb R$ with $g(a)=\lim_{x\to a^+} f(x)$ and $g(b)=\lim_{x\to b^-}f(x)$. Then $g$ is continuous on $[a,b]$. It follows that $g$ is uniformly continuous on $[a,b]$ so that $f$ is uniformly continuous on $(a,b)$.