liveBook · Manning

Basis polynomial

As explained in Geometry for Programmers

A basis polynomial for interpolation is a polynomial that equals one at its associated data-point input and zero at the other interpolation inputs.

A basis polynomial is an interpolation building block: it equals 1 at its associated input xᵢ and 0 at every other interpolation input xⱼ. For N data points, define it as gᵢ(x) = ∏ⱼ≠ᵢ (x − xⱼ)/(xᵢ − xⱼ). Although written as ratios, the data inputs are fixed numbers, so each factor is linear and gᵢ is an ordinary polynomial of degree N−1. section 6.3.4

The defining values make basis polynomials useful for assembling an interpolating polynomial:

  • At x = xᵢ, every factor’s numerator matches its denominator, so gᵢ(xᵢ) = 1. section 6.3.4
  • At any other data input xⱼ, one factor has a zero numerator, so gᵢ(xⱼ) = 0. section 6.3.4
  • Scale each gᵢ by its data value yᵢ and add the results: L(x) = Σᵢ yᵢgᵢ(x). The sum passes through every interpolation point. section 6.3.4 section 6.3.6

Checking one basis polynomial

The polynomial 0.1x² − 0.1x − 0.2 evaluates to 1 at x = −3 and to 0 at x = −1 and x = 2, demonstrating the one-at-one-input, zero-at-the-others pattern.

How Geometry for Programmers covers it

How deep it goes
Derives the product formula, its one-and-zero values, and degree, but treats Lagrange interpolation mainly as conceptual groundwork.
Examples
Uses a quadratic polynomial, three input values, plotted basis functions, and scaled-sum figures to demonstrate interpolation.
What you can do after
Build it from scratch by evaluating basis polynomials and summing their y-scaled contributions.
How it connects
Connects basis polynomials with Lagrange interpolation, polynomial interpolation, basis vectors, splines, and Bézier curves.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.