A smooth function's domain of being non-analytic

Yes, that can happen. The canonical example (as far as I know) is the Fabius function which is smooth and nowhere analytic.


I never really liked this answer because it's hard — if not outright impossible — to find references online on how to prove the nonanalyticity of $Fb$. So here is a short exposition on a different example adapted from the discussion archived in this text file mirrored on archive.org.

Introduction

Students often see $$ f(x) = \begin{cases} \exp(-\tfrac{1}{x}) & \text{for } x > 0 \\\\ 0 & \text{for } x \leq 0 \end{cases}$$ as an example of a smooth function that's not analytic at $0$, but this as well as the other usual examples makes it very easy to intuit that smooth functions are “mostly analytic”, i.e. everywhere analytic except possibly at some isolated points. And given that this is the only example that one typically sees this is in fact a reasonable thing to believe. But nonetheless there are plenty of examples out there — for example the following:

Example

Define $F: \mathbb{R} \to \mathbb{C}$ by $$ F(x) := \sum_{n=0}^\infty \frac{\exp(i2^nx)}{n!}. $$

Theorem: $F$ and $\Re F$, the real part of $F$, are smooth nowhere analytic functions.

Proof: Computing the derivatives of $F$ we get $$ F^{(k)}(x) = \sum_{n=0}^\infty \frac{\exp(i2^nx)(i2^n)^k}{n!}, $$ which is uniformly convergent everywhere, so it's continuous and there are no issues with moving the differentiation in under the summation. In other words $F$ and $\Re F$ are smooth. Furthermore we have that $$ F^{(k)}(0) = \sum_{n=0}^\infty \frac{(i2^n)^k}{n!} = i^k \exp(2^k). $$ The Cauchy-Hadamard formula for the radius of convergence, $r$, for the Taylor series for $F$ gives at $x=0$ with the usual conventions about infinities that $$ \frac{1}{r} = \limsup_{k \to \infty} \left\lvert \frac{F^{(k)}(0)}{k!}\right\rvert^{1/k} = \limsup_{k \to \infty} \left(\frac{\exp(2^k)}{k!} \right)^{1/k} = \infty, $$ and so $r = 0$. The same will be true for $\Re f$ as the even-indexed parts of $\Re F$ have the same magnitude as those of $F$. $F$ is $2\pi$-periodic, so the same is true for every $x$ which is an integer multiple of $2\pi$. Moreover we see that if we throw away the first $p$ terms, we get a function with period $\omega = \frac{2\pi}{2^p}$ and with points of non-analyticity at all integer multiples of $\omega$. Hence $F$ and $\Re F$ must also be nonanalytic at these points and we conclude that the set of points where the two functions are nonanalytic is dense in $\mathbb{R}$.

Finally observe that if a function is analytic in a point it must be analytic on a neighbourhood of that point, thus there are no possible open sets where $F$ and $\Re F$ can be analytic, i.e. they are smooth nowhere analytic functions. $\;\square$

Good Questions to Ponder

Suppose $\Omega \subseteq \mathbb{R}^n$ is open.

Is there an $f \in C^\infty(\mathbb{R}^n)$ such that $\Omega$ is its locus of analyticity?

Are the functions that are analytic at some point of the first category in $C^\infty(\Omega)$?