The distinction between infinitely differentiable function and real analytic function

I have known that all the real analytic functions are infinitely differentiable.

On the other hand, I know that there exists a function that is infinitely differentiable but not real analytic. For example,
$$f(x) =
\exp(-1/x), & \mbox{if }x>0 \\
0, & \mbox{if }x\le0
is such a function.

However, the function above is such a strange function. I cannot see the distinction between infinitely differentiable function and real analytic function clearly or intuitively.

Can anyone explain more clearly about the distinction between the two classes?

Solutions Collecting From Web of "The distinction between infinitely differentiable function and real analytic function"

A real analytic function, by definition, admits a power series representation in the neighbourhood of each point in it’s domain of definition, that is, it can be written as a power series. This is a very severe constraint, analytic functions, as an example, are constant everywhere (on the affected component of the domain) if they are constant on an open set. The latter is not true for functions which are ‘merely’ infinitely often differentiable (smooth), you can have smooth functions with compact support (which are very important tools in analysis) — the example you wrote down is often used to construct such functions.

Figuring out whether a given smooth function is real analytic is usually much more difficult to detect than, e.g., in the case of complex analytic functions, which are just those functions which are complex differentiable. One of the few tools available to show a function is real analytic is the theorem which tells you when the Taylor series of $f$ actually converges to $f$.

(Clearly each complex analytic function gives rise to real analytic ones, so many examples are known. Similarly, harmonic function, i.e. solutions to $\Delta u = 0$ are real analytic, even in higher dimensions.)

The Taylor series of $f$ at the origin converges to the zero function though $f$ is not the zero function. That is the reason why $f$ is not real analytic.

See for a discussion.

$f(x)$ is real analytic everywhere but at $x=0$. At $x=0$, all the derivatives of $f(x)$ are $0$, but the function is not identically $0$ in any neighborhood of $x=0$; $f(x)>0$ for any $x>0$.