Formalization Blueprint for “An Introduction to Algebraic Combinatorics” by Darij Grinberg

5.2 Cauchy–Binet and related formulas

We work over a commutative ring \(K\). We formalize the Cauchy–Binet formula for determinants of products of non-square matrices, the expansion of \(\det (A+B)\) as a sum over pairs of subsets, and several applications: formulas for \(\det (A+D)\) when \(D\) is diagonal, the characteristic polynomial in terms of principal minors, and the determinant of the Pascal matrix via LU decomposition.

Throughout, \([n] = \{ 1,2,\ldots ,n\} \) denotes the set of the first \(n\) positive integers (in the Lean formalization, indexing is \(0\)-based). For any finite set \(S\) of integers we write \(\operatorname {sum} S := \sum _{s \in S} s\).

5.2.1 Submatrices and minors

Definition 5.35
#

Let \(n,m\in \mathbb {N}\). Let \(A\) be an \(n\times m\)-matrix.

Let \(U\) be a subset of \([n]\). Let \(V\) be a subset of \([m]\).

Writing the two sets \(U\) and \(V\) as

\[ U=\{ u_1,u_2,\ldots ,u_p\} \quad \text{and}\quad V=\{ v_1,v_2,\ldots ,v_q\} \]

with

\[ u_1{\lt}u_2{\lt}\cdots {\lt}u_p \quad \text{and}\quad v_1{\lt}v_2{\lt}\cdots {\lt}v_q, \]

we set

\[ \operatorname {sub}_U^V A:=\left(A_{u_i,v_j}\right)_{1\le i\le p,\ 1\le j\le q}. \]

Roughly speaking, \(\operatorname {sub}_U^V A\) is the matrix obtained from \(A\) by focusing only on the \(i\)-th rows for \(i\in U\) (that is, removing all the other rows) and only on the \(j\)-th columns for \(j\in V\) (that is, removing all the other columns).

This matrix \(\operatorname {sub}_U^V A\) is called the submatrix of \(A\) obtained by restricting to the \(U\)-rows and the \(V\)-columns. If this matrix is square (i.e., if \(|U|=|V|\)), then its determinant \(\det (\operatorname {sub}_U^V A)\) is called a minor of \(A\).

Lemma 5.36

The minor of the empty sets is \(1\): \(\det (\operatorname {sub}_{\varnothing }^{\varnothing } A) = 1\).

theorem AlgebraicCombinatorics.CauchyBinet.minor_empty {R : Type u_1} [CommRing R] {n m : } (A : Matrix (Fin n) (Fin m) R) :
Proof

The \(0 \times 0\) matrix has determinant \(1\). This is Mathlib.Matrix.det_isEmpty from Mathlib.

5.2.2 The Cauchy–Binet formula

Helpers for the Cauchy–Binet formula

Lemma 5.37 Non-injective cancellation

Let \(A\in K^{n\times m}\), \(B\in K^{m\times n}\), and let \(f\colon [n]\to [m]\) be a non-injective function. Then

\[ \sum _{\sigma \in S_n} (-1)^{\sigma }\, \prod _{i=1}^n A_{\sigma (i),f(i)}\, B_{f(i),i} = 0. \]
theorem AlgebraicCombinatorics.CauchyBinet.det_mul_aux_nonsquare {R : Type u_1} [CommRing R] {n m : } {A : Matrix (Fin n) (Fin m) R} {B : Matrix (Fin m) (Fin n) R} {f : Fin nFin m} (hf : ¬Function.Injective f) :
σ : Equiv.Perm (Fin n), (Equiv.Perm.sign σ) * i : Fin n, A (σ i) (f i) * B (f i) i = 0
Proof

Since \(f\) is not injective, there exist \(i\ne j\) with \(f(i)=f(j)\). Pairing each \(\sigma \) with \(\sigma \cdot \operatorname {swap}(i,j)\) gives a sign-reversing involution, so the sum cancels to \(0\).

Lemma 5.38 Subset factorization

For a fixed \(n\)-element subset \(S\subseteq [m]\),

\[ \sum _{\tau \in S_n}\sum _{\sigma \in S_n} (-1)^{\sigma }\prod _{i=1}^n A_{\sigma (i),S_{\tau (i)}}\, B_{S_{\tau (i)},i} = \det (\operatorname {cols}_S A)\cdot \det (\operatorname {rows}_S B), \]

where \(S_k\) denotes the \(k\)-th element of \(S\) in sorted order.

theorem AlgebraicCombinatorics.CauchyBinet.sum_over_subset_eq_det_mul {R : Type u_1} [CommRing R] {n m : } (A : Matrix (Fin n) (Fin m) R) (B : Matrix (Fin m) (Fin n) R) (S : Finset (Fin m)) (hcard : S.card = n) :
τ : Equiv.Perm (Fin n), σ : Equiv.Perm (Fin n), (Equiv.Perm.sign σ) * i : Fin n, A (σ i) ((S.orderEmbOfFin hcard) (τ i)) * B ((S.orderEmbOfFin hcard) (τ i)) i = (colsSubmatrix A S hcard).det * (rowsSubmatrix B S hcard).det
Proof

Split the product \(\prod _i A_{\sigma (i),e(\tau (i))}\, B_{e(\tau (i)),i}\) into a product of \(A\)-factors and a product of \(B\)-factors. The \(B\)-factors depend only on \(\tau \) and can be pulled out of the \(\sigma \)-sum. The remaining \(\sigma \)-sum is a Leibniz expansion for \(\det (\operatorname {cols}_S A)\), and summing the \(\tau \)-terms gives \(\det (\operatorname {rows}_S B)\).

Theorem 5.39 Cauchy–Binet formula

Let \(n,m\in \mathbb {N}\). Let \(A\in K^{n\times m}\) be an \(n\times m\)-matrix, and let \(B\in K^{m\times n}\) be an \(m\times n\)-matrix. Then,

\[ \det (AB) = \sum _{\substack{[(, g, _, 1, ,, g, _, 2, ,, \ldots , ,, g, _, n, ), \in , [, m, ], ^, n, ;, \\ , , g, _, 1, {\lt}, g, _, 2, {\lt}, \cdots , {\lt}, g, _, n]}} \det (\operatorname {cols}_{g_1,g_2,\ldots ,g_n} A) \cdot \det (\operatorname {rows}_{g_1,g_2,\ldots ,g_n} B). \]

Here, \(\operatorname {cols}_{g_1,\ldots ,g_n} A\) is the \(n\times n\)-matrix obtained from \(A\) by keeping only columns \(g_1,g_2,\ldots ,g_n\), and \(\operatorname {rows}_{g_1,\ldots ,g_n} B\) is the \(n\times n\)-matrix obtained from \(B\) by keeping only rows \(g_1,g_2,\ldots ,g_n\).

Equivalently, the sum runs over all \(n\)-element subsets \(S\) of \([m]\):

\[ \det (AB) = \sum _{\substack{[S, , \subseteq , [, m, ], , \\ , , |, S, |, =, n]}} \det (\operatorname {cols}_S A) \cdot \det (\operatorname {rows}_S B). \]
theorem AlgebraicCombinatorics.CauchyBinet.cauchyBinet {R : Type u_1} [CommRing R] {n m : } (A : Matrix (Fin n) (Fin m) R) (B : Matrix (Fin m) (Fin n) R) :
(A * B).det = SFinset.powersetCard n Finset.univ, if h : S.card = n then (colsSubmatrix A S h).det * (rowsSubmatrix B S h).det else 0
Proof

The proof expands \(\det (AB)\) via the Leibniz formula:

\[ \det (AB) = \sum _{\sigma \in S_n} (-1)^{\sigma } \prod _{i=1}^n (AB)_{\sigma (i),i} = \sum _{\sigma \in S_n} (-1)^{\sigma } \prod _{i=1}^n \sum _{k=1}^m A_{\sigma (i),k} B_{k,i}. \]

Expanding the product over \(i\) as a sum over functions \(f\colon [n]\to [m]\) and swapping sums gives

\[ \det (AB) = \sum _{f\colon [n]\to [m]} \sum _{\sigma \in S_n} (-1)^{\sigma } \prod _{i=1}^n A_{\sigma (i),f(i)} B_{f(i),i}. \]

When \(f\) is not injective, the inner sum vanishes by Lemma 5.37.

Therefore only injective \(f\) contribute. Each injective \(f\) has image \(S = \operatorname {im}(f)\) with \(|S|=n\). The injective functions with a given image \(S\) are in bijection with permutations of \([n]\). Partitioning by \(S\) and reindexing via this bijection, the sum transforms into a sum over \(n\)-element subsets \(S\), and for each \(S\) the inner sum factors as \(\det (\operatorname {cols}_S A)\cdot \det (\operatorname {rows}_S B)\) by Lemma 5.38.

Theorem 5.40 Cauchy–Binet for square matrices

When \(m=n\), the Cauchy–Binet formula specializes to \(\det (AB) = \det A \cdot \det B\).

theorem AlgebraicCombinatorics.CauchyBinet.cauchyBinet_square {R : Type u_1} [CommRing R] {n : Type u_2} [DecidableEq n] [Fintype n] (A B : Matrix n n R) :
(A * B).det = A.det * B.det
Proof

This is Mathlib’s Matrix.det_mul.

5.2.3 The formula for \(\det (A+B)\)

Basic definitions

Definition 5.41 Subset sum and permutation sets
#

For a subset \(P\subseteq [n]\), define \(\operatorname {sum}(P) = \sum _{i\in P} i\).

For subsets \(P,Q\subseteq [n]\), define \(\operatorname {Perm}(P,Q) = \{ \sigma \in S_n : \sigma (P)=Q\} \) where \(\sigma (P) = \{ \sigma (i) \mid i \in P\} \) denotes the image of \(P\) under \(\sigma \).

Lemma 5.42

If \(|P| \ne |Q|\), then \(\operatorname {Perm}(P,Q) = \varnothing \).

Proof

A permutation is a bijection, so \(|\sigma (P)| = |P|\). If \(|P|\ne |Q|\) then \(\sigma (P) \ne Q\) for all \(\sigma \).

Expansion steps

Lemma 5.43

For a permutation \(\sigma \in S_n\) and a subset \(P\subseteq [n]\), \(\sigma (\overline{P}) = \overline{\sigma (P)}\).

Proof

Since \(\sigma \) is a bijection on \([n]\), the complement is preserved.

Permutation decomposition infrastructure

The proof of Theorem 5.61 requires decomposing permutations \(\sigma \in S_n\) with \(\sigma (P) = Q\) into independent parts acting on \(P\) and on \(\overline{P}\).

Definition 5.44 Extraction of component permutations
#

Let \(P,Q\subseteq [n]\) with \(|P|=|Q|=k\) and let \(\sigma \in S_n\) satisfy \(\sigma (P) = Q\). Write the elements of \(P\) in increasing order as \(p_1 {\lt} \cdots {\lt} p_k\), of \(Q\) as \(q_1 {\lt} \cdots {\lt} q_k\), of \(\overline{P}\) as \(p'_1 {\lt} \cdots {\lt} p'_\ell \), and of \(\overline{Q}\) as \(q'_1 {\lt} \cdots {\lt} q'_\ell \).

Define \(\alpha _\sigma \in S_k\) by \(\sigma (p_i) = q_{\alpha _\sigma (i)}\) and \(\beta _\sigma \in S_\ell \) by \(\sigma (p'_i) = q'_{\beta _\sigma (i)}\).

noncomputable def AlgebraicCombinatorics.CauchyBinet.extractAlpha {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) :
noncomputable def AlgebraicCombinatorics.CauchyBinet.extractBeta {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) :
Definition 5.45 Construction of permutation from components
#

Given \(P,Q\subseteq [n]\) with \(|P|=|Q|\) and permutations \(\alpha \in S_k\), \(\beta \in S_\ell \) (with \(k=|P|\), \(\ell =|\overline{P}|\)), define \(\sigma \in S_n\) by:

\[ \sigma (p_i) = q_{\alpha (i)} \quad \text{and}\quad \sigma (p'_i) = q'_{\beta (i)}. \]

This is the inverse of the map \(\sigma \mapsto (\alpha _\sigma ,\beta _\sigma )\).

noncomputable def AlgebraicCombinatorics.CauchyBinet.constructSigma {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (α : Equiv.Perm (Fin P.card)) (β : Equiv.Perm (Fin P.card)) :
  • One or more equations did not get rendered due to their size.
theorem AlgebraicCombinatorics.CauchyBinet.constructSigma_imageFinset {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (α : Equiv.Perm (Fin P.card)) (β : Equiv.Perm (Fin P.card)) :
imageFinset (constructSigma P Q hcard α β) P = Q
Lemma 5.46 Round-trip properties

The maps \(\sigma \mapsto (\alpha _\sigma , \beta _\sigma )\) and \((\alpha ,\beta ) \mapsto \sigma _{(\alpha ,\beta )}\) are mutual inverses:

  1. Extracting \(\alpha \) from the permutation constructed from \((\alpha ,\beta )\) returns \(\alpha \).

  2. Extracting \(\beta \) from the permutation constructed from \((\alpha ,\beta )\) returns \(\beta \).

  3. Constructing a permutation from the components \((\alpha _\sigma , \beta _\sigma )\) extracted from \(\sigma \) returns \(\sigma \).

theorem AlgebraicCombinatorics.CauchyBinet.extractAlpha_constructSigma {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (α : Equiv.Perm (Fin P.card)) (β : Equiv.Perm (Fin P.card)) ( : imageFinset (constructSigma P Q hcard α β) P = Q) :
extractAlpha P Q hcard (constructSigma P Q hcard α β) = α
theorem AlgebraicCombinatorics.CauchyBinet.extractBeta_constructSigma {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (α : Equiv.Perm (Fin P.card)) (β : Equiv.Perm (Fin P.card)) ( : imageFinset (constructSigma P Q hcard α β) P = Q) :
extractBeta P Q hcard (constructSigma P Q hcard α β) = β
theorem AlgebraicCombinatorics.CauchyBinet.constructSigma_extract {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) :
constructSigma P Q hcard (extractAlpha P Q hcard σ ) (extractBeta P Q hcard σ ) = σ
Proof

By unfolding the definitions and showing that the sorted-order embeddings and their inverses compose to the identity.

Lemma 5.47 Extract specification

For \(\sigma \) with \(\sigma (P) = Q\):

  1. \(\sigma (p_j) = q_{\alpha _\sigma (j)}\) for all \(j\),

  2. \(\sigma (p'_j) = q'_{\beta _\sigma (j)}\) for all \(j\).

theorem AlgebraicCombinatorics.CauchyBinet.extractAlpha_spec {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) (j : Fin P.card) :
σ ((P.orderEmbOfFin ) j) = (Q.orderEmbOfFin ) ((extractAlpha P Q hcard σ ) j)
theorem AlgebraicCombinatorics.CauchyBinet.extractBeta_spec {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) (j : Fin P.card) :
σ ((P.orderEmbOfFin ) j) = (Q.orderEmbOfFin ) ((extractBeta P Q hcard σ ) j)
Proof

By definition of \(\alpha _\sigma \) and \(\beta _\sigma \), using the order-embedding properties of sorted finsets.

Lemma 5.48 Product factorization via extract

For \(\sigma \) with \(\sigma (P) = Q\):

  1. \(\displaystyle \prod _{i\in P} A_{\sigma (i),i} = \prod _{j=1}^{k} A_{q_{\alpha (j)},\, p_j}\),

  2. \(\displaystyle \prod _{i\in \overline{P}} B_{\sigma (i),i} = \prod _{j=1}^{\ell } B_{q'_{\beta (j)},\, p'_j}\).

theorem AlgebraicCombinatorics.CauchyBinet.prod_P_eq_submatrix_det {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) :
iP, A (σ i) i = j : Fin P.card, A ((Q.orderEmbOfFin ) ((extractAlpha P Q hcard σ ) j)) ((P.orderEmbOfFin ) j)
theorem AlgebraicCombinatorics.CauchyBinet.prod_Pc_eq_submatrix_det {R : Type u_1} [CommRing R] {n : } (B : Matrix (Fin n) (Fin n) R) (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) :
iP, B (σ i) i = j : Fin P.card, B ((Q.orderEmbOfFin ) ((extractBeta P Q hcard σ ) j)) ((P.orderEmbOfFin ) j)
Proof

Reindex the product over sorted elements of \(P\) (resp. \(\overline{P}\)) using Lemma 5.47.

Sign decomposition infrastructure

The sign decomposition (Lemma 5.59) is proved by reducing any \((P,Q)\) to the base case \(P = Q = [k]\) via “left shifts” and “left co-shifts.”

Lemma 5.49 Shift existence

Let \(0 {\lt} k {\lt} n\) and let \(P\subseteq [n]\) with \(|P| = k\) and \(P \ne [k]\). Then there exists \(i\) such that \(i \notin P\) and \(i+1 \in P\) (with \(i+1 {\lt} n\)).

theorem AlgebraicCombinatorics.CauchyBinet.exists_shift_opportunity {n k : } (hk : k n) (hk_pos : 0 < k) (_hn : k < n) (P : Finset (Fin n)) (hcard : P.card = k) (hne : P prefixFinset n k hk) :
∃ (i : Fin n) (hi : i + 1 < n), iP i + 1, hi P
Proof

If \(P = [k]\) (the first \(k\) elements), then \(P\) is already the prefix. Otherwise, some element of \(P\) is “too large,” meaning there exists \(j\) with \(p_j {\gt} j\) (the \(j\)-th smallest element is above position \(j\)). A downward-closure argument produces the required adjacent pair.

Lemma 5.50 Sum decrement under shift

If \(i\notin P\) and \(i+1\in P\), let \(P' = s_i(P)\) where \(s_i = \operatorname {swap}(i,i+1)\). Then \(\operatorname {sum}(P') = \operatorname {sum}(P) - 1\).

theorem AlgebraicCombinatorics.CauchyBinet.finsetSumFin_swap_of_left_shift {n : } (P : Finset (Fin n)) (i : Fin n) (hi : i + 1 < n) (hi_notP : iP) (hiplus_P : i + 1, hi P) :
Proof

\(P'\) is obtained from \(P\) by replacing \(i+1\) with \(i\), so the sum decreases by \((i+1)-i = 1\).

Lemma 5.51 Combined sign preserved under left shift

If \(i\notin P\) and \(i+1\in P\), let \(P' = s_i(P)\) and \(\sigma ' = \sigma \cdot s_i\). Then

\[ (-1)^{\operatorname {sum} P' + \operatorname {sum} Q}\cdot (-1)^{\sigma '} = (-1)^{\operatorname {sum} P + \operatorname {sum} Q}\cdot (-1)^{\sigma }. \]
theorem AlgebraicCombinatorics.CauchyBinet.leftShift_preserves_combined_sign {n : } (P Q : Finset (Fin n)) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) (i : Fin n) (hi : i + 1 < n) (hi_notP : iP) (hiplus_P : i + 1, hi P) :
have P' := imageFinset (Equiv.swap i i + 1, hi) P; have σ' := σ * Equiv.swap i i + 1, hi; have Q' := imageFinset σ' P'; (-1) ^ (finsetSumFin P' + finsetSumFin Q') * (Equiv.Perm.sign σ') = (-1) ^ (finsetSumFin P + finsetSumFin Q) * (Equiv.Perm.sign σ)
Proof

\((-1)^{\sigma '} = (-1)^{\sigma }\cdot (-1)^{s_i} = -(-1)^{\sigma }\) (since adjacent transpositions are odd), and \((-1)^{\operatorname {sum} P'} = -(-1)^{\operatorname {sum} P}\) (since \(\operatorname {sum} P' = \operatorname {sum} P - 1\) by Lemma 5.50). The two sign flips cancel.

Lemma 5.52 Extract preserved under left shift

Under the left shift \(P' = s_i(P)\), \(\sigma ' = \sigma \cdot s_i\):

  1. \((-1)^{\alpha _{\sigma '}} = (-1)^{\alpha _\sigma }\),

  2. \((-1)^{\beta _{\sigma '}} = (-1)^{\beta _\sigma }\).

theorem AlgebraicCombinatorics.CauchyBinet.extractAlpha_leftShift_eq {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) (i : Fin n) (hi : i + 1 < n) (hi_notP : iP) (hiplus_P : i + 1, hi P) :
let s := Equiv.swap i i + 1, hi; let P' := imageFinset s P; let σ' := σ * s; have hcard' := ; have hσ' := ; (Equiv.Perm.sign (extractAlpha P' Q hcard' σ' hσ')) = (Equiv.Perm.sign (extractAlpha P Q hcard σ ))
theorem AlgebraicCombinatorics.CauchyBinet.extractBeta_leftShift_eq {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) (i : Fin n) (hi : i + 1 < n) (hi_notP : iP) (hiplus_P : i + 1, hi P) :
let s := Equiv.swap i i + 1, hi; let P' := imageFinset s P; let σ' := σ * s; have hcard' := ; have hσ' := ; (Equiv.Perm.sign (extractBeta P' Q hcard' σ' hσ')) = (Equiv.Perm.sign (extractBeta P Q hcard σ ))
Proof

The sorted order of \(P'\) is \(s_i\) applied to the sorted order of \(P\) (since replacing \(i{+}1\) by \(i\) preserves relative order among all other elements). Therefore \(\sigma '(P'_j) = \sigma (s_i(s_i(P_j))) = \sigma (P_j)\), so \(\alpha _{\sigma '} = \alpha _\sigma \) (and similarly for \(\beta \)).

Lemma 5.53 Left shift invariance

If the sign decomposition formula holds for \((P', Q, \sigma ')\) (where \(P' = s_i(P)\), \(\sigma ' = \sigma \cdot s_i\)), then it holds for \((P, Q, \sigma )\).

theorem AlgebraicCombinatorics.CauchyBinet.sign_decomposition_leftShift_invariant {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) (i : Fin n) (hi : i + 1 < n) (hi_notP : iP) (hiplus_P : i + 1, hi P) :
let s := Equiv.swap i i + 1, hi; let P' := imageFinset s P; let σ' := σ * s; have hcard' := ; have hσ' := ; (Equiv.Perm.sign σ') = (-1) ^ (finsetSumFin P' + finsetSumFin Q) * (Equiv.Perm.sign (extractAlpha P' Q hcard' σ' hσ')) * (Equiv.Perm.sign (extractBeta P' Q hcard' σ' hσ'))(Equiv.Perm.sign σ) = (-1) ^ (finsetSumFin P + finsetSumFin Q) * (Equiv.Perm.sign (extractAlpha P Q hcard σ )) * (Equiv.Perm.sign (extractBeta P Q hcard σ ))
Proof

Combine Lemma 5.51 (combined sign preserved) with Lemma 5.52 (\(\alpha \) and \(\beta \) signs preserved).

Lemma 5.54 Left co-shift invariance

If the sign decomposition formula holds for \((P, Q', \sigma ')\) (where \(Q' = s_i(Q)\), \(\sigma ' = s_i\cdot \sigma \) for \(i\notin Q\), \(i{+}1\in Q\)), then it holds for \((P, Q, \sigma )\).

theorem AlgebraicCombinatorics.CauchyBinet.sign_decomposition_leftCoShift_invariant {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) (i : Fin n) (hi : i + 1 < n) (hi_notQ : iQ) (hiplus_Q : i + 1, hi Q) :
let s := Equiv.swap i i + 1, hi; let Q' := imageFinset s Q; let σ' := s * σ; have hcard' := ; have hσ' := ; (Equiv.Perm.sign σ') = (-1) ^ (finsetSumFin P + finsetSumFin Q') * (Equiv.Perm.sign (extractAlpha P Q' hcard' σ' hσ')) * (Equiv.Perm.sign (extractBeta P Q' hcard' σ' hσ'))(Equiv.Perm.sign σ) = (-1) ^ (finsetSumFin P + finsetSumFin Q) * (Equiv.Perm.sign (extractAlpha P Q hcard σ )) * (Equiv.Perm.sign (extractBeta P Q hcard σ ))
Proof

Analogous to Lemma 5.53: the combined sign is preserved under left co-shifts, and the extracted component permutations \(\alpha \) and \(\beta \) are unchanged.

Lemma 5.55 Sign decomposition base case

When \(P = Q = [k]\) (the prefix finset), the sign decomposition formula

\[ (-1)^{\sigma } = (-1)^{\operatorname {sum}[k]+\operatorname {sum}[k]} \cdot (-1)^{\alpha _\sigma }\cdot (-1)^{\beta _\sigma } = (-1)^{\alpha _\sigma }\cdot (-1)^{\beta _\sigma } \]

holds, where the sign factor vanishes because \(\operatorname {sum}[k] + \operatorname {sum}[k] = k(k-1)\) is even.

theorem AlgebraicCombinatorics.CauchyBinet.sign_decomposition_prefix {n k : } (hk : k n) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ (prefixFinset n k hk) = prefixFinset n k hk) :
let P := prefixFinset n k hk; (Equiv.Perm.sign σ) = (-1) ^ (finsetSumFin P + finsetSumFin P) * (Equiv.Perm.sign (extractAlpha P P σ )) * (Equiv.Perm.sign (extractBeta P P σ ))
Proof

Since \(\sigma \) preserves \([k]\), it decomposes as \(\sigma = \alpha \oplus \beta \) (a direct sum of the restrictions to \([k]\) and its complement). The sign of a direct sum satisfies \((-1)^\sigma = (-1)^\alpha \cdot (-1)^\beta \) (this is Equiv.Perm.sign_subtypeCongr from Mathlib). The factor \((-1)^{k(k-1)} = 1\) since \(k(k-1)\) is even.

Lemma 5.56

For \(n\times n\)-matrices \(A\) and \(B\),

\[ \det (A+B) = \sum _{\sigma \in S_n} (-1)^{\sigma } \sum _{P\subseteq [n]} \Bigl(\prod _{i\in P} A_{\sigma (i),i}\Bigr) \Bigl(\prod _{i\in \overline{P}} B_{\sigma (i),i}\Bigr). \]
theorem AlgebraicCombinatorics.CauchyBinet.det_add_expand_step1 {R : Type u_1} [CommRing R] {n : } (A B : Matrix (Fin n) (Fin n) R) :
(A + B).det = σ : Equiv.Perm (Fin n), Equiv.Perm.sign σ P : Finset (Fin n), (∏ iP, A (σ i) i) * iP, B (σ i) i
Proof

Expand \(\det (A+B) = \sum _{\sigma } (-1)^{\sigma } \prod _i (A_{\sigma (i),i} + B_{\sigma (i),i})\) and distribute each factor using the product rule for sums (this is Fintype.prod_add from Mathlib).

Lemma 5.57

Swapping summation order:

\[ \det (A+B) = \sum _{P\subseteq [n]} \sum _{\sigma \in S_n} (-1)^{\sigma } \Bigl(\prod _{i\in P} A_{\sigma (i),i}\Bigr) \Bigl(\prod _{i\in \overline{P}} B_{\sigma (i),i}\Bigr). \]
theorem AlgebraicCombinatorics.CauchyBinet.det_add_expand_step2 {R : Type u_1} [CommRing R] {n : } (A B : Matrix (Fin n) (Fin n) R) :
(A + B).det = P : Finset (Fin n), σ : Equiv.Perm (Fin n), Equiv.Perm.sign σ ((∏ iP, A (σ i) i) * iP, B (σ i) i)
Proof

By swapping the order of summation (this is Finset.sum_comm from Mathlib).

Lemma 5.58

Partitioning by \(Q = \sigma (P)\):

\[ \det (A+B) = \sum _{P\subseteq [n]} \sum _{Q\subseteq [n]} \sum _{\substack{[\sigma , \in , S, _, n, ;, \\ , , \sigma , (, P, ), , =, , Q]}} (-1)^{\sigma } \Bigl(\prod _{i\in P} A_{\sigma (i),i}\Bigr) \Bigl(\prod _{i\in \overline{P}} B_{\sigma (i),i}\Bigr). \]
theorem AlgebraicCombinatorics.CauchyBinet.det_add_expand_step3 {R : Type u_1} [CommRing R] {n : } (A B : Matrix (Fin n) (Fin n) R) :
(A + B).det = P : Finset (Fin n), Q : Finset (Fin n), σpermsMapping P Q, Equiv.Perm.sign σ ((∏ iP, A (σ i) i) * iP, B (σ i) i)
Proof

Split \(\sum _{\sigma \in S_n}\) according to the value of \(Q = \sigma (P)\), using pairwise disjointness of the fibers.

Lemma 5.59 Sign decomposition

Let \(P,Q\subseteq [n]\) with \(|P|=|Q|\) and let \(\sigma \in S_n\) satisfy \(\sigma (P)=Q\). Write the elements of \(P\) in increasing order as \(p_1{\lt}p_2{\lt}\cdots {\lt}p_k\), the elements of \(Q\) as \(q_1{\lt}q_2{\lt}\cdots {\lt}q_k\), the elements of \(\overline{P}\) as \(p'_1{\lt}\cdots {\lt}p'_{\ell }\), and those of \(\overline{Q}\) as \(q'_1{\lt}\cdots {\lt}q'_{\ell }\).

Define \(\alpha _{\sigma }\in S_k\) by \(\sigma (p_i) = q_{\alpha _{\sigma }(i)}\) and \(\beta _{\sigma }\in S_{\ell }\) by \(\sigma (p'_i) = q'_{\beta _{\sigma }(i)}\).

Then

\[ (-1)^{\sigma } = (-1)^{\operatorname {sum} P + \operatorname {sum} Q} \cdot (-1)^{\alpha _{\sigma }} \cdot (-1)^{\beta _{\sigma }}. \]
theorem AlgebraicCombinatorics.CauchyBinet.sign_decomposition {n : } (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (σ : Equiv.Perm (Fin n)) ( : imageFinset σ P = Q) :
(Equiv.Perm.sign σ) = (-1) ^ (finsetSumFin P + finsetSumFin Q) * (Equiv.Perm.sign (extractAlpha P Q hcard σ )) * (Equiv.Perm.sign (extractBeta P Q hcard σ ))
Proof

The proof uses strong induction on \(\operatorname {sum} P + \operatorname {sum} Q\).

Base case. When \(P = Q = [k]\), the formula holds by Lemma 5.55.

Inductive case. If \(P \ne [k]\), Lemma 5.49 provides an index \(i\) with \(i\notin P\) and \(i+1\in P\). The left shift \(P' = s_i(P)\), \(\sigma ' = \sigma \cdot s_i\) reduces \(\operatorname {sum} P\) by \(1\), so the induction hypothesis applies to \((P', Q, \sigma ')\). Lemma 5.53 lifts the result back to \((P, Q, \sigma )\).

Similarly, if \(P = [k]\) but \(Q \ne [k]\), Lemma 5.49 applied to \(Q\) gives an index for a left co-shift, and Lemma 5.54 lifts the result.

Lemma 5.60 Key factorization

For fixed subsets \(P,Q\subseteq [n]\) with \(|P|=|Q|\):

\[ \sum _{\substack{[\sigma , \in , S, _, n, ;, \\ , , \sigma , (, P, ), =, Q]}} (-1)^{\sigma } \Bigl(\prod _{i\in P} A_{\sigma (i),i}\Bigr) \Bigl(\prod _{i\in \overline{P}} B_{\sigma (i),i}\Bigr) = (-1)^{\operatorname {sum} P + \operatorname {sum} Q} \det (\operatorname {sub}_P^Q A) \cdot \det (\operatorname {sub}_{\overline{P}}^{\overline{Q}} B). \]
theorem AlgebraicCombinatorics.CauchyBinet.sum_perms_mapping_eq_det_product {R : Type u_1} [CommRing R] {n : } (A B : Matrix (Fin n) (Fin n) R) (P Q : Finset (Fin n)) (hcard : P.card = Q.card) :
σpermsMapping P Q, Equiv.Perm.sign σ ((∏ iP, A (σ i) i) * iP, B (σ i) i) = (-1) ^ (finsetSumFin P + finsetSumFin Q) * submatrixDet A Q P * submatrixDet B Q P
Proof

The proof uses the bijection \(\sigma \mapsto (\alpha _{\sigma }, \beta _{\sigma })\) (Definition 5.44) from \(\{ \sigma \in S_n : \sigma (P) = Q\} \) to \(S_k \times S_{\ell }\), with inverse given by the construction in Definition 5.45. The round-trip properties (Lemma 5.46) establish that this is a bijection.

After reindexing by \((\alpha ,\beta )\):

  1. The sign identity (Lemma 5.59) gives \((-1)^{\sigma } = (-1)^{\operatorname {sum} P+\operatorname {sum} Q} \cdot (-1)^{\alpha }\cdot (-1)^{\beta }\).

  2. The products over \(P\) and \(\overline{P}\) factor (Lemma 5.48).

  3. The double sum \(\sum _{\alpha }\sum _{\beta }\) factors into a product of two Leibniz expansions, giving \(\det (\operatorname {sub}_P^Q A)\cdot \det (\operatorname {sub}_{\overline{P}}^{\overline{Q}} B)\).

Theorem 5.61

Let \(n\in \mathbb {N}\). For any subset \(I\) of \([n]\), let \(\widetilde{I} = [n]\setminus I\) denote its complement.

Let \(A\) and \(B\) be two \(n\times n\)-matrices in \(K^{n\times n}\). Then,

\[ \det (A+B) = \sum _{P\subseteq [n]}\; \; \sum _{\substack{[Q, \subseteq , [, n, ], ;, \\ , , |, P, |, =, |, Q, |]}} (-1)^{\operatorname {sum} P + \operatorname {sum} Q} \det (\operatorname {sub}_P^Q A) \cdot \det (\operatorname {sub}_{\widetilde{P}}^{\widetilde{Q}} B). \]
theorem AlgebraicCombinatorics.CauchyBinet.det_add_sum {R : Type u_1} [CommRing R] {n : } (A B : Matrix (Fin n) (Fin n) R) :
(A + B).det = P : Finset (Fin n), Q : Finset (Fin n), if h : Q.card = P.card then (-1) ^ (finsetSumFin P + finsetSumFin Q) * submatrixDet A Q P h * submatrixDet B Q P else 0
Proof

The expansion from Lemma 5.58 gives a triple sum \(\sum _P \sum _Q \sum _{\sigma :\sigma (P)=Q}\). Applying Lemma 5.60 to each inner sum collapses the \(\sigma \)-sum. When \(|P| \ne |Q|\), the set of permutations mapping \(P\) to \(Q\) is empty (Lemma 5.42), so the contribution is \(0\).

5.2.4 Minors of diagonal matrices

Lemma 5.62

Let \(n\in \mathbb {N}\). Let \(d_1,d_2,\ldots ,d_n\in K\). Let

\[ D:=\operatorname {diag}(d_1,d_2,\ldots ,d_n) =\begin{pmatrix} d_1 & 0 & \cdots & 0 \\ 0 & d_2 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & d_n \end{pmatrix}\in K^{n\times n}. \]

(a) We have \(\det (\operatorname {sub}_P^P D) = \prod _{i\in P} d_i\) for any subset \(P\) of \([n]\).

(b) Let \(P\) and \(Q\) be two distinct subsets of \([n]\) satisfying \(|P|=|Q|\). Then, \(\det (\operatorname {sub}_P^Q D) = 0\).

theorem AlgebraicCombinatorics.CauchyBinet.det_diagonal_submatrix_eq {R : Type u_1} [CommRing R] {n : } (d : Fin nR) (P : Finset (Fin n)) :
((Matrix.diagonal d).submatrix (P.orderEmbOfFin ) (P.orderEmbOfFin )).det = iP, d i
theorem AlgebraicCombinatorics.CauchyBinet.det_diagonal_submatrix_off_diag {R : Type u_1} [CommRing R] {n : } (d : Fin nR) (P Q : Finset (Fin n)) (hcard : P.card = Q.card) (hne : P Q) :
Proof

(a) The submatrix \(\operatorname {sub}_P^P D\) is itself diagonal with entries \(d_i\) for \(i\in P\). Thus its determinant is \(\prod _{i\in P} d_i\).

The submatrix of a diagonal matrix via an order-preserving embedding is again diagonal; then the determinant of a diagonal matrix is the product of its diagonal entries (this is Matrix.det_diagonal from Mathlib).

(b) Since \(P\ne Q\) but \(|P|=|Q|\), there exists \(i\in P\setminus Q\). The row of \(\operatorname {sub}_P^Q D\) corresponding to \(i\) is all zeros (since \(D_{i,j}=0\) for \(j\ne i\) and \(i\notin Q\)), so the determinant is \(0\) (by Matrix.det_eq_zero_of_row_eq_zero from Mathlib).

5.2.5 Determinant of \(A+D\)

Theorem 5.63

Let \(n\in \mathbb {N}\). Let \(A\) and \(D\) be two \(n\times n\)-matrices in \(K^{n\times n}\) such that the matrix \(D\) is diagonal. Let \(d_1,d_2,\ldots ,d_n\) be the diagonal entries of the diagonal matrix \(D\). Then,

\[ \det (A+D) = \sum _{P\subseteq [n]} \det (\operatorname {sub}_P^P A) \cdot \prod _{i\in [n]\setminus P} d_i. \]

The minors \(\det (\operatorname {sub}_P^P A)\) are called the principal minors of \(A\).

theorem AlgebraicCombinatorics.CauchyBinet.det_add_diagonal {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) (d : Fin nR) :
(A + Matrix.diagonal d).det = P : Finset (Fin n), (A.submatrix (P.orderEmbOfFin ) (P.orderEmbOfFin )).det * iP, d i
Proof

Theorem 5.61 (applied to \(B=D\)) yields a double sum. By Lemma 5.62(b), the terms with \(P\ne Q\) vanish (since \(\det (\operatorname {sub}_{\widetilde{P}}^{\widetilde{Q}} D)=0\)). In the surviving terms (\(P=Q\)), the sign factor \((-1)^{\operatorname {sum} P + \operatorname {sum} P} = 1\), and Lemma 5.62(a) gives \(\det (\operatorname {sub}_{\widetilde{P}}^{\widetilde{P}} D) = \prod _{i\in \widetilde{P}} d_i\).

5.2.6 Determinant of \(x + D\)

Lemma 5.64

The matrix \(F\) with entries \(F_{i,j} = x + d_i\, [i{=}j]\) decomposes as \(F = A + D\) where \(A\) is the \(n\times n\) constant matrix with all entries equal to \(x\) and \(D = \operatorname {diag}(d_1,\ldots ,d_n)\).

Proof

Entry-wise verification.

Lemma 5.65

For a singleton \(P = \{ p\} \), the \(1\times 1\) submatrix of the constant-\(x\) matrix has determinant \(x\).

Proof

The \(1\times 1\) matrix is \((x)\), which has determinant \(x\) (this is Matrix.det_unique from Mathlib).

Lemma 5.66

Let \(A\) be the \(n\times n\) constant matrix with all entries equal to \(x\). If \(P\subseteq [n]\) has \(|P| \ge 2\), then \(\det (\operatorname {sub}_P^P A) = 0\).

Proof

When \(|P|\ge 2\), the submatrix \(\operatorname {sub}_P^P A\) is a constant matrix of size \(\ge 2\). All its rows are identical, so the determinant is \(0\).

Proposition 5.67

Let \(n\in \mathbb {N}\). Let \(d_1,d_2,\ldots ,d_n\in K\) and \(x\in K\). Let \(F\) be the \(n\times n\)-matrix

\[ \begin{pmatrix} x+d_1 & x & \cdots & x \\ x & x+d_2 & \cdots & x \\ \vdots & \vdots & \ddots & \vdots \\ x & x & \cdots & x+d_n \end{pmatrix}\in K^{n\times n}. \]

Then,

\[ \det F = d_1 d_2 \cdots d_n + x \sum _{i=1}^n d_1 d_2 \cdots \widehat{d_i} \cdots d_n, \]

where the hat over “\(d_i\)” means “omit the \(d_i\) factor.”

theorem AlgebraicCombinatorics.CauchyBinet.det_const_add_diagonal {R : Type u_1} [CommRing R] {n : } (x : R) (d : Fin nR) :
(constPlusDiagMatrix x d).det = i : Fin n, d i + x * i : Fin n, jFinset.univ.erase i, d j
Proof

Write \(F = A + D\) (Lemma 5.64) where \(A\) is the \(n\times n\) constant matrix with all entries \(x\) and \(D = \operatorname {diag}(d_1,\ldots ,d_n)\). By Theorem 5.63,

\[ \det (A+D) = \sum _{P\subseteq [n]} \det (\operatorname {sub}_P^P A) \cdot \prod _{i\in [n]\setminus P} d_i. \]

For \(|P|\ge 2\), \(\det (\operatorname {sub}_P^P A) = 0\) (Lemma 5.66), so only \(P=\varnothing \) and singleton \(P=\{ p\} \) contribute:

\begin{align*} \det F & = \underbrace{\det (\operatorname {sub}_{\varnothing }^{\varnothing } A)}_{=1} \cdot \underbrace{\prod _{i\in [n]} d_i}_{=d_1 d_2\cdots d_n} + \sum _{p=1}^{n} \underbrace{\det (\operatorname {sub}_{\{ p\} }^{\{ p\} } A)}_{=x} \cdot \prod _{i\in [n]\setminus \{ p\} } d_i \\ & = d_1 d_2 \cdots d_n + x \sum _{i=1}^n d_1 d_2 \cdots \widehat{d_i} \cdots d_n. \end{align*}

5.2.7 Characteristic polynomial coefficients

Proposition 5.68

Let \(n\in \mathbb {N}\). Let \(A\in K^{n\times n}\) be an \(n\times n\)-matrix. Let \(x\in K\). Let \(I_n\) denote the \(n\times n\) identity matrix. Then,

\[ \det (A + x I_n) = \sum _{P\subseteq [n]} \det (\operatorname {sub}_P^P A) \cdot x^{n-|P|} = \sum _{k=0}^{n} \biggl(\sum _{\substack{[P, \subseteq , [, n, ], ;, \\ , , |, P, |, =, n, -, k]}} \det (\operatorname {sub}_P^P A)\biggr) x^k. \]
theorem AlgebraicCombinatorics.CauchyBinet.det_charPoly_coeff {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) (x : R) :
(A + x 1).det = P : Finset (Fin n), (A.submatrix (P.orderEmbOfFin ) (P.orderEmbOfFin )).det * x ^ (n - P.card)
theorem AlgebraicCombinatorics.CauchyBinet.det_charPoly_coeff' {R : Type u_1} [CommRing R] {n : } (A : Matrix (Fin n) (Fin n) R) (x : R) :
(A + x 1).det = kFinset.range (n + 1), (∑ P : Finset (Fin n) with P.card = n - k, (A.submatrix (P.orderEmbOfFin ) (P.orderEmbOfFin )).det) * x ^ k
Proof

The matrix \(xI_n\) is diagonal with all entries equal to \(x\). Theorem 5.63 (applied to \(D = xI_n\) and \(d_i = x\)) yields

\[ \det (A+xI_n) = \sum _{P\subseteq [n]} \det (\operatorname {sub}_P^P A) \cdot \underbrace{\prod _{i\in [n]\setminus P} x}_{= x^{n-|P|}}. \]

This is the first equality. The second follows by grouping the sum according to the value of \(|P|\) and substituting \(n-k\) for \(k\).

In the Lean formalization, \(x I_n\) is written as \(x \cdot I_n\) and the diagonal form is obtained from the identity \(x \cdot I_n = \operatorname {diag}(x,x,\ldots ,x)\). The second form regroups by partitioning \(\mathcal{P}([n])\) into fibers by cardinality.

5.2.8 The Pascal matrix

Definition 5.69 Pascal matrix and its LU factors
#

Define the \(n\times n\) Pascal matrix, the lower triangular factor \(L\), and the upper triangular factor \(U\) by:

\begin{align*} A_{i,j} & = \binom {i+j}{i}, & L_{i,k} & = \binom {i}{k}, & U_{k,j} & = \binom {j}{k}, \end{align*}

for \(0\le i,j,k \le n-1\).

Lemma 5.70 Triangularity and unit diagonal

\(L\) is lower triangular (\(L_{i,k} = 0\) for \(i {\lt} k\)) with \(L_{i,i} = 1\). \(U\) is upper triangular (\(U_{k,j} = 0\) for \(k {\gt} j\)) with \(U_{k,k} = 1\).

Proof

\(\binom {i}{k} = 0\) when \(i {\lt} k\), and \(\binom {i}{i} = 1\). Similarly for \(U\).

Lemma 5.71

Then \(A = L \cdot U\) (over \(\mathbb {Z}\)).

theorem AlgebraicCombinatorics.CauchyBinet.pascal_eq_LU (n : ) :
((pascalMatrix n).map fun (x : ) => x) = ((pascalLowerTriangular n).map fun (x : ) => x) * (pascalUpperTriangular n).map fun (x : ) => x
Proof

For all \(i,j\), we have (by Vandermonde’s identity)

\[ A_{i,j} = \binom {i+j}{i} = \sum _{k=0}^{n-1} \binom {i}{k} \binom {j}{k} = \sum _{k=0}^{n-1} L_{i,k}\, U_{k,j} = (LU)_{i,j}. \]

The key combinatorial identity \(\sum _{k} \binom {m}{k}\binom {n}{k} = \binom {m+n}{n}\) (Vandermonde’s identity) is used to establish the LU decomposition.

Lemma 5.72

The lower triangular factor \(L\) has \(\det L = 1\).

Proof

\(L\) is lower triangular (\(\binom {i}{k} = 0\) when \(i {\lt} k\)) and its diagonal entries are \(L_{i,i} = \binom {i}{i} = 1\) (Lemma 5.70). The determinant of a triangular matrix is the product of its diagonal entries, which is \(1\).

Lemma 5.73

The upper triangular factor \(U\) has \(\det U = 1\).

Proof

\(U\) is upper triangular (\(\binom {j}{k} = 0\) when \(k {\gt} j\)) and its diagonal entries are \(U_{k,k} = \binom {k}{k} = 1\) (Lemma 5.70). The determinant of a triangular matrix is the product of its diagonal entries, which is \(1\).

Proposition 5.74

Let \(n\in \mathbb {N}\). Let \(A\) be the \(n\times n\)-matrix

\[ \Bigl(\binom {i+j-2}{i-1}\Bigr)_{1\le i\le n,\ 1\le j\le n} = \begin{pmatrix} \binom {0}{0} & \binom {1}{0} & \cdots & \binom {n-1}{0} \\ \binom {1}{1} & \binom {2}{1} & \cdots & \binom {n}{1} \\ \vdots & \vdots & \ddots & \vdots \\ \binom {n-1}{n-1} & \binom {n}{n-1} & \cdots & \binom {2n-2}{n-1} \end{pmatrix}. \]

Then \(\det A = 1\).

Proof

By Lemma 5.71, \(A = LU\). Therefore

\[ \det A = \det (LU) = \det L \cdot \det U = 1 \cdot 1 = 1, \]

using the multiplicativity of the determinant (Theorem 5.40) and Lemmas 5.72 and 5.73.