Given the function, $$f(x)=\begin{cases}\exp\left(-\frac 1 x\right)&x>0\\ 0&x\leq 0,\end{cases}$$ it is a common exercise to show that $f\in C^\infty(\mathbb{R})$. An attempt to this problem is given in the answer to the question, Infinitely differentiable functions: how to prove that e1x2−1 has derivative of any order?. In looking at this attempt, I have some questions (I feel like I am very rusty with this material).
In moving to show that $f\in C^\infty(\mathbb{R})$, is it not sufficient just to show, using induction, that $f^{(k)}(x)=P_{2k}(x^{-1})f(x)$ for $x>0$, where $P_{2k}(x^{-1})$ is a polynomial of degree $2k$ for $k\in\mathbb N$ in $1/x$? Why did the author of the answer go on to show that $f^{(k)}(0)=0$ for all $k\in\mathbb N$? In fact, the author claimed that from this it followed that $f\in C^\infty(\mathbb{R})$ - is this correct?
How is one able to conclude that $f^{(k)}(0)=0$ for all $k\in\mathbb N$ given that $f:\mathbb R\to\mathbb R$ is not differentiable at the origin? Given that we note the latter of these points and then go on to show the former seems to be in contradiction to the initial observation that $f$ is not differentiable at $x=0$. I don't understand how this is?
Lastly, is it a mistake when the author of the answer writes, that "as $x→0^+$ this amounts to looking at $\lim_{x\to +\infty}P(x)\exp(-x)=0"$? Should it not be $\lim_{x\to +\infty}P_{2k}(x^{-1})\exp(-1/x)=0$ instead?
For $x > 0$ we can compute the derivative in the standard way to get $f^{(k)}(x)=P_{2k}(x^{-1})f(x)$. And of course for $x < 0$ we have $f^{(k)}(x)=0$. However, this does not tell us anything about the derivative in $0$, yet. The problem is that around $0$, $f$ is not the composition ($+$, $\cdot$, $\circ$) of differentiable functions and hence the direct formula is not applicable. We would either have to use the difference quotient and compute the limit or, as Pedro did, use this theorem of Spivak. Interating this argument indeed gives $f \in C^{\infty}(\mathbb{R})$.
You might have misunderstood something. $f$ is differentiable everywhere. It is just not obvious at the beginning that $f$ is differentiable in $0$.
No, Pedro just translates the limit $\lim_{x\to 0}P_{2k}(x^{-1})\exp(-1/x)$ (which we are interested in) to $\lim_{x\to +\infty}P_{2k}(x)\exp(-x)=0$ by substituting $x \mapsto \frac{1}{x}$.