When is the difference of two convex functions convex?

Assume that $$X$$ is a finite-dimensional Banach space. I know that, in general, if two functions $$f, g : X \to \mathbb{R}$$ are convex, then the function $$(f-g) : X \to \mathbb{R}$$ given by $$x \mapsto f(x) - g(x)$$ is not necessarily convex. Are there conditions we can impose on $$f$$ and $$g$$ so that the difference is still convex, e.g., if $$f (x) \geq g (x)$$ for every $$x$$ then can we say it's convex?

Are there any results about the convexity of the difference of convex functions?

• When is the difference of two increasing functions increasing? When is the difference of two positive functions positive? When the appropriate inequality holds, which is a tautological answer. There isn't a better one unless we are dealing with some special class of functions.
– user147263
Oct 5, 2014 at 16:04
• May I ask why you are asking? Honestly I'm casting lots with Care Bear here. I don't think you're going to find a particularly special or illuminating answer; I doubt there is one. Kim Jong Un's answer is technically correct, but of course it assumes differentiability, and is even so somewhat tautolgical. Oct 6, 2014 at 2:00
• Do you agree with my edits? Feb 17, 2023 at 11:42

For any real-valued function $h$, $\alpha\in[0,1]$ and $x,y$ in the (convex) domain, let $$D(h,\alpha,x,y)=\alpha h(x)+(1-\alpha)h(y)-h[\alpha x+(1-\alpha)y].$$ Convexity for $h$ means $D(h,\alpha,x,y)\geq 0$ for all $\alpha,x,y$.
For your situation, one sufficient condition for $f-g$ to be convex is that $$D(f,\alpha,x,y)\geq D(g,\alpha,x,y)\tag{i}$$ for all $\alpha,x,y$. (I think of this as $f$ being "more convex" then $g$.) Note that (i) doesn't impose convexity directly on $f$ and $g$. For example, $f(x)=-x^2$ and $g(x)=-2x^2$ satisfy (i) so that $f-g$ is convex but $f$ and $g$ are individually concave.
When the domain is $\mathbb{R}$ and $f$ and $g$ are both twice differentiable, it is also sufficient to have $$f''\geq g''\tag{ii}.$$
$f\ge g$ is not sufficient: for example, take $f(x)=\sqrt{x^2+1}$ and $g(x)=|x|$ (with $X=\mathbb R$); for another, take $f(x)=|x|$ and $g(x)=\max\ \{0,|x|-1\}$.