Fundamentals / Numerical mathematics / Approximation and quadrature

Uniform approximation and alternation

Certify a best uniform polynomial by finding alternating errors and compare its guarantee with interpolation at fixed nodes.

From first principles

Why alternating errors can certify a uniform approximation

To approximate \(f\) on a closed interval, measure the largest error in absolute value. A degree-\(n\) minimax polynomial is one for which no other polynomial of the same degree has a smaller largest error. Suppose a candidate \(p\) has absolute residual bounded by \(E>0\), and at \(n+2\) ordered points the residual attains alternating extrema,

\[f(x_i)-p(x_i)=(-1)^i E,\qquad x_0<x_1<\cdots<x_{n+1}.\]

If another polynomial \(q\) had error strictly below \(E\), the difference \(q-p\) would have to be positive at each positive residual extremum and negative at each negative one, or vice versa depending on the first sign. Continuity then forces

\[\#\{\text{distinct zeros of }q-p\}\ge n+1 .\]

A nonzero polynomial of degree at most \(n\) cannot have that many roots. Thus the candidate is optimal once its global error bound and the alternating points are verified. Values sampled only at trial extrema do not certify that a still larger error is absent between them.

Derivation and applications

Remove the leading monomial with the least possible uniform error

Suppose a polynomial fit can represent every degree up to \(n-1\), but the signal contains one additional monomial \(x^n\). On \([-1,1]\) the residual \(x^n-p_{n-1}(x)\) is a monic polynomial of degree \(n\), regardless of the coefficients chosen for the fit. The Chebyshev polynomials provide a monic residual with particularly small uniform magnitude. Define \(T_n(\cos\theta)=\cos(n\theta)\). The cosine addition formula gives

\[T_0=1,\]
\[T_1=x,\]
\[T_{n+1}=2xT_n-T_{n-1}.\]

By induction the coefficient of \(x^n\) is \(2^{n-1}\) for \(n\ge1\). Multiplying \(T_n\) by the reciprocal of that coefficient gives a monic polynomial bounded by \(2^{1-n}\) on the entire interval. Subtract it from the original target so that the highest powers cancel,

\[p_{n-1}^*(x)=x^n-2^{1-n}T_n(x),\]
\[\|x^n-p_{n-1}^*\|_\infty=2^{1-n}.\]

At the \(n+1\) points \(x_j=\cos(j\pi/n)\) the chosen residual equals \(2^{1-n}(-1)^j\). These alternating extrema certify optimality: a strictly better approximant would force its difference from \(p_{n-1}^*\) to change sign at least \(n\) times, exceeding the degree \(n-1\). For a leading term \(ax^n\) on a physical interval with midpoint \(m\) and half-width \(h\), the affine variable \(t=(x-m)/h\) shows that the optimal error scales as

\[E_{\min}=|a|h^n2^{1-n}.\]

Lower-degree terms can be carried into the approximant exactly. This result applies to uniform absolute error; changing to a mean-square criterion or weighting locations differently changes the optimization.

Worked example

Compress a cubic response to a quadratic model

For \(n=3\), \(T_3=4x^3-3x\), hence the best degree-at-most-two approximation of \(x^3\) on \([-1,1]\) is \(3x/4\). Its residual has magnitude \(1/4\) at \(-1,-1/2,1/2,1\), with alternating signs. The unused quadratic coefficient follows from the odd symmetry of the target and interval.

Second application

Scale the guarantee to a physical interval

Approximate \(2x^4+3x\) by a cubic on \([0,4]\). The half-width is 2, so the least possible uniform error is

\[2(2^4)/8=4.\]

An explicit optimum is \(2x^4+3x-4T_4((x-2)/2)\); its fourth-degree term cancels. Halving the interval width reduces the optimal error to \(4/16=0.25\) for the same polynomial target.

An error budget that applies everywhere

A calibration curve may have a specification requiring its largest absolute deviation anywhere in an interval to stay below a threshold. Assign a polynomial \(p\) of degree at most \(m\) and consider \(E(p)=\max_{a\leq x\leq b}|f(x)-p(x)|\) for a continuous target. Interpolating selected measurement locations fixes the polynomial there. It need not allocate the remaining error efficiently. Shifting an interpolant by a constant sometimes halves its largest deviation at once.

Suppose \(m+2\) ordered locations attain the same error magnitude with alternating signs. Any polynomial with strictly smaller maximum error must move up at each positive extreme and down at each negative extreme. Its difference from the candidate then has at least one zero between each consecutive pair. This requires \(m+1\) zeros in a polynomial of degree at most \(m\), a contradiction. Those extreme points thus certify optimality globally once the candidate's error is bounded over the entire interval.

Find the best line by hand

Approximate \(x^2\) on \([-1,1]\) by \(a+bx\). Averaging that line with its reflection gives the constant \(a\). For each \(x\), the averaged error is the mean of the errors at \(x\) and \(-x\), so the uniform norm cannot increase. For constants the target covers the whole range from zero to one. The midpoint \(a=1/2\) balances its two extreme distances. At \(-1,0,1\), the errors are \(+1/2,-1/2,+1/2\). These three points certify the optimum among all lines, including nonsymmetric ones.

The endpoint interpolant is the constant 1. Its error is zero at both ends and reaches magnitude 1 at zero. Lowering the line sacrifices exact agreement with the endpoints in exchange for a factor of two in the worst case. If the endpoint values encode compulsory boundary conditions, such a shift is inadmissible and the optimisation problem must include those constraints.

Exchange trial extrema

For an unknown target, guess \(m+2\) extreme locations and solve the linear system \(f(x_i)-p(x_i)=(-1)^iE\) for the coefficients and \(E\). Search the full interval, including its boundaries, for the largest deviation. When it exceeds the trial level, exchange a support point while retaining sign alternation and repeat. For smooth targets, the zeros of \(f'-p'\) supply candidate interior extrema. A coarse plotting grid alone cannot certify the resulting maximum.

For a constant approximation to \(e^x\) on \([0,1]\), monotonicity identifies the endpoints immediately. Equalising \(a-1=e-a\) gives \(a=(1+e)/2\) and error \((e-1)/2\), approximately 0.85914. Replacing the upper endpoint by a larger value raises both quantities. The constant optimum depends on the range, providing a simple independent check on an implementation of the exchange procedure.

A lower bound from three measurements

Suppose measurements at \(-1,0,1\) give the exact values \(1,0,1\) but the interior shape is otherwise unknown. Any line still has maximum error at least one half on those three measurements: averaging its two endpoint predictions recovers its value at zero, so it cannot be within less than one half of both endpoint targets and the central target. The lower bound survives with sparse data. The matching upper bound requires information between the measurements, supplied in the earlier example by the analytic formula \(x^2\).

Exploit symmetry to approximate a kink by a quadratic

The absolute-value function on \([-1,1]\) has a derivative jump at zero. To fit it uniformly with a quadratic \(p\), average \(p(x)\) with \(p(-x)\). The maximum error cannot increase because the target is even and the error of the average is bounded by the average of the two original absolute errors. The optimisation can therefore start with an even polynomial \(a+bx^2\) and examine only \(0\le x\le1\). Its signed error is

\[e(x)=x-a-bx^2.\]

A plausible minimax candidate has equal negative errors at both ends of this half interval and a positive interior maximum.

Equal endpoint errors require \(-a=1-a-b\), hence \(b=1\). Differentiation then puts the positive maximum at \(x=1/2\), where the error is \(1/4-a\). Equalising its magnitude with the endpoint magnitude \(a\) gives \(a=1/8\). Directly completing the square gives \(e(x)=1/8-(x-1/2)^2\) on the half interval. Its entire range is \([-1/8,1/8]\), so this construction has established the upper error bound at every point, including locations between the supposed extrema.

Certify the optimum and compare a smoother error measure

On the original interval the errors at \(-1,-1/2,0,1/2,1\) are \(-1/8,+1/8,-1/8,+1/8,-1/8\). If any quadratic had a strictly smaller uniform error, its difference from the constructed polynomial would have to alternate sign at those five locations. Continuity would require at least four distinct real zeros. A nonzero quadratic cannot have four real zeros, so the proposed approximation is globally optimal even among polynomials with a linear term. The unusually long alternation is a consequence of symmetry and the central kink; four alternating points would already suffice for degree two.

For comparison, the quadratic interpolating the two ends and the central kink is \(x^2\). Its error on the positive half is \(x-x^2\), ranging from zero to \(1/4\). Shifting it upward by one eighth cuts the maximum error in half. Now suppose the instrument is used predominantly near the centre, where its true ideal value is zero. The minimax polynomial introduces a nonzero prediction of \(1/8\) there even though the original interpolant was exact. The preference for uniform accuracy amounts to a decision about the acceptable errors at those specific operating points.

A differentiability-based search that checks only stationary points can also fail in this problem. The target has a corner at zero, where its left and right derivatives differ. The error maximum in absolute value there is determined by the one-sided behaviour. For piecewise-smooth targets, include breakpoints and endpoints along with the roots of the error derivative on every smooth segment. Omitting a kink can produce an apparent equioscillation pattern with an incorrect reported bound.

For uniform approximation at a tolerance of one tenth, the optimum error of one eighth proves that no quadratic can meet the requirement on this interval. A failure by one fitted polynomial alone would not establish this. The alternation certificate tells an engineer when changing the polynomial class or splitting at the kink is mathematically necessary.

Change parameters · Explore the worked calculation

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.