Continuous function as difference of convex functions Can every continuous function $f:\mathbb{R} \rightarrow \mathbb{R}$ be written as the difference of two convex functions?
If not, can every twice continuously differentiable function $f:\mathbb{R} \rightarrow \mathbb{R}$ be written as the difference of two convex functions?
Is there an explicit decomposition?
My thoughts for the latter case are as follows:
Let 
$$
g_1(x)=f(0) + \int_0^xf'(s)\chi_{\{f''(s)\geq 0\}}\,ds,
$$
$$
g_2(x)= \int_0^x-f'(s)\chi_{\{-f''(s) > 0\}}\,ds.
$$
We have $f(x) = g_1(x)-g_2(x)$ but I can't see how to prove/disprove $g_1,g_2$ being convex.
Is it enough to note that the second derivative of each of $g_1,g_2$ is non-negative?
This question is motivated as a positive answer would allow the Ito-Tanaka formula to be applied to continuous functions.
Thanks

For $f \in C^{2}$ the result is true but your construction does not work. Start with $g_1(x)=\int_0^{x}(f''(t))^{+}dt$ and then take $g(x)=\int_0^{x} g_1(t) dt$. Simialry define $h_1$ and $h$ and see that $f(x)=f(0)+xf'(0)+g-h$. [Here $x^{+}=\max \{x,0\}$ and $x^{-}=-\min\{x,0\}$]. Note that $f(0)+xf'(0)+g$ and $h$ are convex.
