|
8 | 8 | public import Mathlib.Analysis.InnerProductSpace.Rayleigh |
9 | 9 | public import Mathlib.Analysis.Normed.Group.Submodule |
10 | 10 | public import Mathlib.Analysis.Normed.Operator.FredholmAlternative |
| 11 | +public import Mathlib.LinearAlgebra.Eigenspace.Charpoly |
11 | 12 | public import Mathlib.LinearAlgebra.Eigenspace.ContinuousLinearMap |
12 | 13 | public import Mathlib.LinearAlgebra.Eigenspace.Minpoly |
13 | 14 | public import Mathlib.Data.Fin.Tuple.Sort |
@@ -343,6 +344,53 @@ theorem eigenvectorBasis_apply_self_apply (hT : T.IsSymmetric) (hn : Module.finr |
343 | 344 | intro a |
344 | 345 | rw [smul_smul, mul_comm, ofLp_toLp] |
345 | 346 |
|
| 347 | +theorem toMatrix_eigenvectorBasis (hT : T.IsSymmetric) (hn : Module.finrank 𝕜 E = n) : |
| 348 | + letI b := (hT.eigenvectorBasis hn).toBasis |
| 349 | + T.toMatrix b b = Matrix.diagonal (RCLike.ofReal ∘ hT.eigenvalues hn) := by |
| 350 | + ext i j |
| 351 | + simp [toMatrix_apply, Matrix.diagonal_apply, RCLike.real_smul_eq_coe_mul] |
| 352 | + grind |
| 353 | + |
| 354 | +open Polynomial in |
| 355 | +theorem charpoly_eq (hT : T.IsSymmetric) (hn : Module.finrank 𝕜 E = n) : |
| 356 | + T.charpoly = ∏ i, (X - C (hT.eigenvalues hn i : 𝕜)) := by |
| 357 | + simp [← T.charpoly_toMatrix (hT.eigenvectorBasis hn).toBasis, toMatrix_eigenvectorBasis, |
| 358 | + Matrix.charpoly_diagonal] |
| 359 | + |
| 360 | +theorem roots_charpoly_eq_eigenvalues (hT : T.IsSymmetric) (hn : Module.finrank 𝕜 E = n) : |
| 361 | + T.charpoly.roots = Multiset.map (RCLike.ofReal ∘ hT.eigenvalues hn) Finset.univ.val := by |
| 362 | + rw [← charpoly_toMatrix _ (hT.eigenvectorBasis hn).toBasis, toMatrix_eigenvectorBasis, |
| 363 | + Matrix.charpoly_diagonal, Polynomial.roots_prod _ _ (by |
| 364 | + simp [Finset.prod_ne_zero_iff, Polynomial.X_sub_C_ne_zero])] |
| 365 | + simp |
| 366 | + |
| 367 | +theorem sort_roots_charpoly_eq_eigenvalues (hT : T.IsSymmetric) (hn : Module.finrank 𝕜 E = n) : |
| 368 | + (T.charpoly.roots.map RCLike.re).sort (· ≥ ·) = List.ofFn (hT.eigenvalues hn) := by |
| 369 | + simp_rw [hT.roots_charpoly_eq_eigenvalues, Fin.univ_val_map, Multiset.map_coe, List.map_ofFn, |
| 370 | + Function.comp_def, RCLike.ofReal_re, Multiset.coe_sort] |
| 371 | + have := hn.symm |
| 372 | + convert List.mergeSort_of_pairwise ?_ |
| 373 | + simp_rw [decide_eq_true_eq, ← List.sortedGE_iff_pairwise] |
| 374 | + convert (hT.eigenvalues_antitone hn).sortedGE_ofFn |
| 375 | + |
| 376 | +theorem eigenvalues_eq_eigenvalues_iff {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace 𝕜 E'] |
| 377 | + [FiniteDimensional 𝕜 E'] {T' : E' →ₗ[𝕜] E'} (hT : T.IsSymmetric) (hn : Module.finrank 𝕜 E = n) |
| 378 | + (hT' : T'.IsSymmetric) (hn' : Module.finrank 𝕜 E' = n) : |
| 379 | + hT.eigenvalues hn = hT'.eigenvalues hn' ↔ T.charpoly = T'.charpoly where |
| 380 | + mp h := by rw [hT.charpoly_eq hn, hT'.charpoly_eq hn', h] |
| 381 | + mpr h := by |
| 382 | + rw [← List.ofFn_inj, ← sort_roots_charpoly_eq_eigenvalues, ← sort_roots_charpoly_eq_eigenvalues, |
| 383 | + h] |
| 384 | + |
| 385 | +theorem splits_charpoly (hT : T.IsSymmetric) : T.charpoly.Splits := by |
| 386 | + refine Polynomial.splits_iff_card_roots.mpr ?_ |
| 387 | + simp [hT.roots_charpoly_eq_eigenvalues rfl, LinearMap.charpoly_natDegree] |
| 388 | + |
| 389 | +theorem det_eq_prod_eigenvalues (hT : T.IsSymmetric) (hn : Module.finrank 𝕜 E = n) : |
| 390 | + T.det = ∏ i, (hT.eigenvalues hn i : 𝕜) := by |
| 391 | + simp [det_eq_prod_roots_charpoly_of_splits hT.splits_charpoly, |
| 392 | + hT.roots_charpoly_eq_eigenvalues hn, List.prod_ofFn] |
| 393 | + |
346 | 394 | end Version2 |
347 | 395 |
|
348 | 396 | end IsSymmetric |
|
0 commit comments