Mode of #cas

eigenvectors

A basis of each eigenspace of a square matrix with rational entries, with a theorem for every eigenvalue, irrational ones included.

#cas [eigenvectors] A
gives a basis of the eigenspace of each eigenvalue of the square matrix A with rational entries, and proves it for every eigenvalue, the irrational ones included.

For a rational eigenvalue λ there isn’t much to say: eigenvectors computes the null space of A−λI and proves it with the theorem of nullSpace. The irrational eigenvalues are where it gets interesting. Take a factor q of the characteristic polynomial. You get one basis that serves all the roots α of q at once, with entries that are polynomials in α, and one theorem that holds for every root of q in ℝ or ℂ. That’s how I would write these eigenvectors by hand, and it means nobody has to read nested radicals.

Details and Options

  • A is a square matrix literal !![a, b; c, d] or a list of rows [[a, b], [c, d]]. The entries are closed rational expressions such as -3/2, 0.25 or 1/10^15.
  • For a rational eigenvalue λ with printed vectors Vi, the theorem is the statement of nullSpace for A - λ • 1 over ℚ: (A - λ • 1).mulVec (V i) = 0 for each i, LinearIndependent ℚ V, and ∀ x, (A - λ • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • V i.
  • The other eigenvalues are the roots of the monic factors q of A.charpoly left after the rational roots that the root search finds. For each q, the field K is ℝ when a certificate shows that every root of q is real, and ℂ otherwise, and M is A over K. The theorem is ∀ α : K, Polynomial.aeval α q = 0 → (∀ i, (M - α • 1).mulVec (V i) = 0) ∧ LinearIndependent K V ∧ ∀ x, (M - α • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • V i.
  • For K=ℝ the theorem also says (q.map (algebraMap ℚ ℝ)).Splits, so that the real roots are all the roots of q. The certificate is the discriminant of a quadratic, or intervals around the roots that do not overlap, and the kernel checks it (CAS.Analysis.Matrix.EigFactor.splits_of_realCheck).
  • The theorem ends with the factorization of A.charpoly in ℚ[X] into the factors X−λ and q, with their multiplicities.
  • A factor q of degree 3 or more comes from the squarefree decomposition and need not be irreducible. The vectors come from Gauss-Jordan elimination of A−XI over ℚ[X]/(q), which may then split q, and each part gets its own statement.
  • There is no limit on the size of A. The search runs before the proof, and the proof runs with maxHeartbeats, Lean’s limit on the work of a command, raised to at least one million. So a large matrix can take long, and its proof can still run out of heartbeats.
  • There are no options.

Examples (13)#

Basic Examples (2)

Two rational eigenvalues, each with its eigenvector:

In[1]:=
#cas [eigenvectors] !![4, 1; 2, 3]
Out[1]=

eigenvalue ↦ basis of its eigenspace

[2↦[(−121)], 5↦[(11)]]
[2 ↦ [![-1/2, 1]], 5 ↦ [![1, 1]]]
Domain
ℚ^(2×2)
Input (matrix)
!![4, 1; 2, 3]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

((∀ (i : Fin (Nat.succ 0)), (!![4, 1; 2, 3] - 2 • 1).mulVec (![![-(1 / 2), 1]] i) = 0) ∧
    LinearIndependent ℚ ![![-(1 / 2), 1]] ∧
      ∀ (x : Fin 2 → ℚ), (!![4, 1; 2, 3] - 2 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![-(1 / 2), 1]] i) ∧
  ((∀ (i : Fin (Nat.succ 0)), (!![4, 1; 2, 3] - 5 • 1).mulVec (![![1, 1]] i) = 0) ∧
      LinearIndependent ℚ ![![1, 1]] ∧
        ∀ (x : Fin 2 → ℚ), (!![4, 1; 2, 3] - 5 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![1, 1]] i) ∧
    !![4, 1; 2, 3].charpoly = (Polynomial.X - 2) * (Polynomial.X - 5)
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    ((∀ (i : Fin (Nat.succ 0)), (!![4, 1; 2, 3] - 2 • 1).mulVec (![![-(1 / 2), 1]] i) = 0) ∧
        LinearIndependent ℚ ![![-(1 / 2), 1]] ∧
          ∀ (x : Fin 2 → ℚ), (!![4, 1; 2, 3] - 2 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![-(1 / 2), 1]] i) ∧
      ((∀ (i : Fin (Nat.succ 0)), (!![4, 1; 2, 3] - 5 • 1).mulVec (![![1, 1]] i) = 0) ∧
          LinearIndependent ℚ ![![1, 1]] ∧
            ∀ (x : Fin 2 → ℚ), (!![4, 1; 2, 3] - 5 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![1, 1]] i) ∧
        !![4, 1; 2, 3].charpoly = (Polynomial.X - 2) * (Polynomial.X - 5)

    Checked by Lean’s kernel


The eigenvalues of the Fibonacci matrix are the two roots of α2−α−1, and one vector (α,1) serves both. The theorem says that x2−x−1 splits over ℝ:

In[2]:=
#cas [eigenvectors] !![1, 1; 1, 0]
Out[2]=

eigenvalue ↦ basis of its eigenspace

[α ↦ [![α, 1]]] for each α ∈ ℝ with α^2 - α - 1 = 0
Domain
ℚ^(2×2)
Input (matrix)
!![1, 1; 1, 0]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - Polynomial.X - 1)).Splits ∧
    ∀ (α : ℝ),
      (Polynomial.aeval α) (Polynomial.X ^ 2 - Polynomial.X - 1) = 0 →
        (∀ (i : Fin 1), (!![1, 1; 1, 0] - α • 1).mulVec (![![α, 1]] i) = 0) ∧
          LinearIndependent ℝ ![![α, 1]] ∧
            ∀ (x : Fin 2 → ℝ), (!![1, 1; 1, 0] - α • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![α, 1]] i) ∧
  !![1, 1; 1, 0].charpoly = Polynomial.X ^ 2 - Polynomial.X - 1
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - Polynomial.X - 1)).Splits ∧
        ∀ (α : ℝ),
          (Polynomial.aeval α) (Polynomial.X ^ 2 - Polynomial.X - 1) = 0 →
            (∀ (i : Fin 1), (!![1, 1; 1, 0] - α • 1).mulVec (![![α, 1]] i) = 0) ∧
              LinearIndependent ℝ ![![α, 1]] ∧
                ∀ (x : Fin 2 → ℝ), (!![1, 1; 1, 0] - α • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![α, 1]] i) ∧
      !![1, 1; 1, 0].charpoly = Polynomial.X ^ 2 - Polynomial.X - 1

    Checked by Lean’s kernel

Scope (6)

A Jordan block has the eigenvalue 1 twice, and only one independent eigenvector:

In[3]:=
#cas [eigenvectors] !![1, 1; 0, 1]
Out[3]=

eigenvalue ↦ basis of its eigenspace

[1↦[(10)]]
[1 ↦ [![1, 0]]]
Domain
ℚ^(2×2)
Input (matrix)
!![1, 1; 0, 1]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

((∀ (i : Fin (Nat.succ 0)), (!![1, 1; 0, 1] - 1 • 1).mulVec (![![1, 0]] i) = 0) ∧
    LinearIndependent ℚ ![![1, 0]] ∧
      ∀ (x : Fin 2 → ℚ), (!![1, 1; 0, 1] - 1 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![1, 0]] i) ∧
  !![1, 1; 0, 1].charpoly = (Polynomial.X - 1) ^ 2
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    ((∀ (i : Fin (Nat.succ 0)), (!![1, 1; 0, 1] - 1 • 1).mulVec (![![1, 0]] i) = 0) ∧
        LinearIndependent ℚ ![![1, 0]] ∧
          ∀ (x : Fin 2 → ℚ), (!![1, 1; 0, 1] - 1 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![1, 0]] i) ∧
      !![1, 1; 0, 1].charpoly = (Polynomial.X - 1) ^ 2

    Checked by Lean’s kernel


The roots of α2+1 are not real, so the theorem is over ℂ:

In[4]:=
#cas [eigenvectors] !![0, -1; 1, 0]
Out[4]=

eigenvalue ↦ basis of its eigenspace

[α ↦ [![α, 1]]] for each α ∈ ℂ with α^2 + 1 = 0
Domain
ℚ^(2×2)
Input (matrix)
!![0, -1; 1, 0]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

(∀ (α : ℂ),
    (Polynomial.aeval α) (Polynomial.X ^ 2 + 1) = 0 →
      (∀ (i : Fin 1), (!![0, -1; 1, 0] - α • 1).mulVec (![![α, 1]] i) = 0) ∧
        LinearIndependent ℂ ![![α, 1]] ∧
          ∀ (x : Fin 2 → ℂ), (!![0, -1; 1, 0] - α • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![α, 1]] i) ∧
  !![0, -1; 1, 0].charpoly = Polynomial.X ^ 2 + 1
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    (∀ (α : ℂ),
        (Polynomial.aeval α) (Polynomial.X ^ 2 + 1) = 0 →
          (∀ (i : Fin 1), (!![0, -1; 1, 0] - α • 1).mulVec (![![α, 1]] i) = 0) ∧
            LinearIndependent ℂ ![![α, 1]] ∧
              ∀ (x : Fin 2 → ℂ), (!![0, -1; 1, 0] - α • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![α, 1]] i) ∧
      !![0, -1; 1, 0].charpoly = Polynomial.X ^ 2 + 1

    Checked by Lean’s kernel


A rational eigenvalue and two irrational ones in one report:

In[5]:=
#cas [eigenvectors] !![2, 0, 0; 0, 1, 1; 0, 1, 0]
Out[5]=

eigenvalue ↦ basis of its eigenspace

[2 ↦ [![1, 0, 0]], α ↦ [![0, α, 1]]] for each α ∈ ℝ with α^2 - α - 1 = 0
Domain
ℚ^(3×3)
Input (matrix)
!![2, 0, 0; 0, 1, 1; 0, 1, 0]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

((∀ (i : Fin (Nat.succ 0)), (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - 2 • 1).mulVec (![![1, 0, 0]] i) = 0) ∧
    LinearIndependent ℚ ![![1, 0, 0]] ∧
      ∀ (x : Fin 3 → ℚ),
        (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - 2 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![1, 0, 0]] i) ∧
  ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - Polynomial.X - 1)).Splits ∧
      ∀ (α : ℝ),
        (Polynomial.aeval α) (Polynomial.X ^ 2 - Polynomial.X - 1) = 0 →
          (∀ (i : Fin 1), (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - α • 1).mulVec (![![0, α, 1]] i) = 0) ∧
            LinearIndependent ℝ ![![0, α, 1]] ∧
              ∀ (x : Fin 3 → ℝ),
                (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - α • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![0, α, 1]] i) ∧
    !![2, 0, 0; 0, 1, 1; 0, 1, 0].charpoly = (Polynomial.X - 2) * (Polynomial.X ^ 2 - Polynomial.X - 1)
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    ((∀ (i : Fin (Nat.succ 0)), (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - 2 • 1).mulVec (![![1, 0, 0]] i) = 0) ∧
        LinearIndependent ℚ ![![1, 0, 0]] ∧
          ∀ (x : Fin 3 → ℚ),
            (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - 2 • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![1, 0, 0]] i) ∧
      ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - Polynomial.X - 1)).Splits ∧
          ∀ (α : ℝ),
            (Polynomial.aeval α) (Polynomial.X ^ 2 - Polynomial.X - 1) = 0 →
              (∀ (i : Fin 1), (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - α • 1).mulVec (![![0, α, 1]] i) = 0) ∧
                LinearIndependent ℝ ![![0, α, 1]] ∧
                  ∀ (x : Fin 3 → ℝ),
                    (!![2, 0, 0; 0, 1, 1; 0, 1, 0] - α • 1).mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![0, α, 1]] i) ∧
        !![2, 0, 0; 0, 1, 1; 0, 1, 0].charpoly = (Polynomial.X - 2) * (Polynomial.X ^ 2 - Polynomial.X - 1)

    Checked by Lean’s kernel


The cubic α3−3α+1 has three real roots. Intervals around them that do not overlap show it, so the theorem is over ℝ:

In[6]:=
#cas [eigenvectors] !![0, 0, -1; 1, 0, 3; 0, 1, 0]
Out[6]=

eigenvalue ↦ basis of its eigenspace

[α ↦ [![α^2 - 3, α, 1]]] for each α ∈ ℝ with α^3 - 3*α + 1 = 0
Domain
ℚ^(3×3)
Input (matrix)
!![0, 0, -1; 1, 0, 3; 0, 1, 0]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 3 - 3 * Polynomial.X + 1)).Splits ∧
    ∀ (α : ℝ),
      (Polynomial.aeval α) (Polynomial.X ^ 3 - 3 * Polynomial.X + 1) = 0 →
        (∀ (i : Fin 1), (!![0, 0, -1; 1, 0, 3; 0, 1, 0] - α • 1).mulVec (![![α ^ 2 - 3, α, 1]] i) = 0) ∧
          LinearIndependent ℝ ![![α ^ 2 - 3, α, 1]] ∧
            ∀ (x : Fin 3 → ℝ),
              (!![0, 0, -1; 1, 0, 3; 0, 1, 0] - α • 1).mulVec x = 0 →
                ∃ c, x = ∑ i, c i • ![![α ^ 2 - 3, α, 1]] i) ∧
  !![0, 0, -1; 1, 0, 3; 0, 1, 0].charpoly = Polynomial.X ^ 3 - 3 * Polynomial.X + 1
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 3 - 3 * Polynomial.X + 1)).Splits ∧
        ∀ (α : ℝ),
          (Polynomial.aeval α) (Polynomial.X ^ 3 - 3 * Polynomial.X + 1) = 0 →
            (∀ (i : Fin 1), (!![0, 0, -1; 1, 0, 3; 0, 1, 0] - α • 1).mulVec (![![α ^ 2 - 3, α, 1]] i) = 0) ∧
              LinearIndependent ℝ ![![α ^ 2 - 3, α, 1]] ∧
                ∀ (x : Fin 3 → ℝ),
                  (!![0, 0, -1; 1, 0, 3; 0, 1, 0] - α • 1).mulVec x = 0 →
                    ∃ c, x = ∑ i, c i • ![![α ^ 2 - 3, α, 1]] i) ∧
      !![0, 0, -1; 1, 0, 3; 0, 1, 0].charpoly = Polynomial.X ^ 3 - 3 * Polynomial.X + 1

    Checked by Lean’s kernel


An irrational eigenvalue with an eigenspace of dimension 2:

In[7]:=
#cas [eigenvectors] !![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0]
Out[7]=

eigenvalue ↦ basis of its eigenspace

[α ↦ [![α, 1, 0, 0], ![0, 0, α, 1]]] for each α ∈ ℝ with α^2 - α - 1 = 0
Domain
ℚ^(4×4)
Input (matrix)
!![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - Polynomial.X - 1)).Splits ∧
    ∀ (α : ℝ),
      (Polynomial.aeval α) (Polynomial.X ^ 2 - Polynomial.X - 1) = 0 →
        (∀ (i : Fin 2),
            (!![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0] - α • 1).mulVec
                (![![α, 1, 0, 0], ![0, 0, α, 1]] i) =
              0) ∧
          LinearIndependent ℝ ![![α, 1, 0, 0], ![0, 0, α, 1]] ∧
            ∀ (x : Fin 4 → ℝ),
              (!![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0] - α • 1).mulVec x = 0 →
                ∃ c, x = ∑ i, c i • ![![α, 1, 0, 0], ![0, 0, α, 1]] i) ∧
  !![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0].charpoly = (Polynomial.X ^ 2 - Polynomial.X - 1) ^ 2
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - Polynomial.X - 1)).Splits ∧
        ∀ (α : ℝ),
          (Polynomial.aeval α) (Polynomial.X ^ 2 - Polynomial.X - 1) = 0 →
            (∀ (i : Fin 2),
                (!![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0] - α • 1).mulVec
                    (![![α, 1, 0, 0], ![0, 0, α, 1]] i) =
                  0) ∧
              LinearIndependent ℝ ![![α, 1, 0, 0], ![0, 0, α, 1]] ∧
                ∀ (x : Fin 4 → ℝ),
                  (!![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0] - α • 1).mulVec x = 0 →
                    ∃ c, x = ∑ i, c i • ![![α, 1, 0, 0], ![0, 0, α, 1]] i) ∧
      !![1, 1, 0, 0; 1, 0, 0, 0; 0, 0, 1, 1; 0, 0, 1, 0].charpoly = (Polynomial.X ^ 2 - Polynomial.X - 1) ^ 2

    Checked by Lean’s kernel


Two quadratic factors. The report names the roots of the first α1 and those of the second α2:

In[8]:=
#cas [eigenvectors] !![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0]
Out[8]=

eigenvalue ↦ basis of its eigenspace

[α₁ ↦ [![α₁, 1, 0, 0]], α₂ ↦ [![0, 0, α₂, 1]]] for each α₁ ∈ ℝ with α₁^2 - 2 = 0 and each α₂ ∈ ℝ with α₂^2 - 3 = 0
Domain
ℚ^(4×4)
Input (matrix)
!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0]

Checked by Lean’s kernel: Characteristic polynomial factored over ℚ, eigenspaces

((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - 2)).Splits ∧
    ∀ (α : ℝ),
      (Polynomial.aeval α) (Polynomial.X ^ 2 - 2) = 0 →
        (∀ (i : Fin 1),
            (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec (![![α, 1, 0, 0]] i) = 0) ∧
          LinearIndependent ℝ ![![α, 1, 0, 0]] ∧
            ∀ (x : Fin 4 → ℝ),
              (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec x = 0 →
                ∃ c, x = ∑ i, c i • ![![α, 1, 0, 0]] i) ∧
  ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - 3)).Splits ∧
      ∀ (α : ℝ),
        (Polynomial.aeval α) (Polynomial.X ^ 2 - 3) = 0 →
          (∀ (i : Fin 1),
              (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec (![![0, 0, α, 1]] i) = 0) ∧
            LinearIndependent ℝ ![![0, 0, α, 1]] ∧
              ∀ (x : Fin 4 → ℝ),
                (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec x = 0 →
                  ∃ c, x = ∑ i, c i • ![![0, 0, α, 1]] i) ∧
    !![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0].charpoly =
      (Polynomial.X ^ 2 - 2) * (Polynomial.X ^ 2 - 3)
The certificate: 1 checked step
  1. Characteristic polynomial factored over ℚ, eigenspaces

    ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - 2)).Splits ∧
        ∀ (α : ℝ),
          (Polynomial.aeval α) (Polynomial.X ^ 2 - 2) = 0 →
            (∀ (i : Fin 1),
                (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec (![![α, 1, 0, 0]] i) = 0) ∧
              LinearIndependent ℝ ![![α, 1, 0, 0]] ∧
                ∀ (x : Fin 4 → ℝ),
                  (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec x = 0 →
                    ∃ c, x = ∑ i, c i • ![![α, 1, 0, 0]] i) ∧
      ((Polynomial.map (algebraMap ℚ ℝ) (Polynomial.X ^ 2 - 3)).Splits ∧
          ∀ (α : ℝ),
            (Polynomial.aeval α) (Polynomial.X ^ 2 - 3) = 0 →
              (∀ (i : Fin 1),
                  (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec (![![0, 0, α, 1]] i) = 0) ∧
                LinearIndependent ℝ ![![0, 0, α, 1]] ∧
                  ∀ (x : Fin 4 → ℝ),
                    (!![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0] - α • 1).mulVec x = 0 →
                      ∃ c, x = ∑ i, c i • ![![0, 0, α, 1]] i) ∧
        !![0, 2, 0, 0; 1, 0, 0, 0; 0, 0, 0, 3; 0, 0, 1, 0].charpoly =
          (Polynomial.X ^ 2 - 2) * (Polynomial.X ^ 2 - 3)

    Checked by Lean’s kernel

Applications (2)

An eigenvector as a theorem. Only the three standard axioms are used:

In[9]:=
theorem eigenvector_five : !![(4 : ℚ), 1; 2, 3].mulVec ![1, 1] = (5 : ℚ) • ![1, 1] := by
  cas

#print axioms eigenvector_five
Out[9]=

eigenvector_five depends on the axioms propext, Classical.choice, Quot.sound.


The eigenvectors of the first example, as the columns of P, diagonalize A: AP=PD with D the diagonal matrix of the eigenvalues 2 and 5:

In[10]:=
#cas [dot] (!![4, 1; 2, 3], !![-1/2, 1; 1, 1])
Out[10]=

product

(−1525)
!![-1, 5; 2, 5]
Domain
ℚ^(2×2)
Input (product)
!![4, 1; 2, 3] . !![-1/2, 1; 1, 1]

Checked by Lean’s kernel: Decided by kernel evaluation

!![4, 1; 2, 3] * !![-(1 / 2), 1; 1, 1] = !![-1, 5; 2, 5]
The certificate: 1 checked step
  1. Decided by kernel evaluation

    !![4, 1; 2, 3] * !![-(1 / 2), 1; 1, 1] = !![-1, 5; 2, 5]

    Checked by Lean’s kernel

In[11]:=
#cas [dot] (!![-1/2, 1; 1, 1], !![2, 0; 0, 5])
Out[11]=

product

(−1525)
!![-1, 5; 2, 5]
Domain
ℚ^(2×2)
Input (product)
!![-1/2, 1; 1, 1] . !![2, 0; 0, 5]

Checked by Lean’s kernel: Decided by kernel evaluation

!![-(1 / 2), 1; 1, 1] * !![2, 0; 0, 5] = !![-1, 5; 2, 5]
The certificate: 1 checked step
  1. Decided by kernel evaluation

    !![-(1 / 2), 1; 1, 1] * !![2, 0; 0, 5] = !![-1, 5; 2, 5]

    Checked by Lean’s kernel

Properties and Relations (2)

The eigenspace of a rational eigenvalue λ is the null space of A−λI. For λ=2 in the first example:

In[12]:=
#cas [nullSpace] !![2, 1; 2, 1]
Out[12]=

basis of the null space, dimension 1

[(−121)]
[![-1/2, 1]]
Domain
ℚ^(2×2)
Input (matrix)
!![2, 1; 2, 1]

Checked by Lean’s kernel: Basis of the null space

(∀ (i : Fin (Nat.succ 0)), !![2, 1; 2, 1].mulVec (![![-(1 / 2), 1]] i) = 0) ∧
  LinearIndependent ℚ ![![-(1 / 2), 1]] ∧
    ∀ (x : Fin 2 → ℚ), !![2, 1; 2, 1].mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![-(1 / 2), 1]] i
The certificate: 1 checked step
  1. Basis of the null space

    (∀ (i : Fin (Nat.succ 0)), !![2, 1; 2, 1].mulVec (![![-(1 / 2), 1]] i) = 0) ∧
      LinearIndependent ℚ ![![-(1 / 2), 1]] ∧
        ∀ (x : Fin 2 → ℚ), !![2, 1; 2, 1].mulVec x = 0 → ∃ c, x = ∑ i, c i • ![![-(1 / 2), 1]] i

    Checked by Lean’s kernel


eigenvalues gives the roots of α2−α−1 as surds. Put into (α,1), each one gives an eigenvector of the Fibonacci matrix:

In[13]:=
#cas [eigenvalues] !![1, 1; 1, 0]
Out[13]=

eigenvalues with multiplicity

[12−52, 12+52]
[1/2 - √5/2, 1/2 + √5/2]
Domain
ℚ^(2×2)
Input (matrix)
!![1, 1; 1, 0]

Checked by Lean’s kernel: The spectrum with algebraic multiplicities

spectrum ℝ !![1, 1; 1, 0] = {1 / 2 - 1 / 2 * √5, 1 / 2 + 1 / 2 * √5} ∧
  !![1, 1; 1, 0].charpoly.roots = {1 / 2 - 1 / 2 * √5, 1 / 2 + 1 / 2 * √5}
The certificate: 1 checked step
  1. The spectrum with algebraic multiplicities

    spectrum ℝ !![1, 1; 1, 0] = {1 / 2 - 1 / 2 * √5, 1 / 2 + 1 / 2 * √5} ∧
      !![1, 1; 1, 0].charpoly.roots = {1 / 2 - 1 / 2 * √5, 1 / 2 + 1 / 2 * √5}

    Checked by Lean’s kernel

Possible Issues (1)

The matrix has to be square:

In[14]:=
#cas [eigenvectors] !![1, 2, 3; 4, 5, 6]
Out[14]=

Error

eigenvectors: the matrix must be square

See Also

eigenvalues · nullSpace · characteristicPolynomial · dot