Continuous extension of a real function defined on an open interval

Let $I\subset\mathbb{R}$ be a compact interval and let $J$ denote its interior.
Consider $f:J\to\mathbb{R}$ being continuous.

1. Under which conditions does the following statement hold?
$$\text{There exists a continuous extension g:I\to\mathbb{R} of f.}\tag{A}$$
2. Is boundedness of $f$ sufficient for (A)?
-
Boundedness is insufficient, as $g(x) = \sin(1/x)$ on $(0,1)$ shows. – Arturo Magidin Jan 12 '12 at 18:11
@Arturo Thank you. – precarious Jan 12 '12 at 18:30

Call a continuous function $f:X\to \mathbb{R}$ (where $X$ is some metric spaces) Cauchy continuous if $f$ takes Cauchy sequences in $X$ to Cauchy sequences in $\mathbb{R}$. It is then a classic theorem that a continuous function $f:X\to \mathbb{R}$ admits an extension $\widetilde{f}:\overline{X}\to \mathbb{R}$ (where here $\overline{X}$ denotes the completion of $X$) if and only $f$ is Cauchy continuous.

To see why necessity is obvious note that if we have some Cauchy sequence $(x_n)$ in $X$ then it's convergent in $\overline{X}$ and since $\widetilde{f}:X\to Y$ is continuous we know that $(x_n)$ is carried to some convergent sequence in $\mathbb{R}$, and so in particular, carried to a Cauchy sequence.

The converse pretty much follows (very roughly) by defining $\widetilde{f}$ on $\overline{X}$ by taking some $x\in\overline{X}$, some sequence $(x_n)$ in $X$ converging to $x$, and define $\widetilde{f}(x)=\lim f(x_n)$. This passes the first BS test in the sense that everything ostensibly makes sense. Namely, since $(x_n)$ converges in $\widetilde{X}$ it's Cauchy and so $(f(x_n))$ is Cauchy and so converges in $\mathbb{R}$. One needs to check that this is well-defined (i.e. independent of choice of sequence) and continuous.

The intuition behind why the above is true is fairly simple (I hope I'm not insulting you by spelling it out) as well. Namely, the only real obstruction to extending to a function on $\overline{X}$ is that $\lim f(x_n)$ doesn't converge for some convergent sequence $(x_n)$ in $X$, since this is the only sensible way to extend $f$. But, think about it, $\lim f(x_n)$ will converge (since $\mathbb{R}$ is complete) if and only if $(f(x_n))$ is Cauchy. So, the only problem in extending a function on $X$ to a function on $\overline{X}$ is the existence of Cauchy sequences in $\overline{X}$ whose image under $f$ is not Cauchy. But, practically by definition of $\overline{X}$ we can reduce this to worrying about Cauchy sequences in $X$ whose image under $f$ isn't Cauchy--tada!

So, in your example, $I$ is the completion of $J$ so that $f$ admits an extension from $I$ to $J$ if and only if $f$ is Cauchy continuous.

No, the classic example being that $x\mapsto \sin\left(\frac{1}{x}\right)$ is continuous on $(0,1)$ but has no extension to $[0,1]$--this

-
Great, thank you. You could never insult me by giving details. :-) – precarious Jan 12 '12 at 18:46
For reference, here is a corresponding Wikipedia article. – precarious Jan 12 '12 at 18:47

Hint for 1: think about limits.

Hint for 2: try $f(x) = \sin(h(x))$ for suitable functions $h$.

-
Thank you. Your second hint is clear due to Arturos tip: $I:=[0,1]$, $h(x):= 1/x$. Your first hint is telling me to look at existence of the one-sided limits of $f$ at the endpoints of $I$. Do you know of more convenient (sufficient) criteria? – precarious Jan 12 '12 at 18:28
A sufficient criterion would be that $f$ is differentiable with $\int_J |f'(x)| \ dx < \infty$. – Robert Israel Jan 12 '12 at 18:56
Thank you. This might be helpful for me, too. Can you explain it or do you have a reference? – precarious Jan 12 '12 at 19:52
$$\int_{1/2}^1 f'(x)\ dx = \lim_{b \to 1-} f(b) - f(1/2)$$ – Robert Israel Jan 13 '12 at 0:24
Thank you for your enlightening explanation. – precarious Jan 13 '12 at 11:43

Call $I = [a, b]$ with $-\infty < a < b < \infty$. Such an extension exists if and only if both $\lim_{x\to a^+} f(x)$ and $\lim_{x\to b^-} f(x)$ exist, and in fact these values become the values of the extension. (The proof is left as a simple exercise.) With this in mind, boundedness is not sufficient due to previously mentioned functions, such as $\sin\left(\frac{1}{x}\right)$ on $(0, 1)$.

-