Prove2Me
Navigate
MissionsFormalpediaUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Diagonalizable exactly when there is an eigenbasis

Proved
HefferonLinAlg.diagonalizable_iff_eigenbasis

by tianyipeng · Aug 7, 2026 · Mathlib c5ea003 (Lean v4.30.0)

diagonalizationeigenvalueseigenvectorslinear-algebra

An n×nn \times nn×n matrix AAA over a field KKK is similar to a diagonal matrix if and only if KnK^nKn has a basis of eigenvectors of AAA — a basis BBB together with scalars λi\lambda_iλi​ satisfying ABi=λiBiA B_i = \lambda_i B_iABi​=λi​Bi​ for every iii. This is the first canonical form of Chapter Five and the model for the last one: Jordan form is what one settles for when no eigenbasis exists.

Preamble
import Mathlib

open Matrix
Formal statement
namespace HefferonLinAlg

theorem diagonalizable_iff_eigenbasis
    {K : Type*} [Field K] {n : ℕ} (A : Matrix (Fin n) (Fin n) K) :
    (∃ (P : Matrix (Fin n) (Fin n) K) (d : Fin n → K),
        IsUnit P.det ∧ P⁻¹ * A * P = Matrix.diagonal d) ↔
      (∃ (B : Module.Basis (Fin n) K (Fin n → K)) (lam : Fin n → K),
        ∀ i, A *ᵥ B i = lam i • B i) := by
  sorry

end HefferonLinAlg
Source
Jim Hefferon, *Linear Algebra*, Saint Michael's College, 2020 printing, Chapter Five, Section II.2, Lemma 2.4, printed p. 409 (PDF p. 419)
Read-back

What the Lean code literally says, in plain math · claude-opus-5

For every field KKK (an arbitrary type carrying a field structure, with no assumption of algebraic closure, characteristic, or ordering), every natural number nnn (including n=0n = 0n=0), and every square matrix A∈Kn×nA \in K^{n \times n}A∈Kn×n whose rows and columns are indexed by the nnn-element index type {0,1,…,n−1}\{0, 1, \dots, n-1\}{0,1,…,n−1}, the following two existence statements are equivalent (a genuine two-directional "if and only if", not an implication in one direction):

  • Left side. There exist a matrix P∈Kn×nP \in K^{n \times n}P∈Kn×n and a function d:{0,…,n−1}→Kd : \{0,\dots,n-1\} \to Kd:{0,…,n−1}→K such that det⁡P\det PdetP is a unit of KKK — equivalently, since KKK is a field, det⁡P≠0\det P \neq 0detP=0 — and P−1AP=diag⁡(d0,…,dn−1)P^{-1} A P = \operatorname{diag}(d_0, \dots, d_{n-1})P−1AP=diag(d0​,…,dn−1​), the matrix whose (i,i)(i,i)(i,i) entry is did_idi​ and whose off-diagonal entries are 000. Here P−1P^{-1}P−1 denotes the total inversion operation on matrices (which would return the zero matrix for a singular argument), but the accompanying invertibility hypothesis forces it to be the genuine two-sided inverse of PPP; note also the specific order of the product, P−1P^{-1}P−1 on the left and PPP on the right.

  • Right side. There exist a basis BBB of the KKK-vector space KnK^{n}Kn of functions {0,…,n−1}→K\{0,\dots,n-1\} \to K{0,…,n−1}→K, indexed by {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1} (so it consists of exactly nnn vectors B0,…,Bn−1B_0, \dots, B_{n-1}B0​,…,Bn−1​), and a function λ:{0,…,n−1}→K\lambda : \{0,\dots,n-1\} \to Kλ:{0,…,n−1}→K, such that for every index iii the matrix–vector product satisfies

A Bi=λi⋅Bi,i.e.∑kAj,k(Bi)k=λi(Bi)j  for all j,A \, B_i = \lambda_i \cdot B_i, \qquad \text{i.e.} \qquad \sum_{k} A_{j,k} (B_i)_k = \lambda_i (B_i)_j \ \text{ for all } j,ABi​=λi​⋅Bi​,i.e.k∑​Aj,k​(Bi​)k​=λi​(Bi​)j​  for all j,

where ABiA B_iABi​ is the usual left action of the matrix on a column vector and λi⋅Bi\lambda_i \cdot B_iλi​⋅Bi​ is scalar multiplication.

Several things the quantifiers silently permit should be made explicit: the scalars did_idi​ and λi\lambda_iλi​ are unconstrained elements of KKK and may be zero, repeated, or all equal; no relationship (equality, permutation, or matching multiplicities) is asserted between the diagonal entries ddd produced on one side and the scalars λ\lambdaλ produced on the other, nor between PPP and BBB; the basis vectors BiB_iBi​ are automatically nonzero and linearly independent by virtue of forming a basis, but no normalization, orthogonality, or ordering condition is imposed; and in the degenerate case n=0n = 0n=0 both sides hold trivially (the unique 0×00 \times 00×0 matrix has determinant 111, and the empty family is a basis of the zero space, with the universally quantified condition holding vacuously), so the equivalence carries no content there. The statement is asserted for the fixed matrix AAA supplied as an argument, with KKK, nnn, and the field structure on KKK inferred rather than stated by the user; it claims only the equivalence of the two existence statements and does not exhibit or construct either PPP, ddd, BBB, or λ\lambdaλ.

Human review
  • Endorsed by Shuze Chen · Aug 7, 2026

  • Endorsed by tianyipeng · Aug 7, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeLaunch a missionPropose a formalization projectFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions.

How Prove2Me works
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me