[Math] Extending functions from $(a,b)$ to $[a,b]$.

continuityreal-analysisuniform-continuity

Let's say $f$ is continuous on $(a,b)$. Is it true that it can always be extended to a continuous function on $[a,b]$? What if it's a uniformly continuous function; can it be extended to a uniformly continuous function on $[a,b]$?

I'm thinking that, if it's continuous on $(a,b)$, then $\lim_{x\to a^+} f(x)$ and $\lim_{x\to b^-} f(x)$ exist, and then one can just define $f(a)$ to be $\lim_{x\to a^+} f(x)$, and similarly for $f(b)$. I'm not too sure about that, though.

And if that's the case, then the other one (uniform continuity) follows easily, since $[a,b]$ is compact.

Best Answer

The function $$ f(x)=\frac1{x(x-1)} $$ is continuous on $(0,1)$ but does not extend to a continuous function on $[0,1]$.