# extending a continuous function from a closed subset

Is it true that a continuous function defined on a closed subset of $\mathbb{R^n}$ extends to a continuous function on the whole space?

## 2 Answers

If we don't have any restriction on the range of the continuous function, then the answer is no. Namely, let $A=\{0,1\}\subseteq\mathbb{R}$ and consider the continuous function $\operatorname{id}_A$. You can't extend $\operatorname{id}_A$ to a continuous function on the whole $\mathbb{R}$ because $\mathbb{R}$ is connected while $A$ is not.

However, if the range of the continuous function is for example $\mathbb{R}$, then the extension can always be done, see Tietze extension theorem.

• I don't follow your argument. $f:\mathbb{R} \to \mathbb{R}$ with $f(x)=0$ for $x \lt 0$, $f(x)=x$ for $x \in [0,1]$ and $f(x)=1$ for $x \gt 0$ seems to be continuous and agreeing with your function on $A$? Edit: Never mind me, you're discussing $A \to A$ - I implicitly assumed the function was into the reals. – Desiato Mar 19 '12 at 19:29
• @Desiato: Indeed, I assumed that the extension has the same range than the original function. However, if we are allowed to enlarge also the range of the original function, then I'm not sure what the answer is. – LostInMath Mar 19 '12 at 20:08

Yes, if you mean a real-valued function. This is a special case of the Tietze extension theorem.

• This is probably a bit of an overkill. You can do it quite explicitly, see my comment here. – t.b. Mar 19 '12 at 19:14