What this spectral decomposition calculator does
This calculator analyzes a real 2×2 matrix by computing its eigenvalues and eigenvectors. When your input matrix is symmetric (a12 = a21), it additionally provides a true real spectral decomposition (also called the symmetric eigen-decomposition):
A = QΛQᵀ
where Q is orthogonal (its columns are orthonormal eigenvectors) and Λ is diagonal (the eigenvalues). This representation is the cleanest way to see how the matrix stretches/compresses space along perpendicular “principal directions.”
Terminology: spectral decomposition vs diagonalization
- Spectral decomposition (real, orthogonal): typically means A = QΛQᵀ and requires A to be real symmetric (or more generally normal with an orthonormal basis). For a real 2×2, symmetry is the common case.
- Diagonalization (general): a matrix may be written A = PΛP⁻¹ if it has enough independent eigenvectors. Here P need not be orthogonal, and for some matrices it may not exist over the reals.
- Complex eigenvalues: a real non-symmetric 2×2 can produce complex conjugate eigenvalues, in which case there is no real diagonalization and no real spectral form.
Matrix and core formulas (2×2)
Let
The characteristic polynomial is
p(λ) = det(A − λI) = λ² − (tr A)λ + det(A)
with
- tr A = a11 + a22 (trace)
- det(A) = a11a22 − a12a21 (determinant)
The eigenvalues are the roots of the quadratic:
λ1,2 = (tr A ± √Δ) / 2, where Δ = (tr A)² − 4 det(A).
- If Δ > 0, there are two distinct real eigenvalues.
- If Δ = 0, the eigenvalue is repeated (λ1 = λ2).
- If Δ < 0, the eigenvalues are complex (no real spectral decomposition).
How to use the calculator
- Choose a preset to quickly load a common 2×2 matrix (identity, covariance-like example, saddle/indefinite, etc.), or keep Custom entries.
- Enter a11, a12, a21, a22. Values may be integers or decimals.
- If your matrix should be symmetric, enable Enforce symmetry so a21 follows a12.
- Click Compute spectral decomposition to see eigenvalues, eigenvectors, classification (definiteness), conditioning, and the reconstruction check.
Interpreting results
Eigenvalues (λ)
Eigenvalues tell you the scaling along eigenvector directions. For symmetric matrices they also classify the associated quadratic form:
- Positive definite: λ1 > 0 and λ2 > 0
- Negative definite: λ1 < 0 and λ2 < 0
- Indefinite: one positive, one negative
- Semidefinite: at least one eigenvalue is (numerically) zero and none have the opposite sign
Eigenvectors and angles
An eigenvector v satisfies Av = λv. For symmetric matrices, eigenvectors for distinct eigenvalues are orthogonal, so you can interpret the reported angle as a rotation from the standard x-axis toward the principal direction.
QΛQᵀ reconstruction (symmetric case)
If the matrix is symmetric and has a real orthonormal eigenbasis, the tool can build:
- Q: columns are unit eigenvectors
- Λ: diagonal matrix of eigenvalues
- QΛQᵀ: should match A up to floating-point rounding
If you see a tiny mismatch, that is usually normal numeric error; large mismatch suggests the matrix is not symmetric, not diagonalizable in the assumed form, or is ill-conditioned.
Conditioning (2×2 intuition)
For symmetric positive definite matrices, a common condition number proxy is κ ≈ |λmax| / |λmin|. Large ratios mean the matrix squashes strongly in one direction compared to another, and small perturbations can change computed eigenvectors noticeably.
Worked example (symmetric covariance-like matrix)
Use the matrix:
A = [ 3 1.5; 1.5 2 ]
Because A is symmetric, a real spectral decomposition exists. The calculator will report two real eigenvalues, one larger (the “principal variance”) and one smaller. The first eigenvector’s angle indicates the direction of maximum stretch/variance; the second is perpendicular. Since both eigenvalues are positive, the classification reads positive definite. The condition number (largest divided by smallest eigenvalue) indicates how elongated the associated ellipse is.
Comparison table: common 2×2 cases
| Case |
Eigenvalues |
Eigenvectors |
Decomposition you can expect |
Typical notes |
| Symmetric, distinct eigenvalues |
Real, λ1 ≠ λ2 |
Two orthogonal eigenvectors |
A = QΛQᵀ with Q orthogonal |
Most stable/standard “spectral decomposition” setting |
| Symmetric, repeated eigenvalue |
Real, λ1 = λ2 |
Eigenvectors not unique |
A = QΛQᵀ still valid |
Angle/eigenvector direction may change with tiny perturbations |
| Non-symmetric, real distinct eigenvalues |
May be real |
Not necessarily orthogonal |
Possibly A = PΛP⁻¹ (if diagonalizable) |
“QΛQᵀ” generally does not apply |
| Non-symmetric, complex eigenvalues |
Complex conjugate pair |
Complex eigenvectors |
No real diagonalization / no real spectral form |
Often corresponds to rotation/spiral behavior in dynamics |
Assumptions & limitations
- Orthogonal spectral decomposition requires symmetry: A = QΛQᵀ is guaranteed for real symmetric matrices. If your matrix is not symmetric, treat outputs as a general eigen-analysis rather than a promise of an orthogonal decomposition.
- Complex eigenvalues: if Δ < 0, eigenvalues are complex and a real spectral decomposition/real diagonalization is not available. The tool should flag this so you don’t misinterpret results.
- Repeated/near-repeated eigenvalues: eigenvectors can be numerically unstable (small input changes can rotate the eigenvectors substantially while eigenvalues barely change).
- Floating-point rounding: orthogonality checks and reconstruction checks use numerical tolerances; tiny nonzero residuals are normal.
- 2×2 scope: results and conditioning heuristics are tailored to 2×2 matrices; higher-dimensional matrices require more careful numerical methods and may exhibit additional phenomena.