Constructing a sequence in manifolds Let $S$ be a submanifold of $M$ such that every smooth function on $S$ can be extended to a smooth function to a neighborhood $W$ of $S$ in $M$. I want to show that $S$ is embedded submanifold.
My attempt: suppose $S$ is not embedded. Then there is a point $p$ that is not contained in any slice chart. Since a submanifold is locally embedded, let $U$ be a neighborhood of $p$ that is embedded. Consider a smooth function on $S$ that is supported in $U$ and equal to $1$ at $p$. If there is a sequence $x_n$ in $S \setminus U$ that converges to $p$, then by assumption $f$ can be extended to a smooth function $F$ on $W$. But then $0=F(x_n)\rightarrow F(p)=1$, which is contradiction. My difficulty is to justify such a sequence exists. Please provide me your help.
 A: Your proof is correct, but perhaps needs some refinement. Notation is taken from my above comment.
Since $i$ is an immersion, each point $x \in S$ has an open neighborhood $V_x$ in $S$ embedded by $i$ into $M$. This means that there exist an open neigborhood $U_x$ of $i(x)$ in M, an open $W \subset \mathbb{R}^n$
and a diffeomorphism $h_x : U_x \to W$such that $h_x(U_x \cap i(V_x)) \subset \mathbb{R}^k \times \lbrace 0 \rbrace$. In order that $S'$ is an embedded submanifold (this is usually understood if one uses the wording "submanifold"), we need that for each $x \in S$ there exist an open neighborhood $W_x$ of $i(x)$ in $M$, an open $W' \subset \mathbb{R}^n$
and a diffeomorphism $h'_x : W_x \to W'$ such $h'_x(W_x \cap S') \subset \mathbb{R}^k \times \lbrace 0 \rbrace$.
Suppose $S'$ is not an embedded submanifold. Then for some $x$ we cannot find such a $(W_x,W',h'_x)$. Take $(V_x,U_x,W,h_x)$ as above. Let $C = \overline{S' \backslash i(V_x)}^M$.
Assume $i(x) \notin C$. Then $W_x = U_x \backslash C$ would be an open neighborhood of $i(x)$ in $M$ such that $W_x \cap S' = W_x \cap i(V_x)$ (since $W_x \cap S' \subset S' \backslash C \subset S'\backslash (S' \backslash i(V_x)) = i(V_x)$). But then $h_x$ restricts to a diffeomorphism $h'_x : W_x \to W' = h_x(W_x)$ such that $h'_x(W_x \cap S') = h_x(W_x \cap i(V_x)) \subset h_x(U_x \cap i(V_x))  \subset \mathbb{R}^k \times \lbrace 0 \rbrace$ which contradicts the choice of $x$.
Hence $i(x) \in C$. This means that there exists a sequence $(y_n)$ in $S' \backslash i(V_x) = i(S \backslash V_x)$ which converges to $i(x)$. Write $y_n = i(x_n)$ with $x_n \in S \backslash V_n$. Take a smooth $f : S \to \mathbb{R}$ supported in $V_x$ such that $f(x) = 1$. Assume there exist an open neighborhood $U$ of $S'$ in $M$ and a smooth $F : U \to \mathbb{R}$ such that $F \circ i = f$. Then $F(y_n) = F(i(x_n)) = f(x_n) = 0$ which is impossible because we must have $F(y_n) \to F(i(x)) = f(x) = 1$.
Note that to obtain a contradiction it suffices to assume that $F$ is continuous.
Another approach is this: Since $i$ is injective, it has an inverse defined on $S' = i(S)$ which we denote by $j : S' \to S$. In general it is not continuous. Then the following are equivalent:
(1) $i$ is an embedding.
(2) $j$ is continuous.
(3) For each smooth $f : S \to \mathbb{R}$, the function $F = f \circ j : S' \to \mathbb{R}$ is continuous.
Note that $F = f \circ j$ is the unique function such that $F \circ i  = f$. This completely avoids to consider open neighborhoods of $S'$ in $M$. Their only purpose is that they are (embedded) submanifolds of $M$ which may be used as domains of smooth maps.
