Mathlib.Data.Nat.Choose.Sum
25 declarations. Mathlib docs · Source
Sums of binomial coefficients
This file includes variants of the binomial theorem and other results on sums of binomial coefficients. Theorems whose proofs depend on such sums may also go in this file for import reasons.
theorem Commute.add_pow E1 #
∀ {R : Type u_1} [inst : Semiring R] {x y : R},
Commute x y → ∀ (n : ℕ), (x + y) ^ n = ∑ m ∈ Finset.range (n + 1), x ^ m * y ^ (n - m) * ↑(n.choose m)
A version of the binomial theorem for commuting elements in noncommutative semirings.
theorem Commute.add_pow' E1 #
∀ {R : Type u_1} [inst : Semiring R] {x y : R},
Commute x y → ∀ (n : ℕ), (x + y) ^ n = ∑ m ∈ Finset.HasAntidiagonal.antidiagonal n, n.choose m.1 • (x ^ m.1 * y ^ m.2)
A version of Commute.add_pow that avoids ℕ-subtraction by summing over the antidiagonal and
also with the binomial coefficient applied via scalar action of ℕ.
theorem add_pow E3 #
∀ {R : Type u_1} [inst : CommSemiring R] (x y : R) (n : ℕ),
(x + y) ^ n = ∑ m ∈ Finset.range (n + 1), x ^ m * y ^ (n - m) * ↑(n.choose m)
The binomial theorem
theorem add_pow' E1 #
∀ {R : Type u_1} [inst : CommSemiring R] (x y : R) (n : ℕ),
(x + y) ^ n = ∑ m ∈ Finset.HasAntidiagonal.antidiagonal n, n.choose m.1 • (x ^ m.1 * y ^ m.2)
A version of the binomial theorem that avoids ℕ-subtraction by summing over the antidiagonal and also with the binomial coefficient applied via scalar action of ℕ.
theorem sub_pow E1 #
∀ {R : Type u_1} [inst : CommRing R] (x y : R) (n : ℕ),
(x - y) ^ n = ∑ m ∈ Finset.range (n + 1), (-1) ^ (m + n) * x ^ m * y ^ (n - m) * ↑(n.choose m)
A special case of the binomial theorem
theorem Nat.sum_range_choose E1 #
∀ (n : ℕ), ∑ m ∈ Finset.range (n + 1), n.choose m = 2 ^ n
The sum of entries in a row of Pascal's triangle
theorem Nat.sum_range_choose_halfway E1 #
∀ (m : ℕ), ∑ i ∈ Finset.range (m + 1), (2 * m + 1).choose i = 4 ^ m
theorem Nat.choose_middle_le_pow E1 #
∀ (n : ℕ), (2 * n + 1).choose n ≤ 4 ^ n
theorem Nat.sum_Icc_choose E2 #
∀ (n k : ℕ), ∑ m ∈ Finset.Icc k n, m.choose k = (n + 1).choose (k + 1)
Zhu Shijie's identity aka hockey-stick identity, version with Icc.
theorem Nat.sum_range_add_choose E2 #
∀ (n k : ℕ), ∑ i ∈ Finset.range (n + 1), (i + k).choose k = (n + k + 1).choose (k + 1)
Zhu Shijie's identity aka hockey-stick identity, version with range.
Summing (i + k).choose k for i ∈ [0, n] gives (n + k + 1).choose (k + 1).
Combinatorial interpretation: (i + k).choose k is the number of decompositions of [0, i) in
k + 1 (possibly empty) intervals (this follows from a stars and bars description). In particular,
(n + k + 1).choose (k + 1) corresponds to decomposing [0, n) into k + 2 intervals.
By putting away the last interval (of some length n - i),
we have to decompose the remaining interval [0, i) into k + 1 intervals, hence the sum.
theorem Nat.sum_range_mul_choose E1 #
∀ (n : ℕ), ∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1)
Summing i * (n.choose i) for i ∈ [0, n] gives n * 2 ^ (n - 1).
theorem Nat.sum_range_multichoose E1 #
∀ (n k : ℕ), ∑ i ∈ Finset.range (n + 1), k.multichoose i = (n + k).choose k
theorem Int.alternating_sum_range_choose_eq_choose E1 #
∀ {n m : ℕ}, ∑ k ∈ Finset.range (m + 1), (-1) ^ k * ↑((n + 1).choose k) = (-1) ^ m * ↑(n.choose m)
theorem Int.alternating_sum_range_choose E1 #
∀ {n : ℕ}, ∑ m ∈ Finset.range (n + 1), (-1) ^ m * ↑(n.choose m) = if n = 0 then 1 else 0
theorem Int.alternating_sum_range_choose_of_ne E1 #
∀ {n : ℕ}, n ≠ 0 → ∑ m ∈ Finset.range (n + 1), (-1) ^ m * ↑(n.choose m) = 0
theorem Finset.sum_powerset_apply_card E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : AddCommMonoid α] (f : ℕ → α) {x : Finset β},
∑ m ∈ x.powerset, f m.card = ∑ m ∈ Finset.range (x.card + 1), x.card.choose m • f m
theorem Finset.sum_powerset_neg_one_pow_card E1 #
∀ {α : Type u_2} [inst : DecidableEq α] {x : Finset α}, ∑ m ∈ x.powerset, (-1) ^ m.card = if x = ∅ then 1 else 0
theorem Finset.sum_powerset_neg_one_pow_card_of_nonempty E1 #
∀ {α : Type u_2} {x : Finset α}, x.Nonempty → ∑ m ∈ x.powerset, (-1) ^ m.card = 0
theorem Finset.prod_pow_choose_succ E1 #
∀ {M : Type u_2} [inst : CommMonoid M] (f : ℕ → ℕ → M) (n : ℕ),
∏ i ∈ Finset.range (n + 2), f i (n + 1 - i) ^ (n + 1).choose i =
(∏ i ∈ Finset.range (n + 1), f i (n + 1 - i) ^ n.choose i) *
∏ i ∈ Finset.range (n + 1), f (i + 1) (n - i) ^ n.choose i
theorem Finset.sum_choose_succ_nsmul E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (f : ℕ → ℕ → M) (n : ℕ),
∑ i ∈ Finset.range (n + 2), (n + 1).choose i • f i (n + 1 - i) =
∑ i ∈ Finset.range (n + 1), n.choose i • f i (n + 1 - i) +
∑ i ∈ Finset.range (n + 1), n.choose i • f (i + 1) (n - i)
theorem Finset.sum_antidiagonal_choose_succ_nsmul E1 #
∀ {M : Type u_2} [inst : AddCommMonoid M] (f : ℕ → ℕ → M) (n : ℕ),
∑ ij ∈ Finset.HasAntidiagonal.antidiagonal (n + 1), (n + 1).choose ij.1 • f ij.1 ij.2 =
∑ ij ∈ Finset.HasAntidiagonal.antidiagonal n, n.choose ij.1 • f ij.1 (ij.2 + 1) +
∑ ij ∈ Finset.HasAntidiagonal.antidiagonal n, n.choose ij.2 • f (ij.1 + 1) ij.2
theorem Finset.prod_antidiagonal_pow_choose_succ E1 #
∀ {M : Type u_2} [inst : CommMonoid M] (f : ℕ → ℕ → M) (n : ℕ),
∏ ij ∈ Finset.HasAntidiagonal.antidiagonal (n + 1), f ij.1 ij.2 ^ (n + 1).choose ij.1 =
(∏ ij ∈ Finset.HasAntidiagonal.antidiagonal n, f ij.1 (ij.2 + 1) ^ n.choose ij.1) *
∏ ij ∈ Finset.HasAntidiagonal.antidiagonal n, f (ij.1 + 1) ij.2 ^ n.choose ij.2
theorem Finset.sum_choose_succ_mul E1 #
∀ {R : Type u_1} [inst : NonAssocSemiring R] (f : ℕ → ℕ → R) (n : ℕ),
∑ i ∈ Finset.range (n + 2), ↑((n + 1).choose i) * f i (n + 1 - i) =
∑ i ∈ Finset.range (n + 1), ↑(n.choose i) * f i (n + 1 - i) +
∑ i ∈ Finset.range (n + 1), ↑(n.choose i) * f (i + 1) (n - i)
The sum of (n+1).choose i * f i (n+1-i) can be split into two sums at rank n,
respectively of n.choose i * f i (n+1-i) and n.choose i * f (i+1) (n-i).
theorem Finset.sum_antidiagonal_choose_succ_mul E1 #
∀ {R : Type u_1} [inst : NonAssocSemiring R] (f : ℕ → ℕ → R) (n : ℕ),
∑ ij ∈ Finset.HasAntidiagonal.antidiagonal (n + 1), ↑((n + 1).choose ij.1) * f ij.1 ij.2 =
∑ ij ∈ Finset.HasAntidiagonal.antidiagonal n, ↑(n.choose ij.1) * f ij.1 (ij.2 + 1) +
∑ ij ∈ Finset.HasAntidiagonal.antidiagonal n, ↑(n.choose ij.2) * f (ij.1 + 1) ij.2
The sum along the antidiagonal of (n+1).choose i * f i j can be split into two sums along the
antidiagonal at rank n, respectively of n.choose i * f i (j+1) and n.choose j * f (i+1) j.
theorem Finset.sum_antidiagonal_choose_add E1 #
∀ (d n : ℕ), ∑ ij ∈ Finset.HasAntidiagonal.antidiagonal n, (d + ij.2).choose d = (d + n + 1).choose (d + 1)