Is a smooth function still smooth in a sub-manifold containing its image? Assume $f$ is a smooth map between manifolds $M$ and $N$, and $S$ is a sub-manifold of $N$ with $f(M) \subset S$. Is the map $f: M \to S$ always smooth?
Does the answer depend on whether the submanifold is embedded or immersed? 
 A: For immersed submanifolds, the answer is (potentially) no.  For instance, there is an immersion $i:\mathbb{R}\to\mathbb{R}^2$ whose image is a figure $8$, where you start going up and right from the middle, go around the top loop counterclockwise, then go around the bottom loop clockwise.  Now consider a map $f:\mathbb{R}\to\mathbb{R}^2$ which traces out a path in the figure $8$ starting on the bottom left and going diagonally to the top right.  The lift of $f$ through $i$ gives a map $\mathbb{R}\to\mathbb{R}$ which is not even continuous (specifically, it is discontinuous at the point where $f$ passes through the center of the figure $8$).
For embedded submanifolds, however, the answer is yes.  Let $m=\dim S$, $n=\dim N$, and $i:S\to N$ be the embedding.  By the constant rank theorem applied to $i$, for each $y\in S$ there is a coordinate chart $U\subseteq S$ around $y$ and a coordinate chart $V\subseteq N$ of $i(y)$ such that $i(U)\subseteq V$, and when we identify $U$ with $\mathbb{R}^m$ and $V$ with $\mathbb{R}^n$, the map $i$ (restricted to $U$) is just the inclusion $i(t_1,\dots,t_m)=(t_1,\dots,t_m,0,\dots,0)$.  Furthermore, since $i$ is an embedding, we may assume that actually $i^{-1}(V)=U$.   For any $x\in M$, applying this with $y=f(x)$, you get that in local coordinates near $x$, $f$ is just a smooth map to $\mathbb{R}^n$ whose image lies in $\mathbb{R}^m\times\{0\}^{n-m}$.  Such a map is clearly also smooth when considered as a map to $\mathbb{R}^m$, which means exactly that $f$ is smooth as a map $M\to S$.
More generally, the argument of the previous paragraph shows that even when $S$ is only immersed in $N$, $f:M\to S$ is smooth at any point of $M$ at which it is continuous.
