Eigenbasis Calculator
An eigenbasis is a basis built entirely from eigenvectors: enough independent eigenvectors to span the whole space, which is exactly the condition for a matrix to be diagonalizable. This calculator finds it for a 2×2 or 3×3 matrix. It returns each eigenvalue with its unit eigenvector, the characteristic polynomial, the matrices P and D and P⁻¹ in A = PDP⁻¹ form with a numerical check that PDP⁻¹ reproduces A, and a clear verdict, including the two honest failure cases: a defective matrix and a complex eigenvalue pair. Every result carries a numerical residual check, max |Av – λv|, so the vectors are proved, not just printed. For eigenvalues alone, without the vectors, use the eigen values calculator linked further down.
Real eigenvalues and eigenvectors only; complex pairs are reported but have no real eigenbasis. The eigenvectors listed are the columns of P in A = PDP⁻¹, and D is given as diag(…) of the eigenvalues in the same order. The tool prints P and P⁻¹ as separate matrices and verifies that PDP⁻¹ reproduces A on every diagonalizable result; if P is singular the matrix is not diagonalizable and no inverse is printed.
Quick Answer
For the pre-filled matrix [[4, 1], [2, 3]], the eigenbasis is [0.7071, 0.7071] for λ = 5 and [0.4472, -0.8944] for λ = 2, so the matrix is diagonalizable with D = diag(5, 2) and a verification residual of 2.22e-16. The result also prints P and P⁻¹ and checks that PDP⁻¹ reproduces A. Switch to 3×3 and the pre-filled example gives eigenvalues -5, 3, 6 with a full three-vector basis. Results stay hidden until you click Compute Eigenbasis.
Key takeaways
- An eigenbasis exists exactly when a matrix has n linearly independent eigenvectors: the same condition as diagonalizability, A = PDP⁻¹.
- Every result here is proved on the spot: the residual line max |Av – λv| sits at rounding level (around 1e-13 or smaller) for genuine eigenvectors.
- A repeated eigenvalue does not automatically break the basis. Defective matrices, where the eigenvectors genuinely run short, are named as defective instead of being padded with a duplicated vector.
- The vectors printed are the columns of P, and D is printed as diag(…). The tool also prints P and P⁻¹ as separate matrices and verifies PDP⁻¹ = A numerically on every diagonalizable result.
- Quick Answer
- How to use the eigenbasis calculator
- How the tool computes an eigenbasis
- Worked example: the eigenbasis of [[4, 1], [2, 3]]
- Worked example: a 3×3 eigenbasis with eigenvalues -5, 3 and 6
- The three verdicts: basis found, defective, or complex
- Eigenbasis or eigenvalues only: which page do you need?
- Why an eigenbasis is worth having
- What competing calculators miss
- Frequently asked questions
How to use the eigenbasis calculator
Choose the size, type the matrix, then click Compute Eigenbasis. Each size loads a worked example, so the first click reproduces results you can check against the examples below.
- Matrix size: 2 by 2 or 3 by 3. Changing size rebuilds the grid with that size’s worked example and hides any old result.
- Entries: one number per cell, row by row. Every cell needs a number (0 is fine); an empty or non-numeric cell produces a plain error naming the cell, not a silent wrong answer.
- Compute: the result lists each eigenvalue with its unit eigenvector, the characteristic polynomial, the verdict, and the residual verification line. When an eigenbasis exists it also prints P (the eigenvectors as columns), P⁻¹, and a check line confirming PDP⁻¹ reproduces A.
- Reset: restores the worked example for the current size and hides the results.
How the tool computes an eigenbasis
The method is the textbook route, executed numerically. Eigenvalues come first, as roots of the characteristic polynomial described in Wolfram MathWorld’s eigenvalue entry; then each eigenvector is the null space of (A – λI); then the count of independent eigenvectors decides the verdict.
For 2×2 matrices the eigenvalues are closed form: λ = (tr ± √(tr² – 4det)) / 2 from the polynomial λ² – tr·λ + det = 0, and each eigenvector comes from one row of (A – λI), normalized to unit length. For 3×3 matrices the polynomial is the cubic λ³ – tr·λ² + M·λ – det = 0, with M the sum of the principal 2×2 minors. Its real roots are isolated by bracketing between the cubic’s critical points and refined by bisection; each eigenvector then comes from cross products of the rows of (A – λI), which pick out the null direction directly. One honest accuracy note: because the 3×3 roots are numerical, the printed residual is typically around 1e-13 rather than exactly zero. That is rounding-level agreement, and the residual is printed precisely so you can judge it yourself instead of taking the vectors on faith.
Worked example: the eigenbasis of [[4, 1], [2, 3]]
Trace 7 and determinant 10 give the polynomial λ² – 7λ + 10 = 0, which factors as (λ – 5)(λ – 2). For λ = 5, solving (A – 5I)v = 0 gives the direction [1, 1], normalized to [0.7071, 0.7071]. For λ = 2, the direction is [1, -2], normalized to [0.4472, -0.8944]. Two independent eigenvectors for a 2×2 matrix: an eigenbasis, and the tool’s residual line reads max |Av – λv| = 2.22e-16.
Reading the decomposition off the result: P takes the eigenvectors as its columns in the same order as the eigenvalues, so P = [[0.7071, 0.4472], [0.7071, -0.8944]] and D = [[5, 0], [0, 2]]. The tool prints P⁻¹ alongside P: P⁻¹ = [[0.9428, 0.4714], [0.7454, -0.7454]] (4 decimal places), which matches the hand inversion of P. The check that closes the loop is printed with the result: multiplying P, then D, then P⁻¹ reproduces A, first row [4, 1] and second row [2, 3], and the tool confirms it as “Check: PDP⁻¹ = A ✓”. That multiplication is the real definition of diagonalization, the one stated in Wolfram MathWorld’s matrix diagonalization entry: A = PDP⁻¹ with D diagonal.
Worked example: a 3×3 eigenbasis with eigenvalues -5, 3 and 6
The 3×3 pre-filled example is A = [[-2, -4, 2], [-2, 1, 2], [4, 2, 5]]. Its characteristic polynomial is λ³ – 4λ² – 27λ + 90 = 0, and the tool returns three distinct real eigenvalues, so three independent eigenvectors are guaranteed before any vector is computed.
| Eigenvalue | Unit eigenvector | Spot check |
|---|---|---|
| λ = -5.0000 | [-0.8165, -0.4082, 0.4082] | Using the unnormalized direction [-2, -1, 1]: first row of Av is (-2)(-2) + (-4)(-1) + (2)(1) = 10, and -5 × -2 = 10 |
| λ = 3.0000 | [-0.5345, 0.8018, 0.2673] | Sum check: -5 + 3 + 6 = 4 = trace |
| λ = 6.0000 | [0.0584, 0.3505, 0.9347] | Product check: -5 × 3 × 6 = -90 = determinant |
The verdict line reads “Eigenbasis found. A = PDP⁻¹ with D = diag(-5.0000, 3.0000, 6.0000)”, and the overall residual is max |Av – λv| = 1.28e-13. Three distinct eigenvalues always produce an eigenbasis; the harder cases are repeats, which the next section separates carefully.
For this matrix the tool also prints P = [[-0.8165, -0.5345, 0.0584], [-0.4082, 0.8018, 0.3505], [0.4082, 0.2673, 0.9347]] and P⁻¹ = [[-0.7794, -0.6124, 0.2784], [-0.6236, 0.9354, -0.3118], [0.5187, 0.0000, 1.0374]] (4 decimal places), followed by the line “Check: PDP⁻¹ = A ✓”: the full-precision product PDP⁻¹ reproduces A, so the factorisation is verified, not just stated.
The three verdicts: basis found, defective, or complex
Every run of this tool ends in one of three verdicts. Knowing which one you are looking at matters more than the vectors themselves, because the wrong assumption here (treating a defective matrix as diagonalizable) is a classic source of wrong answers downstream.
Eigenbasis found
n independent eigenvectors exist. Example: [[4, 1], [2, 3]] on this page, or any matrix with all-distinct real eigenvalues. A scalar matrix such as 3I also qualifies: every vector is an eigenvector, and the tool returns the standard basis [1, 0] and [0, 1].
Defective: no eigenbasis
A repeated eigenvalue has fewer independent eigenvectors than its multiplicity. Example: [[2, 1], [0, 2]] has λ = 2 twice but a single eigenvector direction. In 3×3, [[2, 1, 0], [0, 2, 0], [0, 0, 3]] fails the same way. The tool says so instead of printing one vector twice.
No real eigenbasis: complex pair
The eigenvalues are complex, so there are no real eigenvectors at all. Example: the rotation [[0, -1], [1, 0]] gives 0.0000 ± 1.0000i. A 3×3 matrix can mix cases: [[0, -1, 0], [1, 0, 0], [0, 0, 2]] returns its one real eigenvalue, 2, and reports the complex pair honestly.
Two ideas keep these verdicts straight. The algebraic multiplicity of an eigenvalue is how many times it appears as a root of the characteristic polynomial; the geometric multiplicity is how many independent eigenvectors it actually has. A basis fails exactly when some eigenvalue’s geometric multiplicity falls short of its algebraic multiplicity. Each eigenvalue’s eigenvectors, together with the zero vector, form its eigenspace, and the basis for eigenspace calculator works on that space directly. For the complex verdict, the matching directions live over the complex numbers: the complex eigenvalue calculator and the complex eigenvector calculator cover that side of the story.
Eigenbasis or eigenvalues only: which page do you need?
The two pages on this site split the job on a clean line. Eigenvalues are scalars: they answer questions about size, growth, stability and variance share. An eigenbasis is the set of directions those scalars act along, plus the verdict on whether the directions are complete. If your question is “what are the eigenvalues and the characteristic polynomial”, the eigen values calculator is the faster page and shows the polynomial for both 2×2 and 3×3 matrices. If your question involves matrix powers, solving a system of differential equations by decoupling it, or writing A = PDP⁻¹, you need the vectors and the verdict, which is this page. Neither page handles matrices larger than 3×3; for those, a numerical library such as the one behind the MathWorks eig function is the right tool.
Why an eigenbasis is worth having
With an eigenbasis, powers stop being work: A raised to the k is P times D raised to the k times P⁻¹, and raising a diagonal matrix means raising each entry, so A¹⁰⁰ costs three matrix multiplications instead of ninety-nine. The same trick drives matrix exponentials for systems of differential equations, long-run behaviour of Markov-style iterations, and the principal directions in PCA. The teaching treatment in Gilbert Strang’s MIT OpenCourseWare linear algebra course builds to exactly this payoff, and adds the guarantee worth remembering: every real symmetric matrix has a full orthonormal eigenbasis (the spectral theorem), so symmetric matrices never land in the defective column.
What competing calculators miss
- Silent duplication on defective matrices: some tools print the same eigenvector twice for a repeated eigenvalue and present the pair as a basis. It is not one: the vectors are not independent, and any P built from them is singular. This tool detects the shortfall and names the matrix defective.
- Aborting on complex eigenvalues: a common pattern is an alert or an empty result when the pair turns complex. Here the pair is displayed, the real roots of a 3×3 are still returned, and the verdict explains why no real basis exists.
- No proof of the vectors: most tools print eigenvectors with no check. The residual line max |Av – λv| on every result here is a one-number audit: near zero means the pairs genuinely satisfy Av = λv.
- P and P⁻¹ without a check: diagonalization tools that print P and P⁻¹ matrices look complete, but a printed P⁻¹ computed from a defective set is fiction, and an unchecked inverse proves nothing. This page prints P and P⁻¹ only when a genuine eigenbasis exists, names defective matrices instead of inventing an inverse for them, and verifies PDP⁻¹ = A numerically on every diagonalizable result.
Frequently asked questions
An eigenbasis is a basis of the whole space made entirely of eigenvectors: n linearly independent eigenvectors of an n by n matrix. It exists exactly when the matrix is diagonalizable. For [[4, 1], [2, 3]] the vectors [0.7071, 0.7071] and [0.4472, -0.8944] form an eigenbasis, because they are independent and each one satisfies Av = λv for its own eigenvalue.
It solves the characteristic equation det(A – λI) = 0. For a 2×2 matrix the polynomial is λ² – tr·λ + det = 0 and the roots come from the quadratic formula in closed form. For a 3×3 matrix the polynomial is the cubic λ³ – tr·λ² + M·λ – det = 0, where M is the sum of the principal 2×2 minors; its real roots are bracketed between the cubic’s critical points and refined by bisection.
For each eigenvalue λ it finds the null space of (A – λI): the nonzero vectors v with (A – λI)v = 0. In 3×3 the null direction comes from cross products of the rows of (A – λI). Any nonzero multiple of an eigenvector is also an eigenvector, so this tool normalizes each one to unit length, the same convention numerical libraries use.
No. A matrix with a repeated eigenvalue may have too few independent eigenvectors (a defective matrix), and a matrix with complex eigenvalues has no real eigenvectors at all. Over the complex numbers every square matrix has eigenvalues, but a real eigenbasis exists only when all eigenvalues are real and every eigenvalue supplies its full count of independent eigenvectors.
Defective means some eigenvalue’s geometric multiplicity (its number of independent eigenvectors) is smaller than its algebraic multiplicity (its count as a root of the characteristic polynomial). The standard example is [[2, 1], [0, 2]]: λ = 2 has algebraic multiplicity 2 but only one eigenvector direction, so no eigenbasis exists and the matrix cannot be diagonalized.
Diagonalization is writing A = PDP⁻¹, where the columns of P are eigenvectors and D is the diagonal matrix of the matching eigenvalues; it is possible exactly when an eigenbasis exists. This tool prints all three matrices: P with the unit eigenvectors as its columns in eigenvalue order, D as diag(…) in the verdict line, and P⁻¹ computed by Gauss-Jordan inversion of P. It also prints a verification line confirming that PDP⁻¹ reproduces A. When no eigenbasis exists (a defective matrix or a complex pair) there is no P⁻¹ to print, and the tool says so instead.
Yes. Real matrices can have complex eigenvalues, always in conjugate pairs, as with the rotation matrix [[0, -1], [1, 0]] whose eigenvalues are +i and -i. Complex eigenvalues have no real eigenvectors, so no real eigenbasis exists; this tool displays the pair and states that plainly instead of failing or returning an empty result.
Check that Av = λv: multiply the matrix by the vector and compare with the eigenvalue times the vector. This tool does it for you and prints the largest component-wise difference as max |Av – λv|. A value at rounding level, such as 2.22e-16 for the 2×2 example or 1.28e-13 for the 3×3 example, means the pairs are verified; a large residual would mean something is wrong.
Yes, over the reals. The spectral theorem guarantees that every real symmetric matrix has real eigenvalues and a full orthonormal eigenbasis, so a symmetric matrix is never defective and never produces a complex pair. The 3×3 example [[-2, -4, 2], [-2, 1, 2], [4, 2, 5]] is not symmetric, but the 2×2 matrix [[2, 1], [1, 2]] is, and its eigenvectors come out perpendicular, as the theorem predicts.
Add This Calculator to Your Website
Embed this calculator on your own site with the code below. Pick a size to preview it live, then copy the code.
Powered by Calculator Zilo
References
- Wolfram MathWorld. Matrix Diagonalization. Accessed October 21, 2026.
- Wolfram MathWorld. Eigenvalue. Accessed October 21, 2026.
- Wolfram MathWorld. Eigenvector. Accessed October 21, 2026.
- Strang, G., MIT OpenCourseWare. Linear Algebra (18.06SC). Accessed October 21, 2026.
- MathWorks. eig: Eigenvalues and Eigenvectors. Accessed October 21, 2026.
- Wolfram Language Documentation. Eigenvectors. Accessed October 21, 2026.
