Matrix Calculator

Perform 2x2 and 3x3 matrix operations: addition, subtraction, multiplication, transpose, determinant, and inverse.

Size:
Operation:

Matrix A

Matrix B

Result:

1
0
0
1

How to Use the Matrix Calculator

  1. Select the matrix size. Choose 2×2 or 3×3. All matrix entries default to an identity matrix. Click any cell and type a new value. Changes take effect instantly.
  2. Pick an operation. Add (A+B) and Subtract (A-B) combine corresponding entries. Multiply (A×B) performs standard matrix multiplication, which is not commutative: A×B rarely equals B×A. Transpose flips rows and columns. Determinant gives a single scalar. Inverse finds the matrix A⁻¹ such that A×A⁻¹ = I.
  3. Read the result. For matrix results, each cell shows the computed value rounded to 6 decimal places. For determinant, a single number is shown. If the inverse is requested for a singular matrix (det = 0), you will see an error message.

Example: multiply A = [[2,1],[5,3]] by B = [[3,-1],[-5,2]]. The result is the identity matrix [[1,0],[0,1]], confirming B = A⁻¹.

Matrix Operation Formulas

2×2 Matrix A = [[a,b],[c,d]]

Addition:      A + B = [[a+e, b+f],[c+g, d+h]]
Subtraction:   A - B = [[a-e, b-f],[c-g, d-h]]

Multiplication (A×B):
  [a,b]   [e,f]   [ae+bg, af+bh]
  [c,d] × [g,h] = [ce+dg, cf+dh]

Transpose:     Aᵀ = [[a,c],[b,d]]

Determinant:   det(A) = ad - bc

Inverse (if det ≠ 0):
  A⁻¹ = (1/det) × [[d,-b],[-c,a]]

3×3 Determinant (cofactor expansion along row 1):
  det(A) = a(ei-fh) - b(di-fg) + c(dh-eg)

3×3 Inverse: computed via the adjugate matrix divided by det(A).
  Each entry of A⁻¹ is the signed cofactor divided by det(A).

Worked example: A = [[4,7],[2,6]]. det = 4×6 - 7×2 = 24-14 = 10. A⁻¹ = [[0.6,-0.7],[-0.2,0.4]].

Frequently Asked Questions

Matrix multiplication combines two matrices by taking dot products of rows and columns. The entry at row i, column j of the result equals the dot product of row i from matrix A with column j from matrix B. This process is directional: swapping A and B usually gives a different result. For example, A×B might equal [[7,10],[15,22]] while B×A equals [[23,34],[31,46]]. There are special cases where A×B = B×A, such as when both matrices are diagonal, but this is the exception.

Related Calculators