The distinction between infinitely differentiable function and real analytic function

Solution 1:

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.)

Solution 2:

$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$.

Solution 3:

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 http://en.wikipedia.org/wiki/Non-analytic_smooth_function for a discussion.