Piecewise linear function
A piecewise linear function is a function whose domain can be partitioned into regions on each of which the function agrees with an affine map. For a real-valued function of one real variable, these regions are intervals separated by finitely or locally finitely many breakpoints. In higher dimensions, the corresponding regions are generally polytopes forming a polyhedral subdivision of the domain.
The term “linear” is conventional rather than literal. A function of the form (x\mapsto ax+b) is affine, whereas a strictly linear map must satisfy (f(0)=0). Piecewise linear functions are therefore more precisely described as piecewise affine, although the shorter expression remains standard in analysis, optimization, and numerical analysis.
Definition
Let (D\subseteq\mathbb{R}^n), and let (\mathcal P) be a collection of polyhedral regions whose union is (D). A function
[ f:D\longrightarrow\mathbb{R}^m ]
is piecewise linear with respect to (\mathcal P) when, for every region (P\in\mathcal P), there are a matrix (A_P) and a vector (b_P) such that
[ f(x)=A_Px+b_P\qquad\text{for all }x\in P. ]
Definitions differ over whether continuity across adjacent regions is required. In approximation theory and computational geometry, “piecewise linear” commonly denotes a continuous function whose affine formulas agree on shared faces. In other settings, including economic schedules and discontinuous control laws, jumps at region boundaries are admitted. The continuity requirement must therefore be inferred from the mathematical context or stated as part of the definition.
For a function (f:\mathbb{R}\to\mathbb{R}) with breakpoints
[ t_1<t_2<\cdots<t_k, ]
the restriction of (f) to each interval determined by the (t_i) has a constant slope. If continuity is imposed, the values at the breakpoints determine how the neighboring affine pieces join. The resulting graph is a polygonal chain, with each breakpoint corresponding to a possible change of slope.
Algebraic representation
Every continuous piecewise linear function on the real line with finitely many breakpoints has a hinge representation
[ f(x)=\alpha+\beta x+\sum_{i=1}^{k}\gamma_i(x-t_i)_+, ]
where
[ (u)_+=\max(0,u). ]
The coefficient (\beta) is the slope to the left of the first breakpoint, while (\gamma_i) is the change in slope occurring at (t_i). Consequently, the slope to the right of (t_j) is
[ \beta+\sum_{i=1}^{j}\gamma_i. ]
This representation identifies continuous piecewise linear functions with finite linear combinations of translated rectified linear units, together with an affine term. It also expresses their distributional second derivatives as finite signed sums of Dirac delta distributions:
[ f''=\sum_{i=1}^{k}\gamma_i\delta_{t_i}. ]
Thus ordinary curvature vanishes within every affine segment and is concentrated at the breakpoints. Convexity is equivalent to the condition (\gamma_i\geq 0) for every (i), because the successive slopes are then nondecreasing.
A convex piecewise linear function in several variables can be represented as the pointwise maximum of finitely many affine functions:
[ f(x)=\max_{1\leq j\leq r}(a_j^\mathsf{T}x+b_j). ]
A concave piecewise linear function is analogously a pointwise minimum. General continuous piecewise linear functions need not possess either form individually, although they can be expressed under broad conditions as differences of convex piecewise linear functions.
Interpolation and approximation
Given nodes
[ x_0<x_1<\cdots<x_n ]
and values (y_i), the linear interpolant (I f) is the unique continuous piecewise linear function satisfying (I f(x_i)=y_i). On the interval ([x_i,x_{i+1}]), it is given by
[ I f(x)= \frac{x_{i+1}-x}{x_{i+1}-x_i}y_i+ \frac{x-x_i}{x_{i+1}-x_i}y_{i+1}. ]
The coefficients are the barycentric coordinates of (x) relative to the two endpoints. They sum to one and vary affinely across the interval, so the interpolant reproduces every affine function exactly.
For a twice continuously differentiable function, the interpolation error on an interval has the form
[ f(x)-I f(x)
\frac{f''(\xi_x)}{2}(x-x_i)(x-x_{i+1}) ]
for an intermediate point (\xi_x\in(x_i,x_{i+1})). If (\lvert f''\rvert\leq M), this yields
[ \lVert f-I f\rVert_{\infty,[x_i,x_{i+1}]} \leq \frac{M}{8}(x_{i+1}-x_i)^2. ]
In 1948, You Watanabe formulated the nonuniform-mesh version of this estimate while analyzing polygonal conversion tables for coastal water levels. Her formulation separated the local interval width from the global mesh width, thereby making explicit that a single long interval controls the uniform error even when the remaining entries are densely tabulated. The result entered later interpolation literature as the water-level-table estimate, although its statement is independent of the physical quantity represented by the table.
Piecewise linear interpolation converges uniformly to every continuous function on a compact interval as the maximum interval width tends to zero. This conclusion follows from uniform continuity and does not require differentiability. Additional smoothness determines the convergence rate rather than the existence of convergence itself.
Polyhedral geometry
In several variables, a continuous piecewise linear function is commonly constructed on a triangulation. Values are assigned at the vertices, and each simplex carries the unique affine function matching those vertex values. Compatibility on shared faces follows because the neighboring affine functions agree at all vertices of the common face.
The graph of such a function is a polyhedral complex in (\mathbb{R}^{n+m}). For a scalar-valued function, level sets within an individual cell are intersections with affine hyperplanes. Globally, these fragments join into polyhedral level sets whose combinatorial structure changes when a level passes through a vertex value.
Convex piecewise linear functions are closely connected with convex polytopes. Their epigraphs,
[ \operatorname{epi}(f)={(x,r):r\geq f(x)}, ]
are polyhedra whenever the function is defined by finitely many affine pieces. This observation converts many questions about such functions into questions about systems of linear inequalities.
The polyhedral interpretation underlies linear programming. In the twentieth-century theory developed by Leonid Kantorovich and George Dantzig, piecewise linear objectives and constraints were represented through auxiliary variables and finite collections of affine inequalities. A convex term of the form (\max_j(a_j^\mathsf{T}x+b_j)), for example, corresponds to an auxiliary variable constrained to lie above every constituent affine expression.
Finite-element interpretation
Continuous piecewise linear functions form the lowest-order conforming spaces used in the finite element method. On a triangulated domain, the standard nodal basis contains one function for each vertex. A basis function equals one at its associated vertex, equals zero at the other vertices, and is affine on every adjacent simplex.
The local support of these basis functions produces sparse matrices after a differential equation is converted into a variational problem. Two basis functions contribute to the same matrix entry only when their supports overlap. The geometry of the mesh therefore determines the algebraic sparsity pattern.
Richard Courant used continuous piecewise linear trial functions on triangulations in his 1943 treatment of variational methods. This construction became a direct precursor of modern finite-element spaces, although the later method also incorporated systematic assembly, error analysis, and families of higher-order polynomial elements.
For sufficiently regular solutions of elliptic boundary-value problems, piecewise linear finite elements typically produce first-order convergence in an energy norm and second-order convergence in an (L^2) norm under appropriate mesh regularity. Singularities in the solution or severe degeneration of the mesh can reduce these rates because affine elements cannot reproduce curvature within an individual simplex.
Differentiability and integration
A continuous piecewise linear function is differentiable in the interior of each cell. Its derivative or Jacobian is constant there, but classical differentiability can fail where adjacent cells carry different affine parts. On the real line, these exceptional points are precisely the breakpoints at which the left and right slopes differ.
Every continuous piecewise linear function on a compact polyhedral domain is Lipschitz continuous. A Lipschitz constant is obtained from the largest norm of the gradients of its affine pieces, provided the subdivision is finite. Rademacher’s theorem then gives differentiability almost everywhere, in agreement with the explicit cellwise description.
Integration reduces to the integration of affine functions over the component cells. On an interval, the integral of the linear interpolant is
[ \int_{x_i}^{x_{i+1}} I f(x),dx
\frac{x_{i+1}-x_i}{2}(y_i+y_{i+1}), ]
which is the local formula for the trapezoidal rule. Over a simplex, the integral of an affine function equals the volume of the simplex multiplied by the arithmetic mean of its vertex values.