CalcGallery

Matrix Calculator

Multiply, add or subtract two matrices, or find the determinant, inverse, transpose or rank of one, for sizes 2 × 2 to 5 × 5.

Built by AbhiLast reviewed September 24, 2026

Result19224350

Your numbers

Matrix A, row by row
Matrix B, row by row

Result

Result, row by row: [19, 22] [43, 50]

Results are shown to ten significant figures.

Report a problem with this calculator
Your entries are kept on this device only.

Results follow the mathematical operation and values shown. Check that you selected the intended operation, convention and dataset type before relying on the result. Read the full disclaimer

How to use the Matrix Calculator

  1. Choose the operation. Multiplying, adding and subtracting use two matrices, A and B; the rest use A alone.
  2. Set the number of rows and columns of each matrix, from 2 to 5, and fill in the entries row by row. a₁₂ is the entry in row 1, column 2.
  3. Read the result, row by row, with the determinant and rank where they apply.

How each operation works

A + B, A − B    entry by entry: (A + B)ᵢⱼ = Aᵢⱼ + BᵢⱼA × B           (AB)ᵢⱼ = Aᵢ₁B₁ⱼ + Aᵢ₂B₂ⱼ + … + AᵢₙBₙⱼtranspose       (Aᵀ)ᵢⱼ = Aⱼᵢ, rows become columnsdeterminant     2 × 2: ad − bcinverse         A⁻¹ such that A × A⁻¹ = I

For a 2 × 2 matrix [a, b] [c, d] the inverse is [d, −b] [−c, a] divided by the determinant ad − bc. For [1, 2] [3, 4] that is [4, −2] [−3, 1] divided by −2, giving [−2, 1] [1.5, −0.5].

Larger matrices

The determinant of a 2 × 2 or 3 × 3 matrix is worked out by cofactor expansion, which is exact for whole-number entries. Above that, and for the inverse and rank, the page uses Gauss–Jordan elimination: it clears each column below and above a pivot, choosing the largest available pivot each time to keep rounding error small. The determinant is the product of the pivots, with a sign change for each row swap.

With your numbers

  1. (AB)ᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ

Quick reference

Results are shown to ten significant figures.

Common math examples, worked out with this calculator's starting values.
ExampleResult
2 × 2 productResult, row by row: [19, 22] [43, 50]
Determinant of [1, 2] [3, 4]Determinant of A: -2
Inverse of [1, 2] [3, 4]Result, row by row: [−2, 1] [1.5, −0.5]
Inverse of [1, 2] [2, 4]Result, row by row:
Sum of two 2 × 2Result, row by row: [6, 8] [10, 12]
Transpose of 2 × 3Result, row by row: [1, 4] [2, 5] [3, 6]
Determinant of diag(2, 3, 4)Determinant of A: 24
Rank of 1 to 9 in a 3 × 3Rank of A: 2

Common questions about the Matrix Calculator

Why does A × B not equal B × A?
Each entry of A × B is a row of A multiplied into a column of B. Swapping the matrices pairs different rows with different columns, so the answer usually changes, and if the matrices are not square, B × A may not even be possible. Order matters in matrix multiplication in a way it never does with ordinary numbers.
When can two matrices be multiplied?
When A has as many columns as B has rows. A 2 × 3 matrix times a 3 × 4 matrix gives a 2 × 4 matrix; a 2 × 3 times a 2 × 3 cannot be done. Adding and subtracting need both matrices the same size.
What does it mean for a matrix to be singular?
Its determinant is zero, because one row is a combination of the others: in [1, 2] [2, 4] the second row is twice the first. A singular matrix has no inverse, just as zero has no reciprocal, and the system of equations it describes has no single solution.
Why does the page treat a tiny number as zero?
Computers store most decimals with a small rounding error, so eliminating a singular matrix can leave 0.00000000000000001 where the exact answer is 0. Taking that at face value would give an "inverse" full of enormous, meaningless numbers. The page counts anything within rounding error, scaled by the size of the entries, as zero, and says the matrix is singular.
What is the rank of a matrix?
The number of rows that are genuinely independent, none a combination of the others. A 3 × 3 matrix of rank 3 is invertible; the matrix with rows 1, 2, 3 then 4, 5, 6 then 7, 8, 9 has rank 2, because the third row is twice the second minus the first.

Report a problem with this calculator