Home ↓
CalculatorsVerified

Math & Geometry

Matrix Calculator (Determinant, Inverse, Multiply)

Work with matrices without doing the arithmetic by hand. Type a matrix row by row, separating rows with semicolons, and the calculator finds its determinant, trace and inverse — or, if the matrix is singular, its transpose. You can also multiply or add two matrices of compatible sizes, up to 6 rows and 6 columns.

How to use this calculator

  1. Choose the operation: determinant and inverse of A, product A × B, or sum A + B.
  2. Type matrix A row by row, with numbers separated by spaces or commas and rows separated by semicolons, e.g. 4 7; 2 6.
  3. For a product or sum, type matrix B the same way.
  4. Read the determinant, trace and whether the matrix is invertible, or the size of the result.
  5. Use the table for the inverse, the transpose or the resulting matrix.

Determinant and inverse

The determinant is a single number calculated from a square matrix. Geometrically it is the factor by which the matrix scales areas (in 2D) or volumes (in 3D); its sign tells you whether orientation is flipped. Most importantly, a matrix has an inverse only when its determinant is not zero. A matrix with determinant 0 is called singular: one of its rows is a combination of the others, so it squashes space into a lower dimension and cannot be undone.

The inverse A⁻¹ is the matrix that gives the identity when multiplied by A. It is what you use to solve a system of linear equations A·x = b, since x = A⁻¹·b. For example, the system 6x + y + z = …, 4x − 2y + 5z = …, 2x + 8y + 7z = … has the coefficient matrix [6 1 1; 4 −2 5; 2 8 7], whose determinant is −306, so the system has exactly one solution.

How the calculation is done

For 2 × 2 matrices the short formula ad − bc is exact. For larger matrices the calculator uses Gaussian elimination: it adds multiples of rows to one another to create zeros below the diagonal, choosing the largest available pivot in each column to limit rounding errors, and multiplies the diagonal to obtain the determinant. The same elimination applied to the matrix placed next to the identity (Gauss–Jordan) produces the inverse. Results are rounded to six decimals in the table; entries smaller than 10⁻¹² are shown as 0. The trace, the sum of the diagonal, equals the sum of the eigenvalues and is shown as a quick check.

Multiplying and adding matrices

Two matrices can be added only when they have the same size; each entry is added to the entry in the same position. Multiplication is different: A × B is defined when the number of columns of A equals the number of rows of B, and the result has the rows of A and the columns of B. Each entry is the dot product of a row of A with a column of B. Matrix multiplication is not commutative — A × B is usually different from B × A, and one of them may not even be defined. These operations are the basis of computer graphics, statistics, economics models and machine learning.

Formula & method

2 × 2: det = ad − bc, A⁻¹ = (1 ÷ det) × [d −b; −c a]Larger matrices: Gaussian elimination with partial pivoting(A × B)ᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ — columns of A must equal rows of B

For a 2 × 2 matrix [a b; c d], det = ad − bc and A⁻¹ = (1 ÷ det) × [d −b; −c a]. Larger matrices are handled by Gaussian elimination with partial pivoting. In a product, entry (i, j) is Σ Aᵢₖ × Bₖⱼ, so the columns of A must equal the rows of B.

Worked example

Inverse of A = [4 7; 2 6]

  1. det = 4 × 6 − 7 × 2 = 24 − 14 = 10
  2. Swap the diagonal, change the sign of the others: [6 −7; −2 4]
  3. Divide by 10: A⁻¹ = [0.6 −0.7; −0.2 0.4]

Answer: The determinant is 10 and the inverse is [0.6 −0.7; −0.2 0.4]; multiplying A by it gives the identity matrix.

Frequently asked questions

How do I enter a matrix?

Type each row with numbers separated by spaces or commas, and separate rows with semicolons: 1 2 3; 4 5 6; 7 8 10.

Why does my matrix have no inverse?

Its determinant is 0, which means its rows (or columns) are linearly dependent. The calculator then shows the transpose instead.

Can I find the determinant of a non-square matrix?

No. Determinants and inverses exist only for square matrices, with as many rows as columns.

When can two matrices be multiplied?

When the number of columns of the first equals the number of rows of the second; a 2 × 3 matrix can multiply a 3 × 4 matrix and gives a 2 × 4 result.

Is A × B equal to B × A?

Usually not. Matrix multiplication depends on order, except in special cases such as multiplying by the identity matrix.

What is the trace of a matrix?

The sum of the entries on the main diagonal. It equals the sum of the matrix's eigenvalues.