# A smooth but not analytic function

In the current assignment for real analysis, we consider the following function
$f(x) = \begin{cases} e^{-1/x^2} & x \neq 0\ 0 & x = 0. \end{cases}$
We are asked to show that $$f^{(n)}(0) = 0$$ for all $$n$$, and that the Taylor series for $$f$$ at $$0$$ converges to $$f(x)$$ only for $$x \neq 0$$.

To compute the derivatives $$f^{(n)}(0)$$, it is easiest to use induction on $$n$$. For $$n = 1$$,
$f'(0) = \lim_{x \to 0} \frac{f(x) – f(0)}{x – 0} = \lim_{x \to 0} \frac 1 x e^{-1 / x^2}.$
To compute the limit, we first use the change of variables $$y = 1 / x$$ so that as $$y \to \pm \infty$$ we have $$x \to 0$$. Then
$\lim_{x \to 0} \frac 1 x e^{-1 / x^2} = \lim_{y \to \pm \infty} \frac{y}{e^{y^2}}.$
Using L’Hopital’s rule, it is easy to verify that the latter limit is zero. In fact, a similar argument shows that for any $$k$$
$\lim_{x \to 0} \frac{1}{x^k} e^{-1 / x^2} = 0.$
We will need this fact later on. At any rate, we’ve shown that $$f'(0) = 0$$.

For the inductive step, assume that $$f^{(n)}(0) = 0$$. Then
$f^{(n + 1)}(0) = \lim_{x \to 0} \frac{f^{(n)}(x) – f^{(n)}(0)}{x – 0} = \lim_{x \to 0} \frac{1}{x} f^{(n)}(x).$
After computing the first few derivatives, $$f'(x),\ f”(x), \ldots$$ for $$x \neq 0$$, you should be convinced that $$f'(x)$$ is of the form
$f^{(n)}(x) = \left (\frac{a_k}{x^k} + \frac{a_{k-1}}{x^{k-1}} + \cdots + a_0 \right ) e^{-1 / x^2}.$
Using the same trick as before, we can compute
$\lim_{x \to 0} \frac{a_i}{x^{i+1}} e^{-1 / x^2} = 0,$
hence
$f^{(n + 1)}(0) = \lim_{x \to 0} \frac{1}{x} f^{(n)}(x) = 0.$

Since all of the derivatives of $$f$$ are $$0$$ at $$x = 0$$, the Taylor series there is
$\sum_{k = 0}^\infty f^{(k)}(0) x^k = 0.$
However, $$f(x) \neq 0$$ for $$x \neq 0$$, so the Taylor series only agrees with $$f$$ at $$x = 0$$.