Suppose that $f \in \mathcal{C}^{k+1}$ is a function such that $f(a) = f'(a) = \cdots f^{(k-1)}(a) = 0$ and $f^{(k)}(a) \neq 0$. Can we write $f(x) = (x-a)^kg(x)$ for some $g \in \mathcal{C}^2$?
My attempt:
Using the Taylor expansion formula and using the hypothesis $f(a) = f'(a) = \cdots f^{(k-1)}(a) = 0$ , we have: $$ f(x) = f^{(k)}(a)\frac{(x-a)^k}{k!} + f^{(k+1)}(\theta)\frac{(x-a)^{k+1}}{(k+1)!}$$
where $\theta$ depends on $x$. If we he define: $$ g(x) = \frac{f^{(k)}(a)}{k!} + f^{(k+1)}(\theta)\frac{(x-a)}{(k+1)!}$$ then $f(x) =(x-a)^kg(x)$. But it is not clear if $g\in \mathcal{C}^2$ since $\theta$ depends on $x$. I was not able to give a counterexample that shows that $g\notin \mathcal{C}^2$ either.
I would appreciate any help. Thanks.