liveBook · Manning

Vandermonde matrix

As explained in Geometry for Programmers

A Vandermonde matrix is a matrix whose rows contain successive powers of specified input values and which arises in polynomial interpolation systems.

A Vandermonde matrix turns polynomial interpolation into a linear-system problem. For each point (xᵢ, yᵢ), it records the powers of xᵢ so solving for the coefficient vector produces a polynomial passing through the data. section 6.3.1

For N points and a polynomial of degree N−1:

  • Build an N×N matrix whose row i contains 1, xᵢ, xᵢ², through xᵢⁿ⁻¹. section 6.3.1
  • Place the observed y values in a column vector and solve Vandermonde × coefficients = y values. section 6.3.5
  • Use exactly N equations for N coefficients; fewer points leave a continuum of possible polynomials. section 6.3.1

Interpolating five measured values

For xs = [1, 2, 3, 4, 5] and ys = [4, 2, 3, 2, 4], construct the matrix with Python list comprehensions, convert it and ys to SymPy matrices, then solve for a₀ through a₄. The resulting coefficients define the degree-four interpolating polynomial. section 6.3.5

Listing 6.2 Computing the interpolating polynomial
Vandermonde = Matrix([[xs[i]**j for j in range(N)] for i in range(N)])  #1
Ys = Matrix(ys)                                                         #2
a0, a1, a2, a3, a4 = symbols('a0 a1 a2 a3 a4')
Pol = Matrix([a0, a1, a2, a3, a4])                                      #3
 
solution = solve(Vandermonde*Pol - Ys, (a0, a1, a2, a3, a4))            #4
a = [value for key, value in solution.items()]                          #5

The executable listing shows matrix construction, vector conversion, symbolic coefficient setup, linear-system solving, and coefficient extraction. section 6.3.5

How Geometry for Programmers covers it

How deep it goes
Explains matrix construction and executable solution steps, while deferring detailed numerical robustness and efficiency analysis.
Examples
Uses points (−1, 0), (0, 1), and (1, 0), plus five-point datasets solved with Python and SymPy.
What it assumes
Assumes familiarity with polynomial coefficients and linear systems, while deriving the matrix directly from point equations.
What you can do after
Apply it via SymPy to construct a Vandermonde system and extract interpolating-polynomial coefficients.
How it connects
Connects polynomial interpolation with linear systems, least-squares approximation, and Lagrange interpolation.

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.