File: Mathlib/LinearAlgebra/Matrix/Spectrum.lean

full_name: Matrix.IsHermitian.eigenvalues₀
code: /-- The eigenvalues of a hermitian matrix, indexed by `Fin (Fintype.card n)` where `n` is the index
type of the matrix. -/
noncomputable def eigenvalues₀ : Fin (Fintype.card n) → ℝ 
goal: Fin (Fintype.card n) → ℝ

full_name: Matrix.IsHermitian.eigenvalues
code: /-- The eigenvalues of a hermitian matrix, reusing the index `n` of the matrix entries. -/
noncomputable def eigenvalues : n → ℝ 
goal: n → ℝ

full_name: Matrix.IsHermitian.eigenvectorBasis
code: /-- A choice of an orthonormal basis of eigenvectors of a hermitian matrix. -/
noncomputable def eigenvectorBasis : OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n) 
goal: OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n)

full_name: Matrix.IsHermitian.mulVec_eigenvectorBasis
code: lemma mulVec_eigenvectorBasis (j : n) :
    A *ᵥ ⇑(hA.eigenvectorBasis j) = (hA.eigenvalues j) • ⇑(hA.eigenvectorBasis j) 
goal: A.mulVec ((WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)) =
  hA.eigenvalues j • (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)

full_name: Matrix.IsHermitian.spectrum_toEuclideanLin
code: /-- The spectrum of a Hermitian matrix `A` coincides with the spectrum of `toEuclideanLin A`. -/
theorem spectrum_toEuclideanLin : spectrum 𝕜 (toEuclideanLin A) = spectrum 𝕜 A 
goal: spectrum 𝕜 (Matrix.toEuclideanLin A) = spectrum 𝕜 A

full_name: Matrix.IsHermitian.eigenvalues_mem_spectrum_real
code: /-- Eigenvalues of a hermitian matrix A are in the ℝ spectrum of A. -/
theorem eigenvalues_mem_spectrum_real (i : n) : hA.eigenvalues i ∈ spectrum ℝ A 
goal: hA.eigenvalues i ∈ spectrum ℝ A

full_name: Matrix.IsHermitian.eigenvectorUnitary
code: /-- Unitary matrix whose columns are `Matrix.IsHermitian.eigenvectorBasis`. -/
noncomputable def eigenvectorUnitary {𝕜 : Type*} [RCLike 𝕜] {n : Type*}
    [Fintype n]{A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) :
    Matrix.unitaryGroup n 𝕜 
goal: ↥(Matrix.unitaryGroup n 𝕜)

full_name: Matrix.IsHermitian.eigenvectorUnitary_coe
code: lemma eigenvectorUnitary_coe {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n]
    {A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) :
    eigenvectorUnitary hA =
      (EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix (hA.eigenvectorBasis).toBasis 
goal: ↑hA.eigenvectorUnitary = (EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix ⇑hA.eigenvectorBasis.toBasis

full_name: Matrix.IsHermitian.eigenvectorUnitary_apply
code: @[simp]
theorem eigenvectorUnitary_apply (i j : n) :
    eigenvectorUnitary hA i j = ⇑(hA.eigenvectorBasis j) i 
goal: ↑hA.eigenvectorUnitary i j = (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j) i

full_name: Matrix.IsHermitian.eigenvectorUnitary_mulVec
code: theorem eigenvectorUnitary_mulVec (j : n) :
    eigenvectorUnitary hA *ᵥ Pi.single j 1 = ⇑(hA.eigenvectorBasis j) 
goal: (↑hA.eigenvectorUnitary).mulVec (Pi.single j 1) = (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)

full_name: Matrix.IsHermitian.star_eigenvectorUnitary_mulVec
code: theorem star_eigenvectorUnitary_mulVec (j : n) :
    (star (eigenvectorUnitary hA : Matrix n n 𝕜)) *ᵥ ⇑(hA.eigenvectorBasis j) = Pi.single j 1 
goal: (star ↑hA.eigenvectorUnitary).mulVec ((WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)) =
  Pi.single j 1

full_name: Matrix.IsHermitian.star_mul_self_mul_eq_diagonal
code: /-- Unitary diagonalization of a Hermitian matrix. -/
theorem star_mul_self_mul_eq_diagonal :
    (star (eigenvectorUnitary hA : Matrix n n 𝕜)) * A * (eigenvectorUnitary hA : Matrix n n 𝕜)
      = diagonal (RCLike.ofReal ∘ hA.eigenvalues) 
goal: star ↑hA.eigenvectorUnitary * A * ↑hA.eigenvectorUnitary = Matrix.diagonal (RCLike.ofReal ∘ hA.eigenvalues)

full_name: Matrix.IsHermitian.spectral_theorem
code: /-- **Diagonalization theorem**, **spectral theorem** for matrices; A hermitian matrix can be
diagonalized by a change of basis. For the spectral theorem on linear maps, see
`LinearMap.IsSymmetric.eigenvectorBasis_apply_self_apply`.-/
theorem spectral_theorem :
    A = (eigenvectorUnitary hA : Matrix n n 𝕜) * diagonal (RCLike.ofReal ∘ hA.eigenvalues)
      * (star (eigenvectorUnitary hA : Matrix n n 𝕜)) 
goal: A = ↑hA.eigenvectorUnitary * Matrix.diagonal (RCLike.ofReal ∘ hA.eigenvalues) * star ↑hA.eigenvectorUnitary

full_name: Matrix.IsHermitian.eigenvalues_eq
code: theorem eigenvalues_eq (i : n) :
    (hA.eigenvalues i) = RCLike.re (Matrix.dotProduct (star ⇑(hA.eigenvectorBasis i))
    (A *ᵥ ⇑(hA.eigenvectorBasis i))) 
goal: hA.eigenvalues i =
  RCLike.re
    (Matrix.dotProduct (star ((WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis i)))
      (A.mulVec ((WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis i))))

full_name: Matrix.IsHermitian.det_eq_prod_eigenvalues
code: /-- The determinant of a hermitian matrix is the product of its eigenvalues. -/
theorem det_eq_prod_eigenvalues : det A = ∏ i, (hA.eigenvalues i : 𝕜) 
goal: A.det = ∏ i : n, ↑(hA.eigenvalues i)

full_name: Matrix.IsHermitian.rank_eq_rank_diagonal
code: /-- rank of a hermitian matrix is the rank of after diagonalization by the eigenvector unitary -/
lemma rank_eq_rank_diagonal : A.rank = (Matrix.diagonal hA.eigenvalues).rank 
goal: A.rank = (Matrix.diagonal hA.eigenvalues).rank

full_name: Matrix.IsHermitian.rank_eq_card_non_zero_eigs
code: /-- rank of a hermitian matrix is the number of nonzero eigenvalues of the hermitian matrix -/
lemma rank_eq_card_non_zero_eigs : A.rank = Fintype.card {i // hA.eigenvalues i ≠ 0} 
goal: A.rank = Fintype.card { i // hA.eigenvalues i ≠ 0 }

full_name: Matrix.IsHermitian.exists_eigenvector_of_ne_zero
code: /-- A nonzero Hermitian matrix has an eigenvector with nonzero eigenvalue. -/
lemma exists_eigenvector_of_ne_zero (hA : IsHermitian A) (h_ne : A ≠ 0) :
    ∃ (v : n → 𝕜) (t : ℝ), t ≠ 0 ∧ v ≠ 0 ∧ A *ᵥ v = t • v 
goal: ∃ v t, t ≠ 0 ∧ v ≠ 0 ∧ A.mulVec v = t • v