TITLE: Is there any structure theorem for piecewise linear functions?
QUESTION [6 upvotes]: I was wondering if such statements are known like "any piecewise linear function from $\mathbb{R}^d \rightarrow \mathbb{R}$ can be written as $\sum_{i=1}^k \alpha_i (\text{ some $2$ piece linear function})$" (for some positive integer $k$ that depends on the given function and some real numbers $\alpha_i$ and maybe the $2$ piece function is different for each $i$). 

Is there something in the theory of ``tropical varieties/geometry" which relates to such a thing?

REPLY [6 votes]: If you weren't assuming the piecewise linear function $f: \mathbb R^d \to \mathbb R$ is continuous, then I think this is true: we can just choose functions
$$ f_i = \begin{cases}
\text{(some linear piece of $f$)} & \text{if in domain of linear piece} \\
0 & \text{otherwise},
\end{cases}$$
and choose all coefficients $\alpha_i = 1$, so $f = \sum_i f_i$.

If you were assuming that the function $f$ is continuous, and you want to write it as a sum of continuous two-piece linear functions, then  this is false when $d\geq 2$. 
Note that if $f_i$ is a two-piece linear function which is continuous, then the set of points where $f_i$ is discontinuous (i.e. the ''break locus'' of $f_i$) must be a hyperplane in $\mathbb R^d$.
Thus if we take a finite sum $\displaystyle\sum_{1\leq i\leq k} \alpha_i f_i$ over such functions, the points of discontinuity will form a hyperplane arrangement in $\mathbb R^d$ with at most $k$ hyperplanes.
(If ''cancellation'' occurs in the locus of discontinuity, it will happen along the whole hyperplane.)
However, when $d\geq 2$ there are many possible piecewise linear continuous functions $f:\mathbb R^d \to \mathbb R$ whose break locus is not a hyperplane arrangement. The simplest example is probably
$$f(x,y) = \max\{0,x,y\} : \mathbb R^2 \to \mathbb R,$$
whose break locus is the tropical line:

[image from Frank Sottile's website ]

If we only consider the case $d = 1$, then it is true that any piecewise linear continuous function may be expressed as a sum of two-piece such functions. 
In light of the above counterexample it may be tempting to conjecture that the correct generalization is that a function $\mathbb R^d \to \mathbb R$ may be expressed as a sum of $(d+1)$-piece functions, but this is not true either, e.g. for the plane conic in 
$\mathbb R^2$ cut out by 
$$f(x,y) = \max\{ 0, 1+x, 1+y, 1+x+y, 2x, 2y\}.$$
To explain this behavior there is a perfect analogy with polynomials over complex numbers (or any algebraically closed field), via tropical geometry / algebra:

The fundamental theorem of algebra states that any polynomial $f \in \mathbb C[x]$ may be factored as a product of linear polynomials, but it is not true that any polynomial $f \in \mathbb C[x_1,\ldots,x_d]$ has  a factorization into linear polynomials when $d\geq 2$.