Diagonalize Matrix Calculator

Enter the four entries of a 2×2 matrix to find its eigenvalues, eigenvectors, and its diagonalization A = PDP⁻¹ (or see exactly why it can't be diagonalized).

Quick Facts

Characteristic polynomial
λ² − Tλ + Det = 0
T = a₁₁ + a₂₂ (trace); Det = a₁₁a₂₂ − a₁₂a₂₁.
Eigenvalue formula
λ = (T ± √(T² − 4·Det)) / 2
Two distinct real roots when T² − 4Det > 0.
Diagonalization
A = P D P⁻¹
Columns of P are eigenvectors; D holds the matching eigenvalues.
Diagonalizable test
Needs 2 independent eigenvectors
Guaranteed automatically when the two eigenvalues are distinct.

Your Results

Calculated
Eigenvalues
-
Roots of λ² − Tλ + Det = 0
Eigenvector for λ₁
-
Unit vector solving (A − λ₁I)v = 0
Eigenvector for λ₂
-
Unit vector solving (A − λ₂I)v = 0
Diagonalization
-
P and D such that A = PDP⁻¹

Ready

Enter the four matrix entries, then press Calculate.

Formula and Method for Diagonalizing a 2×2 Matrix

A square matrix A is diagonalizable when it can be written as A = PDP⁻¹, where D is a diagonal matrix holding A's eigenvalues and P is a matrix whose columns are the corresponding eigenvectors. This calculator takes the four entries of a 2×2 matrix, solves for its eigenvalues from the characteristic polynomial, finds the matching eigenvectors, and reports P and D — or explains why no such real decomposition exists.

How the calculation works

For A = [[a₁₁, a₁₂], [a₂₁, a₂₂]], the eigenvalues are the roots of the characteristic equation det(A − λI) = 0, which expands to λ² − Tλ + Det = 0, where T = a₁₁ + a₂₂ (the trace) and Det = a₁₁a₂₂ − a₁₂a₂₁ (the determinant). By the quadratic formula, λ = (T ± √(T² − 4·Det)) / 2. For each eigenvalue λ, the matching eigenvector solves the homogeneous system (A − λI)v = 0. When the discriminant T² − 4Det is positive, the two eigenvalues are real and distinct, which guarantees two independent eigenvectors and a valid diagonalization. When the discriminant is exactly zero, the matrix has one repeated eigenvalue λ = T/2; it is diagonalizable only if A already equals λI (a scalar matrix) — otherwise it has just one independent eigenvector and is called defective, meaning it cannot be diagonalized with real matrices. When the discriminant is negative, the eigenvalues form a complex-conjugate pair p ± qi; the matrix is diagonalizable over the complex numbers but has no real eigenvector basis, so P and D cannot be built from real numbers alone.

Common mistakes

  • Assuming every matrix diagonalizes: a repeated eigenvalue with only one independent eigenvector (e.g. [[1,1],[0,1]]) is defective and has no P, D decomposition over the reals.
  • Sign and scale errors in eigenvectors: any nonzero multiple of an eigenvector is also a valid eigenvector — a different scaling or sign is not a mistake, it is the same direction.
  • Mixing up algebraic and geometric multiplicity: a repeated root of the characteristic polynomial (algebraic multiplicity 2) does not guarantee two independent eigenvectors (geometric multiplicity 2) — you must check both.
  • Arithmetic slips solving (A − λI)v = 0: double-check the sign when subtracting λ from the diagonal entries before solving the resulting 2×2 linear system.

Real-world applications

  • Solving systems of linear differential or difference equations by decoupling them into independent scalar equations along each eigenvector direction.
  • Computing large matrix powers efficiently: Aⁿ = PDⁿP⁻¹, where Dⁿ simply raises each diagonal eigenvalue to the n-th power.
  • Analyzing the stability of dynamical systems and Markov chains, where the sign and magnitude of eigenvalues determine long-run behavior.
  • Simplifying quadratic forms and principal component analysis, both of which rely on diagonalizing a coefficient or covariance matrix.

Frequently Asked Questions

What does it mean to diagonalize a matrix?
Diagonalizing a matrix A means writing it as A = PDP⁻¹, where D is a diagonal matrix of A's eigenvalues and P is a matrix whose columns are the corresponding eigenvectors. This form makes operations like computing powers or exponentials of A much simpler.
How do I find the eigenvalues of a 2×2 matrix?
Solve the characteristic equation λ² − Tλ + Det = 0, where T is the trace (a₁₁ + a₂₂) and Det is the determinant (a₁₁a₂₂ − a₁₂a₂₁). The quadratic formula gives λ = (T ± √(T² − 4Det)) / 2.
When is a 2×2 matrix not diagonalizable?
A 2×2 matrix fails to be diagonalizable over the real numbers when it has a repeated eigenvalue but only one independent eigenvector, called a defective matrix. For example, [[1,1],[0,1]] has a repeated eigenvalue λ = 1 but only one independent eigenvector, so it cannot be diagonalized.
Can a matrix with complex eigenvalues be diagonalized?
Yes, but only using complex-valued P and D. If the discriminant T² − 4Det is negative, the eigenvalues are a complex-conjugate pair p ± qi, and no real matrix P can diagonalize A — the matrix is diagonalizable over the complex numbers only.