If I take a piecewise linear function (piecewise affine) is it true that I can always write it as a sum of concave and convex functions?

My understanding of this page


suggests that any linear function is both convex and concave, so for a piecewise linear function is it always possible to 'separate' the convex and concave parts?


1 Answer 1


Let me assume that you are talking about a real-valued function $f : [a,b] \to \mathbb{R}$. A characterization of which such functions may be written as $f=g-h$ with $g$ and $h$ convex (so $-h$ concave) is known. The result is the following (see this book):

Let $f : [a,b] \to \mathbb{R}$. Then there exists $g$ and $h$ convex such that $f = g-h$ if and only if the derivative of $f$ is in the class $BV[a,b]$ of functions of bounded variation on $[a,b]$.

Here, "derivative" is in the sense that there exists a function $r \in BV[a,b]$ such that, for all $x \in [a,b]$, $$ f(x)-f(a) = \int_a^x r $$

Hence, the answer to your question is both yes and no. If you take an $f$ which is piecewise affine but has discontinuities, then you will not be able to find such a decomposition. Conversely, if it is continuous, then its derivative will be piecewise constant, so of bounded variation, so the above result applies.

  • 1
    $\begingroup$ Discontinuous functions on a finite interval $[a,b]$ are in BV if they are bounded and if there are only finitely many discontinuities. I think that's pretty much the case the OP had in mind. $\endgroup$ May 16, 2023 at 4:28
  • 2
    $\begingroup$ Sure. But here the characterization requires that the derivative is BV, not the function itself. Having a BV derivative implies continuity. $\endgroup$
    – cs89
    May 16, 2023 at 4:48
  • 1
    $\begingroup$ Ah, yes. And I now also realize that the decomposition of a piecewise but discontinuous function would likely also be discontinuous, and discontinuous functions are neither convex nor concave. $\endgroup$ May 16, 2023 at 21:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .