Extension of a smooth function on a set of a manifold to an open nbd of the set.

Exercise 1.74 of the book Manifolds and differential geometry of Jeffrey M. Lee says:

Show that if a function is smooth on an arbitrary set $S\subseteq M$ as defined earlier, then it has a smooth extension to an open set that contains $S$.

Here Lee refers to Definition 1.58:

Let $S$ be an arbitrary subset of a smooth manifold $M$. Let $f:S\to N$ be a continuous map where $N$ is a smooth manifold. The map $f$ is said to be $C^r$ if for every $s\in S$ there is an open set $O\subseteq M$ containing $s$ and a map $\tilde f$ that is $C^r$ on $O$ and such that $\tilde f|S\cap O=f$.

First I want to comment two things about definition 1.58. First I think it should be $\tilde f|S\cap O=f|S\cap O$ instead. Second: why do we require $f$ continuous? Isn't that implied?

Definition 1.58 refers to general maps $f:S\to N$ but I can only prove it for $N=R^n$ as follows:

Assume $f:S\to R^n$ is smooth and for each $s\in S$ let $U_s$ be a nbd of $s$ and $f_s:U_s\to R^n$ be a smooth map such that $f_s|U_s\cap S=f|U_s\cap S$. Let $\{\phi_s\}_{s\in S}$ be a partition of unity dominated by $\{U_s\}_{s\in S}$. For each $x\in X$ we define $A_x=\{s\in S: x\in \text{supp }\phi_s\}$ We define $g:\bigcup_{s\in S}U_s\to R^n$ as $g(x)=\sum_{s\in A_x}\phi_s(x)f_s(x)$. Then $g$ is the desired smooth extension of $f$.

I tried to modify this argument to make it work for a general manifold $N$ (note there is no addition or scalar multiplication in $N$ so this $g$ requires some modification) but I couldn't. So my question is: Is exercise 1.74 true when $N$ is a general manifold or is there a counterexample?

• Well, smooth manifolds also admit partitions of unity. – Pedro Tamaroff Aug 15 '16 at 20:56
• @PedroTamaroff Yes but my definition of $g$ doesn't make sense in a general manifold $N$. – Zero Aug 15 '16 at 20:57
• It does, if you define it appropriately. Understanding how to do this is perhaps the essence of your problem. – Pedro Tamaroff Aug 15 '16 at 21:29
• Could you please write it down or at least give a big hint? I'm done with this problem. – Zero Aug 15 '16 at 21:32
• For what it's worth, "smooth function" often refers only to maps $M\to\mathbb{R}$, with "smooth map" being used for maps from $M$ to a general manifold. The result is true for general $N$, but I don't at the moment see a way to prove it without some heavy machinery (the Whitney embedding theorem and the existence of tubular neighborhoods). – Eric Wofsey Aug 15 '16 at 21:47

As I commented, it is common to use "smooth function" to only mean smooth maps to $\mathbb{R}$, rather than to general manifolds, and it seems plausible that this is what Lee meant. Nevertheless, the result is true for general $N$. Here's a proof that uses a bit of heavy machinery (I don't know if there's a proof that is as elementary as your proof for $N=\mathbb{R}^n$).
By the Whitney embedding theorem, we can consider $N$ as a smooth submanifold of $\mathbb{R}^n$ for some $n$. By your argument for $\mathbb{R}^n$, a smooth map $\bar{f}:S\to N$ can be extended to a smooth map $f:U\to \mathbb{R}^n$ for $U$ some open neighborhood of $S$. Now let $V\subset\mathbb{R}^n$ be a tubular neighborhood of $N$. In particular, $V$ retracts smoothly onto $N$, via the map $r:V\to N$ that is the projection onto $N$ when you identify $V$ with the normal bundle of $N$. Now consider the composition $g=r\circ\bar{f}$, defined on $U\cap \bar{f}^{-1}(V)$. This $g$ is a smooth map from an open neighborhood of $S$ to $N$ and agrees with $f$ on $S$, which is exactly what we want.