How to use the calculator
Type or paste a square matrix into Real matrix A (2×2 or 3×3). The calculator detects the size from the text, so there is no separate size control.
- Put one row per line, or separate rows with semicolons.
2 1; 1 2and the same matrix written on two lines are equivalent. - Separate the entries in a row with spaces, commas or tabs.
- Type negative numbers with the keyboard hyphen (
-). - Decimals and scientific notation such as
-0.5or1e-12are accepted. - Every entry must have an absolute value of at most 1,000,000. Zero is allowed, but any nonzero entry must have magnitude at least . The field holds at most 1,000 characters.
Fractions such as 1/2, expressions, complex entries, rectangular matrices, sizes other than 2×2 and 3×3, empty input, mismatched row lengths and nonfinite numbers all produce an error. In that case the output fields show an em dash and the plot is cleared. Enter fractions as decimals instead.
The Examples selector loads a preset matrix. If you edit the entries, the selector changes to Custom matrix. Choosing Custom matrix yourself leaves your current entries unchanged.
| Example | Input | What it shows |
|---|---|---|
| Symmetric 2×2 | 2 1; 1 2 |
Two real eigenvalues, 1 and 3. This is the default and the reset matrix. |
| Complex pair | 0 -1; 1 0 |
A real matrix whose eigenvalues are and . |
| Repeated root | 2 1; 0 2 |
The eigenvalue 2 appears twice as a root but has only one independent eigenvector. |
| Custom matrix | your entries | Any matrix that meets the input rules above. |
Copy copies the input matrix, the results and any uncertainty guidance. Print opens the browser print dialog, where you can also save a PDF. Reset restores the symmetric 2×2 preset and opens Calculation details.
What the results mean
Eigenvalues λ lists the computed roots of the characteristic polynomial, ordered by increasing real part, with the imaginary part breaking ties. A repeated root appears as many times as its computed algebraic multiplicity. For 2 1; 0 2 the list reads 2, 2.
Normalized eigenvectors / eigenspace bases pairs each distinct eigenvalue with one or more unit-length basis vectors for its eigenspace. If no basis could be found, the entry is labeled unresolved.
Calculation details expands into three parts:
- Algebraic and geometric multiplicities for each distinct eigenvalue.
- Characteristic polynomial det(λI − A).
- Calculation steps, which show the polynomial, list the computed roots and describe the nullspace and normalization operations. They do not show every row operation or a symbolic derivation of every root.
The complex-plane plot puts on the horizontal axis and on the vertical axis. Real eigenvalues lie on the horizontal axis. Equal computed roots share one point, and the label carries a repetition count. The axis scale adapts to each matrix, so compare plots by their labels rather than by how far apart the points look. The plot shows eigenvalues only, not eigenvector directions.
Inputs and calculations use double precision. Displayed numbers use up to six significant digits with trailing zeros dropped. That is a display choice, not the limit of the stored value.
The mathematics behind an eigenvalue solver
Eigenvalues, eigenvectors and eigenspaces
For a square matrix , a number is an eigenvalue if some nonzero vector satisfies
The vector is an eigenvector for . When , the matrix maps to a nonzero scalar multiple on the same real or complex line. When , it maps to zero. Rearranging gives , where is the identity matrix of the same size as . The set of all solutions is the eigenspace
It includes the zero vector, but eigenvectors are the nonzero members. Any nonzero multiple of an eigenvector is also an eigenvector, so an eigenvector is only determined up to scale.
The characteristic polynomial
A nonzero solution exists exactly when is singular. So the eigenvalues are the roots of the characteristic polynomial. This calculator uses the monic form
Let be the sum of the diagonal entries and .
For a 2×2 matrix
with and . The quadratic formula gives
If there are two distinct real eigenvalues. If there is one repeated real eigenvalue. If there is a complex conjugate pair.
For a 3×3 matrix
where is the sum of the three principal 2×2 minors. A principal minor uses the same pair of indices for its rows and columns, so for a 3×3 matrix these come from rows and columns , and .
Two checks follow from this. The eigenvalues, counted with algebraic multiplicity, sum to and multiply to . For a 3×3 matrix, the sum of the products of the eigenvalues taken in pairs equals .
Algebraic and geometric multiplicity
The algebraic multiplicity of an eigenvalue is the number of times it occurs as a root of . The geometric multiplicity is the dimension of its eigenspace:
computed over the field that contains the eigenvalue. For a complex eigenvalue, the rank is taken over the complex numbers.
For an exact eigenvalue, the geometric multiplicity is at least 1 and at most the algebraic multiplicity. The two can differ. In 2 1; 0 2 the root 2 occurs twice, but has rank 1, so the eigenspace has dimension . A matrix with a root whose geometric multiplicity is smaller than its algebraic multiplicity is called defective, and it cannot be diagonalized.
Complex eigenvalues of real matrices
A real matrix has a real characteristic polynomial, so any nonreal roots come in complex conjugate pairs. If , then taking the complex conjugate of both sides gives . So the conjugate of an eigenvector for is an eigenvector for . A real matrix can therefore have complex eigenvectors, even though all of its entries are real.
A zero eigenvalue is valid. It means is singular, because . For the zero matrix, every vector lies in the eigenspace for , and the coordinate unit vectors form a basis.
Eigenvalues and eigenvectors with steps
The examples below show how to verify the results by hand. You can load or type each matrix to compare with the numerical output.
Example 1: symmetric 2×2 matrix
Take , which is the default input 2 1; 1 2.
- The trace is and the determinant is .
- The characteristic polynomial is , so the eigenvalues are and .
- For , . The equation gives the basis vector . Its Euclidean norm is , so the unit vector is .
- For , . The equation gives , and the unit vector is .
The calculator displays these same vectors for this preset. Because this matrix is symmetric, its eigenvectors for distinct eigenvalues are orthogonal, which you can confirm by checking that .
Example 2: complex pair
Take , which is the input 0 -1; 1 0. It rotates the plane by 90°, so no nonzero real vector maps to a scalar multiple of itself.
Here and , so and the eigenvalues are and . For , the first row of gives , so . A basis vector is . The complex norm is , so the unit vector is .
Check it directly: , and . Taking the conjugate gives for . Each eigenvalue has algebraic and geometric multiplicity 1. On the plot, the two eigenvalues sit at and .
Example 3: repeated root with a missing eigenvector
Take , which is the input 2 1; 0 2. Here , so 2 has algebraic multiplicity 2.
has rank 1, so the nullspace is one-dimensional. Setting the free coordinate gives the basis vector . The geometric multiplicity is 1, which is less than 2. The eigenvalues list shows 2, 2, but the eigenspace has only one direction.
Example 4: a 3×3 matrix
Take
which you can enter as 2 -1 0; -1 2 -1; 0 -1 2.
- The trace is .
- The principal 2×2 minors are for rows and columns , for , and for . So .
- Expanding along the first row gives .
- The characteristic polynomial is .
- Testing gives , so is a factor. Dividing gives , and the quadratic factor has roots .
The eigenvalues are therefore , and , listed in increasing order. Check: their sum is 6, their product is , and their pairwise products sum to .
For the eigenvectors, solve for each root:
- : the basis vector has norm , so the unit vector is .
- : the first row gives and the second gives . The basis vector has norm , so the unit vector is .
- : the basis vector also has norm 2, so the unit vector is .
For , row 2 of is for this vector, as it should be.
Normalized eigenvectors
A normalized eigenvector has Euclidean length 1. For a vector the length is
with the complex magnitude when entries are complex. Dividing by gives a unit vector in the same direction.
Normalization fixes the length but not the sign or phase. If is a unit eigenvector, so is , and for a complex eigenvector so is for any angle . A different program may report the opposite sign or a different phase and still be correct. Compare results by checking , or by checking that two vectors are scalar multiples of each other.
When an eigenvalue has geometric multiplicity above 1, the calculator builds a nullspace basis by row reduction. It sets each free coordinate to 1 in turn and the others to 0. Each basis vector is normalized on its own. These vectors are not necessarily orthogonal to each other, and any other basis of the same eigenspace is equally valid.
What the calculator does internally
The calculator balances the matrix by power-of-two diagonal similarity and separately rescales it by a single scalar. It uses this balanced, rescaled matrix for the numerical eigenspace calculation, including when it can find the roots directly. If and , then maps the eigenvector back to the original coordinates before normalization. The separate scalar rescaling is accounted for when converting eigenvalues between the original and solver coordinates.
The solver chooses the root calculation separately:
- Integer matrices: when an exact integer discriminant certifies repeated roots, the solver uses that information to compute the roots.
- Triangular matrices: the solver can read the eigenvalues directly from the diagonal.
- General 2×2 matrices: a cancellation-resistant quadratic calculation is used.
- General 3×3 matrices: the math.js QR-based eigensolver supplies candidate roots, which are checked against the characteristic polynomial. If the iteration fails or the polynomial check rejects the candidates, a closed-form cubic calculation takes over.
The solver also checks the residual on the scaled problem.
Floating-point results versus exact mathematics
Several statements above are exact identities. The trace equals the sum of the eigenvalues, the determinant equals their product, and the geometric multiplicity never exceeds the algebraic multiplicity. A double-precision calculation can only approximate them. Treat the output as numerical evidence, not as a proof.
Display rounding. Values show up to six significant digits. Two different roots can round to the same label. As a verified boundary case, 1 0; 0 1.00000001 has two distinct eigenvalues, 1 and 1.00000001, yet the display can read 1, 1. That display does not establish a repeated root. For this diagonal matrix the eigenvalues are the diagonal entries, so they are distinct.
Sensitivity. A small residual shows that nearly satisfies . It does not guarantee that is accurate to six digits when the eigenvalue is sensitive to small changes in the input. Consider
Its discriminant is , so its eigenvalues are . With the roots are . A change of in one entry moves the eigenvalues by . Matrices near a repeated root with a missing eigenvector behave this way.
Rank decisions. Geometric multiplicity depends on a rank, and rank depends on deciding whether a small number is zero. When eigenvalues are very close, that decision becomes unreliable.
The uncertainty warning. The calculator shows a separate Numerical uncertainty warning when it detects close roots, distinct roots with identical display labels, strongly mixed entry scales, or unreliable rank or residual checks. In that case the multiplicity panel displays Uncertain — use higher precision, and any vectors shown should be treated as provisional. If you see this, use higher-precision or exact symbolic arithmetic, such as a computer algebra system working with rational numbers.
Common questions
Does this eigenvalue solver handle complex matrices? No. The input must be a real matrix, but a real matrix can still have complex eigenvalues and eigenvectors, and the calculator reports them.
Why is my 3×3 result listed in a different order than another tool? This calculator orders eigenvalues by increasing real part, then by imaginary part. Other tools may use a different order. The set of eigenvalues is the same.
Why does a repeated eigenvalue have fewer eigenvectors than its count? The algebraic multiplicity counts roots of the polynomial. The geometric multiplicity counts independent eigenvectors. The second can be smaller, as in 2 1; 0 2.
Why can my eigenvector differ from a textbook answer? Eigenvectors are defined only up to a nonzero scalar factor, so signs, phases and basis choices can differ. Check rather than comparing the numbers directly.
What happens if I enter a fraction such as 1/2? The input is rejected. Enter 0.5 instead.
Can I use this to check homework? Yes. Compute the trace, determinant and (for 3×3) the principal minors by hand, compare them with the characteristic polynomial in Calculation details, then verify each eigenvector by substituting it into .
Read the formula definitions, supported input ranges, and limitations before using this estimate.