Binomial Theorem

lean4-proofalgebracombinatoricspolynomialsvisualization
(x+y)n=k=0n(nk)xkynk(x+y)^n = \sum_{k=0}^{n} \binom{n}{k} x^k y^{n-k}

Statement

For any commutative ring elements xx and yy, and any natural number nn:

(x+y)n=k=0n(nk)xkynk(x + y)^n = \sum_{k=0}^{n} \binom{n}{k} x^k y^{n-k}

where (nk)=n!k!(nk)!\binom{n}{k} = \dfrac{n!}{k!(n-k)!} is the binomial coefficient, counting the number of ways to choose kk items from nn without repetition.

Visualization

Pascal's Triangle (rows 0–6) organises the binomial coefficients. Each entry is the sum of the two entries above it — the Pascal recurrence (nk)=(n1k1)+(n1k)\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}:

Row 0:                    1
Row 1:                  1   1
Row 2:                1   2   1
Row 3:              1   3   3   1
Row 4:            1   4   6   4   1
Row 5:          1   5  10  10   5   1
Row 6:        1   6  15  20  15   6   1

Each row gives the coefficients for (x+y)n(x+y)^n. For example, row 4 yields:

(x+y)4=x4+4x3y+6x2y2+4xy3+y4(x+y)^4 = x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + y^4

Row sum identity: every row sums to 2n2^n (set x=y=1x = y = 1):

nnRow sum2n2^n
01111
11+11+122
21+2+11+2+144
31+3+3+11+3+3+188
41+4+6+4+11+4+6+4+11616
51+5+10+10+5+11+5+10+10+5+13232

Proof Sketch

Combinatorial argument: expanding (x+y)n=(x+y)(x+y)(x+y)(x+y)^n = (x+y)(x+y)\cdots(x+y) (nn factors), we pick either xx or yy from each factor. The term xkynkx^k y^{n-k} arises from exactly (nk)\binom{n}{k} selections (choose which kk of the nn factors contribute an xx). Summing over k=0,,nk = 0,\ldots,n accounts for all terms.

Inductive step: the Pascal recurrence drives the induction:

(n+1k)=(nk1)+(nk)\binom{n+1}{k} = \binom{n}{k-1} + \binom{n}{k}

which corresponds to distributing the extra factor of (x+y)(x+y):

(x+y)n+1=x(x+y)n+y(x+y)n(x+y)^{n+1} = x \cdot (x+y)^n + y \cdot (x+y)^n

Connections

  • Quadratic FormulaQuadratic Formulax=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}Solve any quadratic equation using the discriminantRead more →(x+y)2=x2+2xy+y2(x+y)^2 = x^2 + 2xy + y^2 is the n=2n=2 special case
  • 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 applied to the (nk)\binom{n}{k} terms yields useful norm bounds
  • Cauchy–Schwarz — the square of a sum bound uses the n=2n=2 binomial expansion
  • 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 → — setting y=1y = 1 and letting x1x \to 1 connects to sums of powers
  • Vieta Formulas — the coefficients of (xr1)(xr2)(xrn)(x - r_1)(x - r_2)\cdots(x - r_n) are elementary symmetric polynomials, relatives of binomial coefficients

Lean4 Proof

Mathlib's add_pow in Mathlib.Data.Nat.Choose.Sum provides the binomial theorem directly for CommSemiring. The non-commutative version is Commute.add_pow.

Lean4 Proof

import Mathlib.Data.Nat.Choose.Sum

/-- The Binomial Theorem: (x+y)^n = Σ_{k=0}^{n} x^k · y^{n-k} · C(n,k)
    for commutative semirings. This is `add_pow` in Mathlib. -/
theorem binomial_theorem {R : Type*} [CommSemiring R] (x y : R) (n : ) :
    (x + y) ^ n = ∑ k  Finset.range (n + 1), x ^ k * y ^ (n - k) * (n.choose k : R) :=
  add_pow x y n

/-- The row-sum identity: setting x=y=1 gives 2^n = Σ C(n,k). -/
theorem binomial_row_sum (n : ) :
    2 ^ n = ∑ k  Finset.range (n + 1), n.choose k := by
  have h := binomial_theorem (R := ) 1 1 n
  simp at h
  exact_mod_cast h

/-- Non-commutative version: Commute.add_pow handles semirings where x·y ≠ y·x. -/
theorem binomial_noncomm {R : Type*} [Semiring R] (x y : R) (h : Commute x y) (n : ) :
    (x + y) ^ n = ∑ k  Finset.range (n + 1), x ^ k * y ^ (n - k) * (n.choose k : R) :=
  h.add_pow n