I'm trying to solve the following exercise from Milnor's Topology from the Differentiable Viewpoint
Let $M$ be a compact smooth manifold, show that every continuous map $M \to \mathbb{S}^n$ can be uniformly approximated by a smooth map. If two smooth maps are continuously homotopic, show that they are smoothly homotopic.
I solved the first part approximating every coordinate thanks to Stone-Weierstrass' Theorem and normalizing. I think it should work. Then I tried to use the first part to solve the second one (about smooth homotopy), but I'm not able to understand how I should use approximation to change a continuous map to a smooth one. How could I solve this problem?
I think I found the solution in the case $\partial M = \emptyset$. If someone could check it I'll be grateful.
Let $f,g : M \times \to \mathbb{S}^n$ be two smooth maps and let $H : M \times [0,1] \to \mathbb{S}^n$ be a continuous homotopy between $f,g$. Since $\partial M = \emptyset$, we can say that $ M \times [0,1]$ is a compact smooth manifold. Hence exists $\widetilde{H} : M \times [0,1] \to \mathbb{S}^n$ such that $\lVert H-\widetilde{H}\rVert < 2$. Now using $$\frac{t\widetilde{H}(x,0) - (1-t)f(x)}{\lVert t\widetilde{H}(x,0) - (1-t)f(x) \rVert}$$ we conclude that $f$ is smoothly homotopic to $\widetilde{H}(\cdot,0)$ and in the same way we can show that $g$ is smoothly homotopic to $\widetilde{H}(\cdot,1)$. Since being smoothly homotopic is an equivalence relation, $f$ and $g$ are smoothly homotopic.