---
title: Rectangle Piecewise Linear Approximation
url: https://www.emergentmind.com/topics/rectangle-piecewise-linear-approximation
type: topic
---

# Rectangle Piecewise Linear Approximation

Rectangle piecewise linear approximation denotes a family of approximation schemes in which a target function or curve is represented by affine pieces on interval or box-like cells. In univariate approximation, the basic object is a continuous piecewise linear (CPWL) function on a partition \(T=\{I_i\}_{i=1}^N\), \(I_i=[x_{i-1},x_i]\), of an interval \(I=[a,b]\), where each subinterval may be viewed as a “rectangle” on the \(x\)-axis; in geometric discretization, the related models are piecewise constant step functions and polygonal curves; in multivariate approximation, the cells are dyadic rectangles or box domains partitioned into convex regions [1510.02975] [1909.04582] [1102.3108] [2309.10372]. Taken together, these uses suggest that the expression refers less to a single canonical construction than to a class of partition-based affine approximations whose mathematical emphasis varies across numerical analysis, approximation theory, optimization, and computational geometry.

## 1. Foundational constructions

For a scalar function \(f:I=[a,b]\to\mathbb R\), a partition
\[
T=\{I_i\}_{i=1}^N,\qquad I_i=[x_{i-1},x_i],\quad a=x_0<x_1<\dots<x_N=b
\]
induces the finite-dimensional space \(V\) of CPWL functions. In the hat-function basis \(\{\varphi_i\}_{i=0}^N\), any \(v\in V\) can be written as
\[
v(x)=\sum_{i=0}^N v(x_i)\,\varphi_i(x).
\]
Two canonical approximants are the linear interpolant
\[
\pi_T f(x)=\sum_{i=0}^N f(x_i)\,\varphi_i(x),
\]
which matches \(f\) at the nodes, and the \(L_2\) orthogonal projection \(P_T f\in V\), characterized by
\[
\langle f-P_T f,v\rangle=0\qquad \forall v\in V.
\]
In nodal coordinates, \(P_T f(x)=\sum_{i=0}^N c_i\varphi_i(x)\), with coefficients obtained from a tridiagonal Gram system \(Mc=b\) [1510.02975].

For discretized curves \(p=(p_0,\dots,p_{n-1})\in\mathbb R^{n\times d}\), the corresponding spline-type constructions are the 0-spline
\[
s^0(p)(t)=p_{\lfloor nt\rfloor}
\]
and the 1-spline
\[
s^1(p)(t)=p_{\lfloor nt\rfloor}+\{nt\}\bigl(p_{\lceil nt\rceil}-p_{\lfloor nt\rfloor}\bigr),
\]
which are, respectively, piecewise constant and piecewise linear discretizations of a curve \(f:[0,1]\to\mathbb R^d\). The associated curve metric is
\[
d(f,g)=\int_0^1 \|f(t)-g(t)\|\,dt.
\]
This setup makes explicit the close relation between “rectangular” approximation in the step-function sense and polygonal approximation in the affine sense [1909.04582].

A distinct but related multivariate construction uses partitions \(m\) of \([0,1]^d\) into dyadic rectangles \(K=I_1\times\cdots\times I_d\), and on each \(K\) a tensor-product polynomial with coordinate-wise degree bounded by \(r=(r_1,\dots,r_d)\). The model space is
\[
S_{(m,r)}=\{t:[0,1]^d\to\mathbb R:\ t|_K \text{ is polynomial with degree }\le r_l \text{ in }x_l\}.
\]
The piecewise linear specialization is \(r_l=1\) for all \(l\) [1102.3108].

## 2. Error metrics and approximation rates

In the univariate CPWL setting, the central local error analysis is carried out in the \(L_2\) norm. If \(f\in C^2(I)\), \(I_i=[x_{i-1},x_i]\), \(h_i=x_i-x_{i-1}\), and \(M_i=\max_{\eta\in I_i}|f''(\eta)|\), then the interpolant satisfies
\[
\|f-\pi_T f\|^2_{2(I_i)} \le \frac{h_i^5}{120}M_i^2.
\]
In the asymptotic regime where \(f''\) is nearly constant on \(I_i\), the local squared interpolation error obeys
\[
\|f-\pi_T f\|^2_{2(I_i)} \approx \frac{h_i^5}{120}(f''_{I_i})^2.
\]
For an unconstrained best linear segment on the same interval, the asymptotic squared error is
\[
\min \|f-\mathrm{line}_i\|^2_{2(I_i)} \approx \frac{h_i^5}{720}(f''_{I_i})^2,
\]
and the orthogonal projection \(P_T f\) asymptotically achieves the same constant. Consequently,
\[
\|f-P_T f\| \approx \frac{1}{\sqrt{6}}\|f-\pi_T f\|.
\]
These formulas identify the standard interpolation/projection dichotomy: interpolation preserves nodal samples, while projection improves the \(L_2\) constant by the asymptotic factor \(1/\sqrt 6\) [1510.02975].

The same source derives a curvature-driven partition design. If
\[
F(x)=\frac{\int_a^x |f''(t)|^{2/5}\,dt}{\int_a^b |f''(t)|^{2/5}\,dt},
\]
then the near-optimal non-uniform partition \(T^\ast\) is defined by
\[
F(x_i)=\frac{i}{N},\qquad i=0,\dots,N.
\]
Equivalently, the local knot density satisfies
\[
\mathrm{lkd}(x)\propto |f''(x)|^{2/5}.
\]
With this choice, both interpolant and projection retain the global rate \(O(N^{-2})\), but with better constants than the uniform partition [1510.02975].

For Sobolev-bounded curve classes, the approximation problem is formulated set-wise. In the periodic case, the Hausdorff distance between the Sobolev multiball \(W_\sharp^{m,q}(\alpha)\) and the piecewise constant class \(\mathcal S_{\sharp,n}^{m,q}(\alpha)\) is bounded by \(\kappa_\alpha/n\), while the Hausdorff distance to the piecewise linear class \(\mathcal L_{\sharp,n}^{m,q}(\alpha)\) is bounded by \(\kappa_\alpha/n^2\) when \(m\ge 2\). For a single curve sampled uniformly, the explicit bounds are
\[
d(f,s^0(p))\le \frac{\alpha_1}{n},\qquad d(f,s^1(p))\le \frac{\alpha_2}{n^2}.
\]
This makes the rectangle-versus-polyline contrast quantitative: step functions achieve first-order accuracy, while polygonal approximation reaches second order under one additional derivative [1909.04582].

## 3. Knot placement and breakpoint optimization

The accuracy of rectangle piecewise linear approximation depends decisively on breakpoint location. In nonlinear optimization, breakpoint generation is treated as a fundamental task. An explicit recent example is the rotational adjusting method (RAM), proposed as an optimal breakpoint selection method that minimizes the approximation error between the original function and the piecewise linear function with a limited number of pieces, for both convex and concave functions. RAM rotationally adjusts the location of breakpoints based on adjacent breakpoints, the optimal positions are reached after several iterations, the optimality of the method is proved, and numerical experiments are conducted on the logarithmic function [2407.21081].

A complementary formulation studies knot locating by direct nonlinear programming. For a concave increasing function \(f\), the piecewise linear interpolant is an under-approximation, and the error can be expressed as the area loss
\[
A-\widetilde A
=
\int_a^b f(x)\,dx
-
\frac12\sum_{i=0}^n (x_{i+1}-x_i)\bigl(f(x_{i+1})+f(x_i)\bigr).
\]
For general increasing functions, the paper replaces this by the smooth squared integral error
\[
\sum_{i=0}^n \psi_i(x_i,x_{i+1}),
\]
where each \(\psi_i\) is the square of the local signed integral error. The resulting knot-location problem is nonconvex; it is solved by sequential quadratic programming and by a spectral projected gradient method after the transformation
\[
y_i=\frac{x_i-a}{b-x_i},
\]
which converts the ordering constraints into the monotone nonnegative cone
\[
0\le y_1\le \cdots \le y_n.
\]
One exact structural result is that for the concave quadratic
\[
f(x)=\alpha x^2+\beta x+\gamma,\qquad \alpha<0,
\]
the optimal knot locations are uniformly spaced. Outside this special case, the numerical experiments show that optimized non-uniform knots cluster where the function bends more sharply [1909.03112].

When breakpoints are constrained to a fixed candidate grid \(T=\{t_0,\dots,t_N\}\), exact least-squares approximation with a small number of segments admits a dynamic-programming solution. The approximant
\[
f_{I,y}(t)
=
\frac{t_{i_{k+1}}-t}{t_{i_{k+1}}-t_{i_k}}\,y_k
+
\frac{t-t_{i_k}}{t_{i_{k+1}}-t_{i_k}}\,y_{k+1},
\qquad t\in[t_{i_k},t_{i_{k+1}}],
\]
is optimized either under a fixed-segment constraint or under an \(\ell_0\)-type regularization. The key object is a hybrid value function \(V_i^m(y)\), representable as a finite lower envelope of positive definite quadratics,
\[
V_i^m(y)=\min_{p\in\Pi_i^m} p(y).
\]
This yields an exact algorithm whose complexity is bounded by \(O(MN^2R^2)\), with empirical evidence that the representation size \(R\) is at most linear in \(N\) [1806.11041].

## 4. Geometric curve approximation and boundary discretization

In geometric function theory, piecewise linear approximation is constrained not only by fidelity but also by metric distortion. If \(\varphi:[0,1]\to\mathbb R^2\) is \(L\)-biLipschitz, then for every \(\varepsilon>0\) there exists a finitely piecewise linear \((L+\varepsilon)\)-biLipschitz function \(\varphi_\ast:[0,1]\to\mathbb R^2\) such that
\[
\varphi_\ast(0)=\varphi(0),\qquad \varphi_\ast(1)=\varphi(1),\qquad \|\varphi-\varphi_\ast\|_{L^\infty}\le \varepsilon.
\]
The same statement holds for closed curves \(\varphi:\mathbb S^1\to\mathbb R^2\). The result improves an earlier \(4L\)-biLipschitz polygonal approximation to the sharp \(L+\varepsilon\) form [1505.06510].

This theorem is used explicitly as a boundary discretization tool in rectangle- or grid-based approximation of higher-dimensional mappings. On each side of a square or rectangle, one has a one-dimensional boundary map; replacing it by a polygonal map with bi-Lipschitz constant \(L+\varepsilon\) preserves boundary injectivity and gives compatible edge data for piecewise affine interior extensions. The paper also discusses snapping polygonal vertices to a rectangular grid, with the caveat that this step is not proved explicitly there; the stated implication is that sufficiently small perturbations of vertices preserve the bi-Lipschitz constants up to the desired tolerance [1505.06510].

A different but complementary geometric framework studies Hausdorff distances between continuous Sobolev balls and sets of piecewise constant or piecewise linear discretizations. There the emphasis is not on bi-Lipschitz control but on norm-preserving discretization and on constructive smoothing back to regular curves via uniformly spaced B-splines whose coefficients are described in terms of Eulerian numbers [1909.04582].

## 5. Multivariate rectangles, anisotropy, and piecewise-convex box models

On \([0,1]^d\), rectangle piecewise linear approximation becomes a problem of nonlinear approximation over partitions into dyadic rectangles. For anisotropic smoothness \(\sigma=(\sigma_1,\dots,\sigma_d)\), the relevant dyadic system is
\[
\mathcal D^\sigma_j
=
\Bigl\{
I_1\times\cdots\times I_d:\ |I_l|=2^{-\lfloor j\underline\sigma/\sigma_l\rfloor}
\Bigr\},
\qquad
\underline\sigma=\min_l \sigma_l,
\]
and the harmonic mean
\[
H(\sigma)
=
\left(\frac1d\sum_{l=1}^d \frac1{\sigma_l}\right)^{-1}
\]
governs approximation rates. If \(s\in\mathcal S(r,\sigma,p,p',R)\) and
\[
\frac{H(\sigma)}{d}>(1/p-1/q)_+,
\]
then for every \(D\) large enough,
\[
\inf_{t\in\bigcup_{m\in\mathcal M_D} S_{(m,r)}} \|s-t\|_q
\le
C\,R\,D^{-H(\sigma)/d}.
\]
In the piecewise linear specialization \(r=(1,\dots,1)\), this yields a full anisotropic rectangle-based affine approximation theory with the rate \(D^{-H(\sigma)/d}\). In the associated density-estimation problem, the selected dyadic piecewise polynomial estimator is minimax rate-optimal up to a constant factor when \(r_\star\) is fixed, which includes the piecewise linear case \(r_\star=(1,\dots,1)\) [1102.3108].

A more optimization-oriented multivariate model is piecewise-convex approximation (PwCA). Here the domain is a box
\[
x_{j,\min}\le x_j\le x_{j,\max},\qquad j=1,\dots,n-1,
\]
and the approximation splits the box into exactly two regions separated by an interface hyperplane. In each region, the function is approximated by the maximum of affine hyperplanes; continuity across the interface is enforced structurally through a rotation-and-shift parameterization of paired hyperplanes. The principal MILP advantage is that the corresponding formulation requires only one auxiliary binary variable, in contrast to simplex-based piecewise linear approximation, whose formulations require more binaries and more auxiliary variables. The paper emphasizes that PwCA is a two-region approximation, not a full tessellation into axis-aligned rectangles, although the ambient domain is rectangular [2309.10372].

## 6. Computational realizations: GPU, MILP, and MIQP

One computational line is hardware-oriented CPWL evaluation. For GPU-based applications, the univariate approximation is stored by nodal values in a 1D texture. On a uniform partition, evaluation reduces to constant-time index computation and hardware linear interpolation; on a non-uniform partition, interval search is required, typically by binary search. The theoretical appeal of the optimized partition \(T^\ast\) is therefore balanced against the practical advantage of uniform partitions on current GPUs [1510.02975].

A second line embeds rectangle piecewise linear approximation directly into mathematical programming. In acquisition-function optimization for Bayesian optimization, the Matérn \(3/2\) kernel
\[
k(r)=\sigma_f^2(1+\sqrt3\,r)\exp(-\sqrt3\,r)
\]
is approximated on the scalar distance interval \([0,r_{\max}]\) by a piecewise linear function \(\tilde k(r)\) built on breakpoints \(\{R_j\}_{j=0}^M\). The MIQP encoding uses convex-combination variables \(w_i^j\) and binary variables \(\lambda_i^j\) so that
\[
r_i=\sum_{j=0}^M w_i^j R_j,\qquad
\tilde K_{xX_i}=\sum_{j=0}^M w_i^j k(R_j),
\]
with adjacency constraints ensuring that only two adjacent breakpoints are active. This is a standard interval-based rectangle encoding in the scalar radius variable rather than a box partition in the full input space. The approximation error \(\epsilon_M=\sup_r |k(r)-\tilde k(r)|\) satisfies \(\lim_{M\to\infty}\epsilon_M=0\), and the induced Gaussian-process errors obey
\[
|\mu(x)-\tilde\mu(x)|\le C_\mu N^2\epsilon_M,\qquad
|\sigma(x)-\tilde\sigma(x)|\le C_\sigma N\epsilon_M^{1/2}.
\]
Under the schedule \(\epsilon_{M_t}=\mathcal O(t^{-(4+\epsilon)})\), the cumulative regret retains the order \(\mathcal O^\ast(\sqrt{dT\gamma_T})\) [2410.16893].

These computational realizations clarify a recurring structural point. In one-dimensional function evaluation, “rectangle” usually means the interval \(I_i=[x_{i-1},x_i]\); in dyadic approximation theory, it means anisotropic Cartesian cells \(K=I_1\times\cdots\times I_d\); in mixed-integer formulations, it often means the interval cell selected by binary variables in a convex-combination encoding; and in box-domain convexification, it can denote the ambient hyperrectangle even when the internal partition is not axis-aligned. This suggests that rectangle piecewise linear approximation is best understood as a partition-centric methodology whose invariant core is local affine representation, but whose geometry, optimality criteria, and solver interfaces are field-dependent.

Source: https://www.emergentmind.com/topics/rectangle-piecewise-linear-approximation