# Is it possible to extend an arbitrary smooth function on a closed subset of $R^n$ to a smooth function on $R^n$?

Assume that $K$ is a closed (or compact if necessary) subset in $\mathbb{R^n}$ and $f:K \rightarrow \mathbb{R}$ is a smoth function in the following sense:

for each $x \in K$ there exists a neighbourhood $V_x$ in $\mathbb{R}^n$ of $x$ and a function $F_x: V_x \rightarrow \mathbb{R}$ of class $C^\infty(V_x)$ such that $F_x| (V_x \cap K)=f|(V_x \cap K)$.

Is it posible to extend $f$ to a function of class $C^\infty$ on $\mathbb{R}^n$ ?

-
I suspect it is enough to have a partition of unity on $K$, and for this it is enough for $K$ to be a smooth submanifold. –  Zhen Lin Jul 22 '12 at 8:47
This is a nice and interesting question: +1 –  Georges Elencwajg Jul 22 '12 at 9:52
Similar to the following question: math.stackexchange.com/questions/165260/… –  Christian Blatter Jul 22 '12 at 10:28

Yes, you may extend $f$ to a $C^\infty$ function on $\mathbb R^n$.
The local conditions you give on the function $f:K\to \mathbb R$ say exactly that $f$ is a section on $K$ of the sheaf $C^\infty_{\mathbb R^n}$, i.e. $f\in \Gamma (K, C^\infty_{\mathbb R^n})$.
This sheaf is fine, a translation of the existence of partitions of unity on $\mathbb R^n$, hence soft (see here and here ) and thus by definition of soft, this implies that the restriction map $$\Gamma (\mathbb R^n, C^\infty_{\mathbb R^n})=C^\infty (\mathbb R^n) \to \Gamma (K, C^\infty_{\mathbb R^n}):F\mapsto F\mid K$$ is surjective, answering your question in the affirmative.
1) The closed set $K$ does not have to be compact.