Why Eigenvalues Matter

Eigenvalues describe the directions along which a linear transformation stretches or compresses space. Behind every PCA dimension, every stability analysis, and every spectral decomposition lies the same question: What scalars λ\lambda satisfy Av=λvA\mathbf{v} = \lambda \mathbf{v} for some non-zero vector v\mathbf{v}? Here we clarify the polynomial road map to those scalars and show how it generalizes from 2×2 matrices to higher dimensions, including why principal minors appear in the coefficients.

The Characteristic Equation

For any square matrix AA, the eigenvalues are the roots of the characteristic polynomial:

χ(λ)=det(AλI)=0.\chi(\lambda) = \det(A - \lambda I) = 0.

2×2 refresher

When A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}, the determinant expands to

χ(λ)=λ2(a+d)λ+(adbc).\chi(\lambda) = \lambda^2 - (a+d)\lambda + (ad - bc).

Hence the trace (a+d)(a+d) appears as the λ\lambda-coefficient and the determinant adbcad-bc is the constant term. Solving the quadratic gives the eigenvalues.

Worked Examples: n=3n=3 and n=4n=4

3×33 × 3

Let

A=[abcdefghi].A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}.

Then AλIA - \lambda I becomes

[aλbcdeλfghiλ],\begin{bmatrix} a - \lambda & b & c \\ d & e - \lambda & f \\ g & h & i - \lambda \end{bmatrix},

For a 3×3 matrix A=[abcdefghi]A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}, the characteristic polynomial expands as

χ(λ)=λ3tr(A)λ2+σ2(A)λdet(A),\chi(\lambda) = \lambda^3 - \text{tr}(A)\,\lambda^2 + \sigma_2(A)\,\lambda - \det(A),

where σ2(A)\sigma_2(A) is the sum of the 2×2 principal minors:

σ2(A)=(aebd)+(aicg)+(eifh).\sigma_2(A) = (ae - bd) + (ai - cg) + (ei - fh).

Principal minors are the determinants of every square submatrix formed by selecting the same rows and columns. They appear because the expansion of det(AλI)\det(A - \lambda I) naturally produces sums over these subdeterminants—each coefficient gathers the contributions of principal minors of increasingly large size, which mathematically captures the pairwise, triple, etc., interactions between eigenvalues.

Notice:

  • The λ3\lambda^3 coefficient is 1 because the polynomial is monic.
  • The tr(A)-\text{tr}(A) term mirrors the 2×2 case.
  • The constant term is det(A)-\det(A).
  • Intermediate coefficients aggregate principal minors.

Numeric example. For

A=[123045006],A = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix},

the trace is 11, σ2(A)=(1402)+(1603)+(4605)=4+6+24=34\sigma_2(A) = (1\cdot4 - 0\cdot2) + (1\cdot6 - 0\cdot3) + (4\cdot6 - 0\cdot5) = 4 + 6 + 24 = 34, and the determinant is 146=241\cdot4\cdot6 = 24. The characteristic polynomial becomes λ311λ2+34λ24\lambda^3 - 11\lambda^2 + 34\lambda - 24, whose roots are the eigenvalues of AA.

4×44 × 4

For a 4×4 matrix, the pattern continues. Without loss of generality, AA produces

χ(λ)=λ4tr(A)λ3+σ2(A)λ2σ3(A)λ+det(A),\chi(\lambda) = \lambda^4 - \text{tr}(A)\,\lambda^3 + \sigma_2(A)\,\lambda^2 - \sigma_3(A)\,\lambda + \det(A),

where:

  • σ2(A)\sigma_2(A) sums all 2×2 principal minors,
  • σ3(A)\sigma_3(A) sums all 3×3 principal minors,
  • Signs alternate as dictated by the expansion of det(AλI)\det(A - \lambda I),
  • Trace and determinant remain the first and last invariants, and the intermediate σk\sigma_k tie into symmetric polynomials of eigenvalues.

Each σk\sigma_k aggregates the determinants of the k×kk \times k principal submatrices because the Leibniz expansion of the determinant iterates over all permutations of row/column pairs. Keeping track of these minors lets us express the characteristic polynomial coefficients without expanding every term manually, which is why they are a compact way to encode the invariant relationships between eigenvalues and the matrix entries.

Numeric example. Take

A=[2010030100400005].A = \begin{bmatrix} 2 & 0 & 1 & 0 \\ 0 & 3 & 0 & 1 \\ 0 & 0 & 4 & 0 \\ 0 & 0 & 0 & 5 \end{bmatrix}.

The trace is 14, σ2(A)\sigma_2(A) collects the 2×2 minors (e.g., 23,24,342\cdot3, 2\cdot4, 3\cdot4 plus the shifts introduced by the 1s), and the determinant is 2345=1202\cdot3\cdot4\cdot5 = 120. The characteristic polynomial becomes λ414λ3+σ2(A)λ2σ3(A)λ+120\lambda^4 - 14\lambda^3 + \sigma_2(A)\lambda^2 - \sigma_3(A)\lambda + 120, encoding the same invariants as before but for four eigenvalues.

These expressions remind us that the characteristic polynomial encodes global constraints: eigenvalues sum to the trace, pairwise products sum to σ2(A)\sigma_2(A), triple products to σ3(A)\sigma_3(A), and so on. Even though solving quartics or higher-degree polynomials analytically becomes impractical, numerical methods target the same invariants, so the conceptual road map stays intact.

Method 1: Manual Calculation (Educational)

import math
 
def calculate_eigenvalues_2x2(A: list[list[float | int]]) -> list[float]:
    if len(A) != 2 or len(A[0]) != 2 or len(A[1]) != 2:
        raise ValueError("Input must be a 2x2 matrix.")
 
    trace = A[0][0] + A[1][1]
    determinant = A[0][0] * A[1][1] - A[0][1] * A[1][0]
 
    discriminant = trace**2 - 4 * determinant
    if discriminant < 0:
        raise ValueError("Matrix has complex eigenvalues in this implementation.")
 
    eigenvalue_1 = (trace + math.sqrt(discriminant)) / 2
    eigenvalue_2 = (trace - math.sqrt(discriminant)) / 2
 
    return [eigenvalue_1, eigenvalue_2]

This hands-on route is excellent for reinforcing how the trace and determinant become coefficients of the characteristic polynomial and how complex eigenvalues arise when the discriminant is negative.

Method 2: NumPy for the General Case

import numpy as np
 
def calculate_eigenvalues_numpy(matrix: list[list[float | int]]) -> list[complex]:
    A = np.array(matrix)
 
    if A.shape[0] != A.shape[1]:
        raise ValueError("Input must be a square matrix.")
 
    eigenvalues = np.linalg.eigvals(A)
    return eigenvalues.tolist()

NumPy hides the polynomial expansion but still solves det(AλI)=0\det(A - \lambda I) = 0. It handles arbitrary square matrices, complex eigenvalues, and higher dimensions effortlessly.

Conclusion

Whether you expand a characteristic polynomial by hand for n=2n=2 or rely on NumPy for n>2n>2, the goal is the same: find the roots of det(AλI)\det(A - \lambda I). The trace and determinant continue to anchor the polynomial’s coefficients, while the intermediate terms encode sums of minors. Understanding this structure helps you make sense of the numerical results produced for large matrices and gives intuition for the algebra that underlies eigenvalue computation.