Saved

Press the star next to a tool's name to save it.

All my tools

Matrix Calculator

Use this matrix calculator to add, scale, multiply and raise matrices to a power, find the determinant, inverse, rank and null space, and work out LU, Cholesky, QR, SVD and polar decompositions, the pseudoinverse, eigenvalues, norms and the Kronecker product.

Restored your last values ·

Type matrix A with one row on each line, or with rows separated by a semicolon, and the numbers in each row separated by spaces or commas. Choose what you want. For adding, subtracting and multiplying, a second box for matrix B appears. You can use up to 8 rows.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Choose what you want, type your matrix, then press Work out the result.

A matrix calculator does the usual jobs of matrix algebra in one place: it adds, scales, multiplies and raises matrices to a power, finds the determinant, inverse, rank and null space, reduces a matrix to row echelon form, and works out LU, Cholesky, QR, singular value and polar decompositions, the pseudoinverse, eigenvalues, norms and the Kronecker product. Everything runs in your browser.

How to use the matrix calculator

  1. Choose what you want from the list.
  2. Type matrix A, one row on each line, up to 8 rows, or separate the rows with a semicolon, as in 1 2; 3 4.
  3. For a sum, product or Kronecker product, type matrix B. For a power or a scalar, type the number in its box.
  4. Press Work out the result. The answer is shown row by row, with the size, determinant or other numbers beside it.

Determinant, inverse, adjugate and cofactors

The determinant is one number that says whether a square matrix can be inverted. A square matrix is invertible exactly when its determinant is not zero, and the inverse is the adjugate divided by the determinant [1]. The adjugate is the transpose of the cofactor matrix, and each cofactor is a minor with the sign (−1) raised to the row plus the column. For the matrix with rows 4 7 and 2 6, the determinant is 4 times 6 minus 7 times 2, which is 10, and the inverse has rows 0.6 and −0.7, then −0.2 and 0.4.

Row reduction, rank and null space

Gaussian elimination uses three row operations to bring a matrix to row echelon form, and taken all the way it gives the reduced form, where each pivot is 1 [2]. The rank is the number of pivots. The pivot columns form a basis of the column space. The null space, also called the kernel, is the set of solutions of Ax = 0, and the rank plus the nullity equals the number of columns [5]. For the matrix with rows 2 3 5 and −4 2 3, the rank is 2, the nullity is 1, and the basis vector is (−1, −26, 16), scaled to whole numbers [5].

Adding, scaling, multiplying and powers

Two matrices of the same size are added entry by entry. Multiplying a matrix by a number multiplies every entry [11]. To multiply A by B, the number of columns of A must match the number of rows of B, and each entry is a row of A multiplied term by term with a column of B and summed. The Hadamard product multiplies the entries in the same places. A power Aⁿ multiplies a square matrix by itself n times, with A⁰ the identity matrix and a negative power taken through the inverse, which is our own working. The matrix with rows 1 1 and 1 0 raised to the power 10 has rows 89 55 and 55 34.

LU, Cholesky and QR decompositions

An LU decomposition writes a matrix as a lower triangular matrix L, with ones on its diagonal, times an upper triangular matrix U. The matrix with rows 4 3 and 6 3 splits into L with rows 1 0 and 1.5 1, and U with rows 4 3 and 0 −1.5 [3]. The Cholesky decomposition applies to a symmetric, positive definite matrix and writes it as L times its transpose. A QR decomposition writes A as an orthogonal matrix Q times an upper triangular matrix R [6]. The calculator uses Gram–Schmidt on the columns, which needs independent columns and at least as many rows as columns, and it keeps the diagonal of R positive, which makes the answer unique [6]. For the matrix with rows 12 −51 4, 6 167 −68 and −4 24 −41, R has rows 14 21 −14, 0 175 −70 and 0 0 35 [6].

Singular values, SVD, pseudoinverse and polar decomposition

The singular value decomposition writes A as U times a diagonal matrix of singular values times the transpose of V. The non-zero singular values are the square roots of the non-zero eigenvalues of AᵗA, and they are listed from largest to smallest [7]. For the 4 by 5 matrix with rows 4 8 8 0 0, −3 −6 −6 0 0, −4 4 −2 0 0 and 0 0 0 −4 3, they are 15, 6, 5 and 0, so the rank is 3 [7]. The calculator shows the compact form. The pseudoinverse is VΣ⁺Uᵗ, where Σ⁺ takes the reciprocal of each non-zero entry [8]. The matrix with rows 1 0 and 2 0 has the pseudoinverse with rows 0.2 0.4 and 0 0 [8]. A tolerance decides which singular values count as zero [8]. A square matrix A also splits as U times P, where P is the positive semi-definite square root of AᵗA. It is unique when A is invertible [9].

Eigenvalues and the characteristic polynomial

An eigenvalue λ of a square matrix A makes the determinant of A minus λ times the identity zero. The matrix with rows 2 1 and 1 2 has trace 4 and determinant 3, so its characteristic polynomial is t² − 4t + 3 and its eigenvalues are 3 and 1. The calculator gives a unit eigenvector for each, shows complex eigenvalues, and offers diagonalization.

Norms, the condition number and the Kronecker product

The 1-norm is the largest column sum of absolute values, the infinity norm is the largest row sum, and the Frobenius norm is the square root of the sum of the squares of all the entries [4]. For the matrix with rows −3 5 7, 2 6 4 and 0 2 8, the 1-norm is 19 and the infinity norm is 15. The condition number is the norm of A times the norm of its inverse,, large when the matrix is nearly singular. The Kronecker product of an m by n matrix A and a p by q matrix B is the block matrix whose blocks are the entries of A times B, of size pm by qn [10]. The matrix with rows 1 2 and 3 4 with the matrix with rows 0 5 and 6 7 gives a 4 by 4 matrix whose last row is 18 21 24 28 [10].

Common mistakes

  • Multiplying in the wrong order. A times B is not the same as B times A.
  • Expecting an inverse for every matrix. A zero determinant means there is none. The pseudoinverse still exists.
  • Giving QR a matrix with fewer rows than columns. Use the SVD instead.
  • Forgetting the signs of cofactors. The sign alternates like a checkerboard.
  • Reading rounding as exact. Values are rounded to 6 significant digits.

What next

Use this often? Add Matrix to your Home screen.

Frequently asked questions

What is a matrix calculator?

A tool that does matrix algebra for you: sums, products, powers, determinant, inverse, rank, null space, row reduction, decompositions, pseudoinverse, eigenvalues and norms.

When does a matrix have an inverse?

Only when it is square and its determinant is not zero. The inverse is the adjugate divided by the determinant. Without one, the pseudoinverse still exists.

How do you find the null space of a matrix?

Row reduce the matrix, then give each free column the value 1 and solve for the pivot columns. The matrix with rows 2 3 5 and −4 2 3 has the basis vector (−1, −26, 16).

What is the difference between QR and SVD?

QR writes A as an orthogonal matrix times an upper triangular one. The SVD writes it as U times singular values times V transposed, and works for any shape.

What is the pseudoinverse used for?

It gives the best least-squares answer to Ax = b when A has no inverse. It equals VΣ⁺Uᵗ, with reciprocals of the non-zero singular values.

What are eigenvalues?

Numbers λ for which the determinant of A − λI is zero. For the matrix with rows 2 1 and 1 2 they are 3 and 1.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools