# mathlib3documentation

data.nat.choose.multinomial

# Multinomial #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file defines the multinomial coefficient and several small lemma's for manipulating it.

## Main declarations #

• nat.multinomial: the multinomial coefficient

## Main results #

• finest.sum_pow: The expansion of (s.sum x) ^ n using multinomial coefficients
def nat.multinomial {α : Type u_1} (s : finset α) (f : α ) :

The multinomial coefficient. Gives the number of strings consisting of symbols from s, where c ∈ s appears with multiplicity f c.

Defined as (∑ i in s, f i)! / ∏ i in s, (f i)!.

Equations
theorem nat.multinomial_pos {α : Type u_1} (s : finset α) (f : α ) :
0 <
theorem nat.multinomial_spec {α : Type u_1} (s : finset α) (f : α ) :
s.prod (λ (i : α), (f i).factorial) * = (s.sum (λ (i : α), f i)).factorial
@[simp]
theorem nat.multinomial_nil {α : Type u_1} (f : α ) :
@[simp]
theorem nat.multinomial_singleton {α : Type u_1} (f : α ) {a : α} :
f = 1
@[simp]
theorem nat.multinomial_insert_one {α : Type u_1} (s : finset α) (f : α ) {a : α} [decidable_eq α] (h : a s) (h₁ : f a = 1) :
f = (s.sum f).succ *
theorem nat.multinomial_insert {α : Type u_1} (s : finset α) (f : α ) {a : α} [decidable_eq α] (h : a s) :
f = (f a + s.sum f).choose (f a) *
theorem nat.multinomial_congr {α : Type u_1} (s : finset α) {f g : α } (h : (a : α), a s f a = g a) :
=

### Connection to binomial coefficients #

When nat.multinomial is applied to a finset of two elements {a, b}, the result a binomial coefficient. We use binomial in the names of lemmas that involves nat.multinomial {a, b}.

theorem nat.binomial_eq {α : Type u_1} (f : α ) {a b : α} [decidable_eq α] (h : a b) :
nat.multinomial {a, b} f = (f a + f b).factorial / ((f a).factorial * (f b).factorial)
theorem nat.binomial_eq_choose {α : Type u_1} (f : α ) {a b : α} [decidable_eq α] (h : a b) :
nat.multinomial {a, b} f = (f a + f b).choose (f a)
theorem nat.binomial_spec {α : Type u_1} (f : α ) {a b : α} [decidable_eq α] (hab : a b) :
(f a).factorial * (f b).factorial * nat.multinomial {a, b} f = (f a + f b).factorial
@[simp]
theorem nat.binomial_one {α : Type u_1} (f : α ) {a b : α} [decidable_eq α] (h : a b) (h₁ : f a = 1) :
nat.multinomial {a, b} f = (f b).succ
theorem nat.binomial_succ_succ {α : Type u_1} (f : α ) {a b : α} [decidable_eq α] (h : a b) :
nat.multinomial {a, b} (function.update a (f a).succ) b (f b).succ) = nat.multinomial {a, b} a (f a).succ) + nat.multinomial {a, b} b (f b).succ)
theorem nat.succ_mul_binomial {α : Type u_1} (f : α ) {a b : α} [decidable_eq α] (h : a b) :
(f a + f b).succ * nat.multinomial {a, b} f = (f a).succ * nat.multinomial {a, b} a (f a).succ)

### Simple cases #

theorem nat.multinomial_univ_three (a b c : ) :
![a, b, c] = (a + b + c).factorial / (a.factorial * b.factorial * c.factorial)

### Alternative definitions #

def finsupp.multinomial {α : Type u_1} (f : α →₀ ) :

Alternative multinomial definition based on a finsupp, using the support for the big operations

Equations
theorem finsupp.multinomial_eq {α : Type u_1} (f : α →₀ ) :
theorem finsupp.multinomial_update {α : Type u_1} (a : α) (f : α →₀ ) :
f.multinomial = (f.sum (λ (_x : α), id)).choose (f a) * (f.update a 0).multinomial
noncomputable def multiset.multinomial {α : Type u_1} (m : multiset α) :

Alternative definition of multinomial based on multiset delegating to the finsupp definition

Equations
theorem multiset.multinomial_filter_ne {α : Type u_1} [decidable_eq α] (a : α) (m : multiset α) :

### Multinomial theorem #

theorem finset.sum_pow_of_commute {α : Type u_1} [decidable_eq α] (s : finset α) {R : Type u_2} [semiring R] (x : α R) (hc : s.pairwise (λ (i j : α), commute (x i) (x j))) (n : ) :
s.sum x ^ n = finset.univ.sum (λ (k : (s.sym n)), (k.val.val.multinomial) * k.val.val).noncomm_prod _)

The multinomial theorem

Proof is by induction on the number of summands.

theorem finset.sum_pow {α : Type u_1} [decidable_eq α] (s : finset α) {R : Type u_2} (x : α R) (n : ) :
s.sum x ^ n = (s.sym n).sum (λ (k : sym α n), (k.val.multinomial) * k.val).prod)