Composition is infinitely differentiable The funcitons below all map real numbers to real numbers.
Suppose that $f(x) = h(g(x)) \ \forall x \in \mathbb{R}$.
Suppose that $g(x) \neq 0 \ \forall x \in \mathbb{R}$ and that all derivatives of $g$ are also never $0$. and that $g \in C^{\infty}(\mathbb{R})$ and also that $ h \in C^{\infty}(\mathbb{R}-\{0\}) $. (The last part says that $h$ is smooth everywhere except at $0$).
I'm curious to know whether $(h \circ g) \in C^{\infty}(\mathbb{R})$
It makes sense that the composition should be smooth, since both $h$ and $g$ are smooth in the domain of interest, with the caveat that $h$ is not smooth on $0$, but $g(x)$ and its derivatives are guaranteed to never be $0$. But how does one proceed to a proof (or counterexample, if it is false).
 A: Look at a precise statement of the chain rule, such as Baby Rudin 5.5.  There we read (with variable names changed) "Suppose $g$ is continuous on $[a,b]$, $g'(x)$ exists at some point $x\in [a,b]$, $h$ is defined on an interval $I$ which contains the range of $g$, and $h$ is differentiable at the point $g(x)$.  If $f(t)=h(g(t))$ $(a\le t\le b)$ then $f$ is differentiable at $x$, and $f'(x)=h'(g(x))g'(x)$."
Apply this now to the situation in the problem.  By the intermediate value theorem $g$ is either $>0$ or $<0$ -- if it had values of both signs, then $0$ would have to be a value of $g(x)$. The function $h$ is defined on the half lines $(-\infty,0)$ and $(0,\infty)$, one of which contains the range of $g$. The function $f$ is therefore differentiable at any $x$ in the domain of $g$.  Because $f'$ is given by the indicated formula, $f'$ is the product of (i) a composition of a continuous function $h'$ with a continuous function $g$ and (ii) a continuous function $g'$, and we have that $f'$ is also continuous there.
For $f''$ we have $f''=(h'(g)g')'=[h'(g)]'g'+h'(g)g''=h''(g)g'^2+h'(g)g''$.  Existence and continuity thus follow from those of $g', g''$ on $\mathbb{R}$ and of $h', h''$ on the range of $g$.  We can argue by induction that $f^{(m)}$ is a sum of products of $h^{(i)}(g)$ and $g^{(i)}$ so that its existence and continuity follow from those of these products.
