For two polynomials over the complex numbers of equal positive degree of a polynomial with no common root of a polynomial, there are unique polynomials of degree of a polynomial less than such that . To prove the bound, let be the vector space of polynomials of degree of a polynomial at most , including the zero polynomial. The linear map from to has zero kernel of a linear map: if , each root of a polynomial of , counted with its multiplicity of a root, must occur in because it does not occur in , forcing by the degree of a polynomial bound, and then . Both vector spaces have dimension , so the rank-nullity theorem makes the linear map a bijection, and has a unique preimage.
The zero polynomial has no nonzero term, so its degree is either left undefined or assigned a special value such as by convention. A finite program can use as a sentinel when all other stored degrees are nonnegative. That representation sentinel is not a general replacement for the extended-arithmetic degree convention; it is enough for testing whether a polynomial remainder is zero or has smaller degree than a nonzero divisor.
The monomials form a basis of : they span every polynomial of degree of a polynomial at most , and equality of polynomials forces equality of every coefficient, proving linear independence. Therefore
The zero polynomial is included in even though its degree of a polynomial need not be assigned an ordinary nonnegative value.
The polynomial interpolates at the interpolation nodes when
For distinct interpolation nodes, define the Lagrange cardinal polynomials
The denominators are nonzero, each polynomial degree is at most , and , with the Kronecker delta. Therefore
is a Lagrange interpolation polynomial belonging to the vector space of univariate polynomials , and it has all the required sampled values.
If also works, has distinct roots of a polynomial while its polynomial degree is at most . The root bound for a polynomial forces it to be the zero polynomial, proving uniqueness. The phrase “degree ” denotes the allowed maximum; the actual polynomial degree may be smaller. No continuity assumption is needed merely to construct the interpolation polynomial from these finitely many values.
For each interpolation node define the Lagrange cardinal polynomial
All denominators are nonzero because the interpolation nodes are distinct. Each polynomial has polynomial degree at most , and , where is the Kronecker delta. Consequently the linear combination
belongs to the vector space of univariate polynomials and has the required values. This proves existence of the Lagrange interpolation polynomial.
For uniqueness, suppose and both work. Their difference is a polynomial of polynomial degree at most with distinct roots of a polynomial. The root bound for a polynomial forces to be the zero polynomial.
The seven supplied values follow . The quadratic polynomial belongs to and takes all seven values, so uniqueness gives
The subscript bounds the polynomial degree; it does not require polynomial degree exactly six.
Represent the zero polynomial by degree = -1, with an allocated one-element array whose element is zero. Its coefficient prefix is empty; the spare cell is merely convenient storage. For every nonzero polynomial, require degree >= 0, sufficient allocated capacity, and a nonzero leading polynomial coefficient.
PROCEDURE Zero(VAR p: Poly);
BEGIN
  p.degree := -1; NEW(p.coeff, 1); p.coeff[0] := 0.0
END Zero;

PROCEDURE Normalize(VAR p: Poly);
BEGIN
  WHILE p.degree >= 0 DO
    IF p.coeff[p.degree] # 0.0 THEN RETURN END;
    DEC(p.degree)
  END
END Normalize;
Thus
The sentinel is a representation convention, not an assertion that the mathematical degree of the zero polynomial is an ordinary integer. In parts (b)–(e), algebraic correctness uses exact arithmetic on real numbers; ordinary floating-point arithmetic introduces rounding and needs an additional numerical policy if exact zero tests are to be replaced.
Allocate a fresh coefficient array, add matching polynomial coefficients, and normalize to remove any cancellation of leading terms.
PROCEDURE Add(VAR sum: Poly; a, b: Poly);
VAR result: Poly; d, cap, i: INTEGER;
BEGIN
  d := a.degree;
  IF b.degree > d THEN d := b.degree END;
  cap := d+1; IF cap < 1 THEN cap := 1 END;
  result.degree := d; NEW(result.coeff, cap);
  result.coeff[0] := 0.0;
  FOR i := 0 TO d DO
    result.coeff[i] := 0.0;
    IF i <= a.degree THEN
      result.coeff[i] := result.coeff[i] + a.coeff[i]
    END;
    IF i <= b.degree THEN
      result.coeff[i] := result.coeff[i] + b.coeff[i]
    END
  END;
  Normalize(result); sum := result
END Add;
The loop invariant says that every completed coefficient equals the corresponding coefficient of , treating missing coefficients as zero. Normalize changes no represented polynomial, and can reduce the result to the zero polynomial.
Neither input coefficient array is changed. Output variables are separate from input record variables; the fresh result also remains safe when the two inputs share a coefficient array.
Use polynomial convolution. If either input is the zero polynomial, return the zero polynomial immediately.
PROCEDURE Mul(VAR prod: Poly; a, b: Poly);
VAR result: Poly; d, i, j: INTEGER;
BEGIN
  IF (a.degree < 0) OR (b.degree < 0) THEN
    Zero(result)
  ELSE
    d := a.degree+b.degree;
    result.degree := d; NEW(result.coeff, d+1);
    FOR i := 0 TO d DO result.coeff[i] := 0.0 END;
    FOR i := 0 TO a.degree DO
      FOR j := 0 TO b.degree DO
        result.coeff[i+j] := result.coeff[i+j]
                              + a.coeff[i]*b.coeff[j]
      END
    END;
    Normalize(result)
  END;
  prod := result
END Mul;
Each pair of terms contributes , so the final polynomial coefficient of is
With exact arithmetic on real numbers, the product of the leading nonzero polynomial coefficients is nonzero, giving degree . The nested loops implement precisely this sum, preserve the input coefficient arrays, and take time for nonzero inputs.
Require a nonzero divisor. Polynomial long division repeatedly subtracts the multiple of that cancels the leading term of the current polynomial remainder. Use fresh arrays for both outputs.
PROCEDURE DivMod(VAR div, mod: Poly; a, b: Poly);
VAR q, r: Poly; cap, i, j, k, old: INTEGER; t: REAL;
BEGIN
  ASSERT(b.degree >= 0);
  cap := a.degree+1; IF cap < 1 THEN cap := 1 END;
  r.degree := a.degree; NEW(r.coeff, cap);
  r.coeff[0] := 0.0;
  FOR i := 0 TO a.degree DO r.coeff[i] := a.coeff[i] END;
  IF a.degree < b.degree THEN
    Zero(q)
  ELSE
    q.degree := a.degree-b.degree;
    NEW(q.coeff, q.degree+1);
    FOR i := 0 TO q.degree DO q.coeff[i] := 0.0 END;
    WHILE r.degree >= b.degree DO
      old := r.degree; k := old-b.degree;
      t := r.coeff[old]/b.coeff[b.degree];
      q.coeff[k] := q.coeff[k]+t;
      FOR j := 0 TO b.degree-1 DO
        r.coeff[k+j] := r.coeff[k+j]-t*b.coeff[j]
      END;
      r.coeff[old] := 0.0;
      DEC(r.degree); Normalize(r)
    END;
    Normalize(q)
  END;
  div := q; mod := r
END DivMod;
The loop invariant is the polynomial identity . Setting and replaces by and by , preserving this identity. The leading coefficient of that difference is exactly zero, so setting its stored value to zero and decreasing degree implements its exact cancellation. Each iteration strictly decreases the degree of the polynomial remainder.
At termination,
The zero polynomial dividend, a lower-degree dividend, and a constant divisor are all covered. Division by the zero polynomial is undefined. The two output record variables must be distinct and separate from the input record variables; no input coefficient array is written. For , the work is .
Polynomial vector space 2026-10-31
The real polynomials of degree at most , together with the zero polynomial, form a vector space of dimension with basis . Polynomial spaces of lower degree are nested vector subspaces.