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 satisfy for some non-zero vector ? 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 , the eigenvalues are the roots of the characteristic polynomial:
2×2 refresher
When , the determinant expands to
Hence the trace appears as the -coefficient and the determinant is the constant term. Solving the quadratic gives the eigenvalues.
Worked Examples: and
Let
Then becomes
For a 3×3 matrix , the characteristic polynomial expands as
where is the sum of the 2×2 principal minors:
Principal minors are the determinants of every square submatrix formed by selecting the same rows and columns. They appear because the expansion of 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 coefficient is 1 because the polynomial is monic.
- The term mirrors the 2×2 case.
- The constant term is .
- Intermediate coefficients aggregate principal minors.
Numeric example. For
the trace is 11, , and the determinant is . The characteristic polynomial becomes , whose roots are the eigenvalues of .
For a 4×4 matrix, the pattern continues. Without loss of generality, produces
where:
- sums all 2×2 principal minors,
- sums all 3×3 principal minors,
- Signs alternate as dictated by the expansion of ,
- Trace and determinant remain the first and last invariants, and the intermediate tie into symmetric polynomials of eigenvalues.
Each aggregates the determinants of the 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
The trace is 14, collects the 2×2 minors (e.g., plus the shifts introduced by the 1s), and the determinant is . The characteristic polynomial becomes , 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 , triple products to , 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 . It handles arbitrary square matrices, complex eigenvalues, and higher dimensions effortlessly.
Conclusion
Whether you expand a characteristic polynomial by hand for or rely on NumPy for , the goal is the same: find the roots of . 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.