Does $\lim_{x\to0}\frac{xf'(x)}{f(x)}$ exist when $f(0)=0$, $f'(0)=0$?

Suppose $f(0)=0$, $f$ is differentiable and $\frac{f'(x)}{\frac{f(x)}{x}}=\frac{xf'(x)}{f(x)}$ is well defined in some interval $(-\epsilon,\epsilon)$ without $0$. By definition, $$\lim_{x\to0}\frac{f(x)}{x}=f'(0)=\lim_{x\to0}f'(x)$$ When $f'(0)\neq0$, $$\lim_{x\to0}\frac{xf'(x)}{f(x)}=\frac{f'(0)}{f'(0)}=1$$ so I guessed that $\lim_{x\to0}\frac{xf'(x)}{f(x)}=1$ when $f'(0)=0$ too, but it was not since $$\lim_{x\to0}\frac{xf'(x)}{f(x)}=\lim_{x\to0}\frac{nx^n}{x^n}=n$$ where $f(x)=x^n$. So now my question is that does $\lim_{x\to0}\frac{xf'(x)}{f(x)}$ always exist when $f'(0)=0$. I tried to L'Hospital and squeeze but I can't prove it because the limit does not converges to unique value. Can we prove this or any counterexamples?


Unfortunately there is no way to save this. The well-known $C^\infty$-function $$f(x)=\begin{cases} e^{-1/x^2} & x\not=0 \\ 0 &x= 0 \end{cases}$$

satifies $f^{(n)}(0)=0$ for all $n$, but $$\lim_{x\rightarrow 0}\frac{xf'(x)}{f(x)} = \lim_{x\rightarrow 0} x(\ln|f(x)|)' = \lim_{x\rightarrow 0} \frac{2}{x^2}=\infty$$


One condition that works is $f$ being analytic at $x=0$ with $f$ not being constantly zero in any neighborhood of $x=0$. Let $n$ be the smallest $k$ such that $f^{(k)}(0)\ne 0$. Then $$f(x)=\frac{f^{(n)}(0)}{n!}x^n+O\left(x^{n+1}\right)\quad(x\to 0)\\ xf'(x)=\frac{f^{(n)}(0)}{(n-1)!}x^n+O\left(x^{n+1}\right)\quad(x\to 0)$$ and $$\lim_{x\to 0}\frac{xf'(x)}{f(x)}=n $$ As @Just a user's example shows, it's not sufficient to assume that $f$ is infinitely smooth. What you suggested in the comments (existence of $f^{(k)}(0)$ for all $k$) is not enough.