Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


Open set in $\mathbb{R}$ is a union of at most countable collection of disjoint segments

This is the theorem i need to prove;

"Let $E(\subset \mathbb{R})$ be closed subset and $f:E\rightarrow \mathbb{R}$ be a contiuous function. Then there exists a continuous function $g:\mathbb{R} \rightarrow \mathbb{R}$ such that $g(x)=f(x), \forall x\in E$."

I have tried hours to prove this, but couldn't. I found some solutions, but ridiculously all are wrong. Every solution states that "If $x\in E$ and $x$ is not an interior point of $E$, then $x$ is an endpoint of a segment of at most countable collection of disjoint segments.". However, this is indeed false! (Check Arthur's argument in the link above)

Wrong solution Q4.5;

Just like the argument in this solution, i can see that $g$ is continuous on $E^c$ and $Int(E)$. But how do i show that $g$ is continuous on $E$?

share|cite|improve this question
I don't know how to formulate this rigorously, but it seems, all you need to do is take the points $f(\partial E)$ and show that they can be connected by a continuous function in $\mathbb{R} \setminus Int(E)$, isnt't it? – Karolis Juodelė Oct 23 '12 at 17:07
up vote 6 down vote accepted

A constructive and explicit proof proceeds as follows. Since $E$ is closed, $U=\mathbb{R}\setminus E$ is a countable union of disjoint open intervals, say, $U=\bigcup (a_n,b_n)$. Necessarily, we must have that $a_n,b_n\in E$. Define $f(x)$ as follows. $$ f(x) = \begin{cases} g(x) &\text{if }x\in E \\ \frac{x-a_n}{b_n-a_n}g(b_n)+\frac{b_n-x}{b_n-a_n}g(a_n) & \text{if }x\in[a_n,b_n] \end{cases} $$

Notice first that $f(x)$ is well-defined and also, for all $x\in(a_n,b_n)$, either $g(a_n)\le f(x)\le g(b_n)$ or $g(b_n)\le f(x)\le g(a_n)$ depending on whether $g(a_n)\le g(b_n)$ or otherwise. Clearly, $f$ is continuous on $U$. Now suppose that $x\in E$ and $\epsilon>0$. Then there are a few cases.

Case 1: Suppose that for every $\eta>0$, $(x-\eta,x)\cap E\not=\emptyset$ and $(x,x+\eta))\cap E\not=\emptyset$. Then since $f\vert_E=g$, there is some $\delta>0$ such that if $y\in E$ and $\vert x-y\vert<\delta$ then $\vert f(x)-f(y)\vert<\epsilon$. Because of the condition we have for Case 1, we may choose some $x_1,x_2\in E$ with $x-\delta<x_1<x<x_2<x+\delta$. Choose $\delta'=\min\{x-x_1,x_2-x\}$. If $\vert y-x\vert<\delta'$, then if $y\in E$, we're done. If $y\in U$, then $y\in(a_m,b_m)$ for some $m\in\mathbb{N}$. Furthermore, $a_m,b_m\in E$ and are within $\delta$ of $x$. Also, $f(y)$ is lies between $g(a_m)$ and $g(b_m)$. Thus $f(y)$ is within $\epsilon$ of $f(x)$ since $f(a_m)=g(a_m)$ and $f(b_m)=g(b_m)$ are within $\epsilon$ of $f(x)$.

Case 2: There is some $\eta>0$ for which $(x-\eta,x)\cap E=\emptyset$ or $(x,x+\eta)\cap E=\emptyset$. In this case, $x$ is an endpoint of one of the intervals of $U$. Thus $f$ is linear on either $[x,x+\eta)$ or $(x-\eta,x]$ (maybe both). Certainly, we can get a $\delta>0$ corresponding to $\epsilon$ on this side of $x$. For the other side of $x$, use the argument from Case 1 to get some $\delta'$. Choosing $\delta''=\min\{\delta,\delta'\}$ proves the result.

share|cite|improve this answer
I'm afraid your proof is wrong. In case 2, $x$ need not be an endpoint. You can check this in the link in my post. – Katlus Oct 23 '12 at 18:07
@Katlus, my apologies, I switched $\not=$ and $=$. It's fixed now. – J. Loreaux Oct 23 '12 at 18:37
@Katlus: The argument is incomplete, though the hole is easily patched. As it stands, it works only if $E$ is unbounded in both directions. If $E$ is bounded above, let $f(x)=f(\sup E)$ for $x\ge\sup E$, and similarly if $E$ is bounded below. – Brian M. Scott Oct 23 '12 at 18:47
@Brian, that's a valid point. Thanks for mentioning it. – J. Loreaux Oct 23 '12 at 18:51
You’re welcome. – Brian M. Scott Oct 23 '12 at 18:51

This is a special case of the Tietze extension theorem. This is a standard result whose proof can be found in any decent topology text. A rather different proof can be found here.

share|cite|improve this answer
3000 answers, Prof.! – Pedro Tamaroff Oct 23 '12 at 17:41
@Peter: So it is; I hadn’t any idea that I’d written so many. – Brian M. Scott Oct 23 '12 at 17:54
@Brian Yes, Tietze extension theorem is a generalization of this theorem. I searched for it, but it seems like it's almost impossible to prove that theorem on my level right now, so I wanted to prove it at least for $\mathbb{R}$ which is a special case just for now. – Katlus Oct 23 '12 at 18:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.