# A $C^2$-function as difference of two convex functions

Suppose $I \subset \Bbb R$ is open, and $f:I\rightarrow \Bbb R$ and $f\in C^2$. Is this true that f can be written as difference of two convex functions? How can I show that?

For closed set, it can be easily shown by using extreme value theorem. The trouble occurs since I is open.

What I have thought is that using the characterization of convex function, I.e. every convex function can be written as indefinite integral of some non decreasing function. Since $f’(x)$ is continuously differentiale, $f’(x)$ is for sure of bounded variation hence it can be written as difference of two non-decreasing functions $g(x),h(x)$. However, I am not sure how can I show that there exist anti derivatives to $g(x)$ and $h(x)$ since they are not necessarily continuous.

• If $I$ is bounded interval there is a one line proof this problem Commented Mar 17, 2018 at 4:30

Yes, $f$ can be written as difference of two convex functions.
Let $f_+''(x)=\max(f''(x),0)\geq 0$ and $f_-''(x)=-\min(f''(x),0)\geq 0$. Then $f_+''$, $f_-''$ are continuous functions on $I$ and $f''=f_+''-f_-''$. Let $a\in I$, then $f'(x)=g_1(x)-h_1(x)$ with $$g_1(x):=f'(a)+\int_a^x f_+''(t)dt\quad\text{and}\quad h_1(x):=\int_a^x f_-''(t)dt.$$ Moreover $f(x)=g(x)-h(x)$ with $$g(x):=f(a)+\int_a^x g_1(t)dt\quad\text{and}\quad h(x):=\int_a^x h_1(t)dt.$$ Finally note that $g$ and $h$ are convex because $g_1$ and $h_1$ are non-decreasing functions.
• Thank you. Is $a \in I$ chosen arbitrary? Does it carry forward if I change to a different $a’\in I$. I have been thinking about this approach. However, since the fundamental theorem of calculus apply only on closed interval, I didn’t see how to extend this to an open interval. Commented Mar 16, 2018 at 8:25
• Yes, $a$ is arbitrary in $I$. Changing $a$, we have different $g$ and $h$. Commented Mar 16, 2018 at 8:28
• I have an extra question on this topic, this proprietie can be generalized to a multivariable function $f:\mathbb{R}^n\to\mathbb{R}$ Commented Dec 10, 2020 at 10:21