Vieta's Formulas

lean4-proofalgebrapolynomialsrootsvisualization
x1+x2++xn=an1anx_1 + x_2 + \cdots + x_n = -\frac{a_{n-1}}{a_n}

Statement

For a monic polynomial of degree nn with roots x1,x2,,xnx_1, x_2, \ldots, x_n (counted with multiplicity):

p(x)=xn+an1xn1++a1x+a0=(xx1)(xx2)(xxn)p(x) = x^n + a_{n-1}x^{n-1} + \cdots + a_1 x + a_0 = (x - x_1)(x - x_2)\cdots(x - x_n)

Vieta's formulas relate the coefficients to the elementary symmetric polynomials of the roots:

x1+x2++xn=an1x_1 + x_2 + \cdots + x_n = -a_{n-1}
i<jxixj=an2\sum_{i < j} x_i x_j = a_{n-2}
\vdots
x1x2xn=(1)na0x_1 x_2 \cdots x_n = (-1)^n a_0

For a quadratic ax2+bx+c=a(xx1)(xx2)ax^2 + bx + c = a(x - x_1)(x - x_2):

x1+x2=ba,x1x2=cax_1 + x_2 = -\frac{b}{a}, \qquad x_1 x_2 = \frac{c}{a}

Visualization

Worked cubic: p(x)=x36x2+11x6=(x1)(x2)(x3)p(x) = x^3 - 6x^2 + 11x - 6 = (x-1)(x-2)(x-3)

Roots: x1=1x_1 = 1, x2=2x_2 = 2, x3=3x_3 = 3

Vieta checks:
  Sum of roots:           x₁ + x₂ + x₃ = 1 + 2 + 3 = 6   =  -(-6) = 6  ✓
  Sum of pairwise prods:  x₁x₂ + x₁x₃ + x₂x₃
                          = 2 + 3 + 6 = 11                 = 11           ✓
  Product of roots:       x₁ · x₂ · x₃ = 1·2·3 = 6        = -(-6) = 6   ✓

Coefficients: a3=1a_3=1, a2=6a_2=-6, a1=11a_1=11, a0=6a_0=-6

Vieta relationLHSRHSMatch
e1=x1+x2+x3e_1 = x_1+x_2+x_366a2/a3=6-a_2/a_3 = 6
e2=i<jxixje_2 = \sum_{i<j} x_ix_j1111a1/a3=11a_1/a_3 = 11
e3=x1x2x3e_3 = x_1x_2x_366a0/a3=6-a_0/a_3 = 6

Newton's identity check (sum of squares from Vieta): x12+x22+x32=e122e2=3622=14=1+4+9x_1^2 + x_2^2 + x_3^2 = e_1^2 - 2e_2 = 36 - 22 = 14 = 1+4+9

Proof Sketch

Expand (xx1)(xx2)(xxn)(x - x_1)(x - x_2)\cdots(x - x_n) and collect terms by degree. When distributing nn factors, choosing xx from kk of them and (xi)(-x_i) from the rest produces:

  • Coefficient of xn1x^{n-1}: (x1+x2++xn)-(x_1 + x_2 + \cdots + x_n)
  • Coefficient of xn2x^{n-2}: i<jxixj\sum_{i < j} x_i x_j
  • Constant term: (1)nx1x2xn(-1)^n x_1 x_2 \cdots x_n

Matching with anka_{n-k} yields the formulas. The algebraic identity is the generating-function statement that i=1n(xxi)=k=0n(1)kek(x1,,xn)xnk\prod_{i=1}^n (x - x_i) = \sum_{k=0}^n (-1)^k e_k(x_1,\ldots,x_n) x^{n-k} where eke_k is the kk-th elementary symmetric polynomial.

Connections

  • Quadratic FormulaQuadratic Formulax=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}Solve any quadratic equation using the discriminantRead more → — Vieta for degree 2; b24ac=(x1x2)2a2b^2 - 4ac = (x_1-x_2)^2 a^2 links discriminant to root differences
  • Binomial TheoremBinomial Theorem(x+y)n=k=0n(nk)xkynk(x+y)^n = \sum_{k=0}^{n} \binom{n}{k} x^k y^{n-k}Expanding powers of a sum via binomial coefficientsRead more →(xr)n(x-r)^n is a degenerate Vieta case where all roots coincide
  • AM–GM InequalityAM–GM Inequalitya1++anna1ann\frac{a_1+\cdots+a_n}{n} \geq \sqrt[n]{a_1 \cdots a_n}The arithmetic mean is always at least as large as the geometric meanRead more → — AM–GM on the roots xix_i gives inequalities between the eke_k
  • Cauchy–Schwarz — in the Gram matrix of roots, Cauchy–Schwarz bounds cross-terms of the eke_k
  • Geometric SeriesGeometric Seriesk=0n1xk=xn1x1\sum_{k=0}^{n-1} x^k = \frac{x^n - 1}{x - 1}Partial sums and convergence of the geometric progressionRead more → — roots of xn1=0x^n - 1 = 0 (roots of unity) satisfy e1=0e_1 = 0, en=(1)n+1e_n = (-1)^{n+1}

Lean4 Proof

Mathlib's Polynomial.SmallDegreeVieta (v4.28.0) provides Vieta's formulas for quadratics explicitly. We use eq_neg_mul_add_of_roots_quadratic_eq_pair (sum of roots) and eq_mul_mul_of_roots_quadratic_eq_pair (product of roots).

Lean4 Proof

import Mathlib.RingTheory.Polynomial.SmallDegreeVieta

open Polynomial

/-- Vieta's sum formula for a quadratic ax²+bx+c with roots x₁, x₂:
    b = -a·(x₁+x₂), i.e., x₁+x₂ = -b/a. -/
theorem vieta_sum [CommRing R] [IsDomain R] {a b c x₁ x₂ : R}
    (hroots : (C a * X ^ 2 + C b * X + C c).roots = {x₁, x₂}) :
    b = -a * (x₁ + x₂) :=
  eq_neg_mul_add_of_roots_quadratic_eq_pair hroots

/-- Vieta's product formula for a quadratic ax²+bx+c with roots x₁, x₂:
    c = a·x₁·x₂, i.e., x₁·x₂ = c/a. -/
theorem vieta_product [CommRing R] [IsDomain R] {a b c x₁ x₂ : R}
    (hroots : (C a * X ^ 2 + C b * X + C c).roots = {x₁, x₂}) :
    c = a * x₁ * x₂ :=
  eq_mul_mul_of_roots_quadratic_eq_pair hroots

/-- Combined Vieta iff: roots are {x₁,x₂} iff Vieta relations hold (and a ≠ 0). -/
theorem vieta_quadratic_iff [CommRing R] [IsDomain R] {a b c x₁ x₂ : R} (ha : a  0) :
    (C a * X ^ 2 + C b * X + C c).roots = {x₁, x₂} 
      b = -a * (x₁ + x₂)  c = a * x₁ * x₂ :=
  roots_quadratic_eq_pair_iff_of_ne_zero ha

/-- Concrete instance: x²-5x+6 has roots {2,3} and Vieta checks hold. -/
theorem vieta_example :
    (X ^ 2 - C 5 * X + C 6 : [X]).roots = {2, 3} 
      (-5 : ) = -(1 * (2 + 3))  (6 : ) = 1 * 2 * 3 := by
  constructor
  · intro h; exact by norm_num, by norm_num
  · intro _, _
    simp [roots_quadratic_eq_pair_iff_of_ne_zero (by norm_num : (1:)  0)]
    constructor <;> norm_num