TITLE: Is a continuous function with zero “Taylor approximation” smooth?
QUESTION [5 upvotes]: Let $f:[0,\infty) \to [0,\infty)$ be a continuous, non-decreasing function, satisfying  $f(0)=0$ and $f(x)=o(x^n)$ for any $n \ge 1$. Suppose also that $f(x)>0$ for every $x>0$.
I also know that $f$ is smooth on the open interval $(0,\infty)$.

Must $f$ be infinitely (right) differentiable at zero?

Comments:

The Taylor series of $f$ does not have to converge to $f$, e.g. in the famous example of
$$
f(x) =\begin{cases}e^{-1/x^2} \text{ for } x >0 \\
0 \text{    for } x = 0\end{cases}
$$
In general, the existence of a polynomial approximation by itself does not imply differentiabiliy; in fact it does not even imply continuity (at $x>0$), as the following examples show:

$f(x)=\chi_{\mathbb Q}(x)x^n$ or even $\chi_{\mathbb Q}(x)e^{-1/x^2}$ which also satisfies $f(x)=o(x^n)$ for any $n \ge 1$.

REPLY [2 votes]: Define the family of $C^\infty$ functions
$$
\varphi_n(x)=\left\{\begin{array}{cl}
0&\text{for }x\le0\\
\frac{e^{\frac{n}{1-x}}}{e^{\frac{n}{x}}+e^{\frac{n}{1-x}}}&\text{for }0\lt x\lt1\\
1&\text{for }x\ge1
\end{array}\right.
$$
then
$$
\varphi_n^\prime\!\left(\frac12\right)=2n
$$

With $f(x)=e^{-\frac1x}$, and $x_k=\frac1k$, define
$$
\begin{align}
g(x)
&=f(x_k)+(f(x_{k-1})-f(x_k))\,\varphi_{n_k}\!\!\left(\frac{x-x_k}{x_{k-1}-x_k}\right)&&\text{for }x_k\le x\le x_{k-1}\\
&=e^{-k}\left(1+(e-1)\varphi_{n_k}((k-1)(kx-1))\right)&&\text{for }\frac1k\le x\le\frac1{k-1}\\
\end{align}
$$

$g$ is infinitely differentiable, monotonically increasing, and $g(x)\le e^{1-\frac1x}$.
For integer $k\ge1$,
$$
g'\!\left(\frac1k\right)=0
$$
and for integer $k\ge2$,
$$
g'\!\left(\frac12\left(\frac1{k-1}+\frac1k\right)\right)=2n_kk(k-1)(e-1)e^{-k}
$$
If we set $n_k=3^k$, then $g'(x)$ varies between $0$ and $2k(k-1)(e-1)\left(\frac3e\right)^k$ on $\left[\frac1k,\frac1{k-1}\right]$. Thus, $g''(0)$ does not exist.