$f\in \mathcal{C}^{\infty}_{c}(\mathbb{R})$ such that $f(0)=0$ there exists $g\in\mathcal{C}^{\infty}_{c}(\mathbb{R})$ such that $f(x)=xg(x)$

Define $g:\mathbb{R}\to\mathbb{R}$ by $$ g(x) = \begin{cases} \dfrac{f(x)}{x} & (x\neq 0), \\ f'(0) & (x=0). \\ \end{cases} $$ This function is obviously continuous for $x\neq 0.$ At $x=0$ we have $$ \lim_{x\to 0} g(x) = \lim_{x\to 0} \frac{f(0+x)-f(0)}{x} = f'(0) = g(0) $$ so $g$ is also continuous there. Also, $\operatorname{supp}g \subseteq \operatorname{supp}f$ so $g\in C_c(\mathbb{R}).$

Now, as reuns suggests, we can notice that $$ g(x) = \int_0^1 f'(xt) \, dt. $$ (Remember to check both the case $x\neq 0$ and $x=0$.)

Derivatives of $g$ are given by $$ g^{(k)}(x) = \int_0^1 t^k f^{(k+1)}(xt) \, dt $$ which by construction are defined for all $x$ and all $k\in\mathbb{N}$ since $f\in C^\infty(\mathbb{R}).$ Thus $g\in C^\infty(\mathbb{R}).$

So, since $g\in C_c(\mathbb{R})$ and $g\in C^\infty(\mathbb{R})$ we have $g\in C^\infty_c(\mathbb{R}).$


If $f$ vanishes outside $[a,b]$, so does $g$. As a quotient of smooth functions, $g$ is smooth for $x\neq0$. At $x=0$ you have $$ f(x)=f(0)+f’(0)x+\frac 1 {2}f’’(0)x^2+\dots=f’(0)x+\frac 1{2}f”(0)x^2+o(x^2) $$ by the local Taylor formula. Actually you can expand up to any order $n$ with remainder $o(x^n)$. Dividing by $x$ you get $$ g(x)=f’(0)+\frac 1 {2}f’’(0)x+o(x) $$ (Or the corresponding expansion to order $n$) which is infinitely differentiable at zero with $g(0)=f’(0)$ etc.

The reason is: suppose the above relation holds ($n=1$). Setting $x=0$ you obtain $g(0)=f’(0)$. Then, dividing throughout by $x$ and taking the limit as $x\to 0$ you obtain, by definition of “little o” and of derivative $$ g’(0)=f’’(0)/2. $$ Using the corresponding expansion with $n=2$, and the previous values and dividing throughout by $x^2$ you get in the limit $$ g’’(0)=f’’’(0)/3 $$ Etc.