Matrix Calculator

Find the determinant, inverse or transpose of a 2×2 to 4×4 matrix, or add and multiply two matrices. Shows the result as a matrix.

One row per line, entries separated by spaces or commas. Up to 4 rows and 4 columns. Determinant and inverse need a square matrix.

Results

Inverse of A (3 × 3)
[ 0.75  0.5  0.25 ] [  0.5    1   0.5 ] [ 0.25  0.5  0.75 ]
Check: A × A⁻¹ gives the identity matrix.
Determinant of A
4

How it’s calculated

A matrix is a rectangular grid of numbers. Type matrix A with one row per line and the entries separated by spaces. The calculator handles up to 4 × 4. Determinants and inverses are found by Gaussian elimination with partial pivoting: at each step the row with the largest entry in the current column is swapped up, which keeps rounding errors small.

2×2 determinant: det [a b; c d] = ad − bc 2×2 inverse: (1 ÷ det) × [d −b; −c a] transpose: row i of A becomes column i of Aᵀ sum: (A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ (same size) product: (AB)ᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ (columns of A = rows of B)

A matrix whose determinant is 0 is singular and has no inverse. Each row is first scaled by its largest entry; a pivot smaller than one trillionth after that is treated as 0, so rounding noise is not mistaken for a real value.

Example: A = [4 7; 2 6]. det = 4×6 − 7×2 = 10. The inverse is (1 ÷ 10) × [6 −7; −2 4] = [0.6 −0.7; −0.2 0.4]. Multiplying A by this inverse gives the identity matrix [1 0; 0 1].

Frequently asked questions

Why does it say the matrix is singular?

A singular matrix has a determinant of 0, which means its rows (or columns) are not independent, for example one row is a multiple of another. Such a matrix has no inverse.

Can I multiply matrices of different sizes?

Yes, as long as the number of columns in A equals the number of rows in B. An m × n matrix times an n × p matrix gives an m × p matrix. Addition needs both matrices to be exactly the same size.

Is matrix multiplication commutative?

No. A × B and B × A are usually different, and one of them may not even exist when the sizes do not match.

How do I enter a matrix?

Type one row per line and separate entries with spaces or commas, for example "4 7" on the first line and "2 6" on the second. Use a point for decimals (0.5).

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator