Matrix Calculator

Perform matrix operations: addition, subtraction, multiplication, transpose, determinant, inverse, and scalar multiplication for 2×2 and 3×3 matrices.

Setup

Matrix A
Matrix B

Result

Enter matrix values to see results.

Formulas Reference

OperationFormula / Notes
AdditionC[i,j] = A[i,j] + B[i,j]
MultiplyC[i,j] = Σ A[i,k]·B[k,j]
TransposeAᵀ[i,j] = A[j,i]
det(2×2)ad − bc
det(3×3)Cofactor expansion along row 1
Inverse 2×2(1/det)·[[d,−b],[−c,a]]
Inverse 3×3(1/det)·adjugate(A)
Scalar(kA)[i,j] = k·A[i,j]

Matrix Properties

PropertyFormula
(AB)ᵀ= BᵀAᵀ
(AB)⁻¹= B⁻¹A⁻¹
det(AB)= det(A)·det(B)
det(Aᵀ)= det(A)
A·A⁻¹= I (identity matrix)

Matrix multiplication is not the same as multiplying matching entries, and A times B is usually not B times A. This calculator performs the true row-by-column product, along with addition, subtraction, scalar multiplication, transpose, determinant and inverse for square 2×2 or 3×3 grids. It also tells you plainly when a matrix has no inverse instead of returning a column of nonsense.

A typical product, then the singular-matrix trap

Typical case: A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]]. Each entry of A × B is a row of A times a column of B, summed. The top-left entry is 1 × 0 + 2 × 1 = 2, and the full product is [[2, 1], [4, 3]]. Reverse the order and B × A = [[3, 4], [1, 2]], which is different. Multiplying matching entries would give [[0, 2], [3, 0]], and this page deliberately does not offer that because it is not matrix multiplication.

For the same A, det(A) = 1 × 4 − 2 × 3 = −2. It is not zero, so an inverse exists: (1 ÷ det) × [[d, −b], [−c, a]] = (1 ÷ −2) × [[4, −2], [−3, 1]] = [[−2, 1], [1.5, −0.5]]. For 3×3 matrices the page expands the determinant along the first row and builds the inverse as the adjugate divided by the determinant. For example, [[2, 0, 1], [1, 3, 2], [1, 1, 4]] has determinant 18.

Edge case: [[2, 4], [1, 2]] has det = 2 × 2 − 4 × 1 = 0, so the page answers 'Matrix is singular (determinant = 0). Inverse does not exist.' A grid like [[1, 2, 3], [4, 5, 6], [7, 8, 9]] looks harmless but also has determinant 0, since its rows rise in steps of 3. The page's singular test is |det| below 1e-12, an absolute cutoff, so a matrix with 1e-7 on its diagonal (determinant 1e-14) is reported as singular even though it is invertible mathematically. Scale such entries up first. Any blank cell stops the calculation, so type 0 explicitly.

Two sanity checks worth running. The 3×3 determinant above expands along the first row as 2 × (3 × 4 − 2 × 1) − 0 × (1 × 4 − 2 × 1) + 1 × (1 × 1 − 3 × 1) = 20 − 0 − 2 = 18. And determinants multiply: det(A) = −2 and det(B) = −1 for the earlier pair, and det(A × B) = 2 × 3 − 1 × 4 = 2, which equals −2 × −1.

How to Use This Calculator

  1. Choose Matrix Size, 2 × 2 or 3 × 3. Changing the size clears both grids.
  2. Pick an Operation: add, subtract, multiply, scalar, transpose, determinant or inverse.
  3. Fill every cell of Matrix A. A blank cell means no result is shown.
  4. For add, subtract or multiply, fill Matrix B as well. For the scalar operation, enter k instead.
  5. Read the result matrix or, for the determinant, the single number and its singular or non-singular note.
  6. Switch operations without retyping: your entries stay in the grids. Results are rounded to 8 decimals.

Frequently Asked Questions

Can I multiply a 2×3 matrix by a 3×2?

No. Only square 2×2 and 3×3 grids are available, so the rectangular case is not supported.

Is A × B ever equal to B × A?

Sometimes, for example when one matrix is the identity or both are diagonal. In general it is not, as the example above shows.

What does a determinant of zero tell me?

That the rows or columns are dependent, so the matrix squashes space flat and cannot be undone. That is why no inverse exists.

How can I check an inverse the page gave me?

Multiply A by the inverse with the Multiply operation, typing the inverse into Matrix B. You should see the identity matrix, [[1, 0], [0, 1]] for 2×2, within rounding.

Does a negative scalar work?

Yes. With k = -1 every entry changes sign. A blank or non-numeric k produces no result.

Is the determinant the same as adding the diagonal?

No. Adding the diagonal gives the trace. For [[1, 2], [3, 4]] the trace is 5 and the determinant is -2. This page calculates only the determinant.