Matrix Calculator

Pick an operation, set the matrix size and type the entries (decimals or fractions like 3/4). Results update as you type.

Matrix operations explained

  • Addition and subtraction work entry by entry and need matrices of the same size.
  • Multiplication A × B needs the number of columns of A to equal the number of rows of B. Entry (i, j) is the dot product of row i of A with column j of B. Order matters: A × B usually differs from B × A.
  • Transpose Aᵀ flips rows and columns.
  • Determinant |A| (square matrices only) measures how A scales area or volume; |A| = 0 means A is singular.
  • Inverse A⁻¹ satisfies A × A⁻¹ = I and exists only when |A| ≠ 0.
  • Rank is the number of linearly independent rows (or columns).

How determinants and inverses are computed

For a 2×2 matrix the formulas are short:

|A| = ad − bc, A⁻¹ = (1/|A|) × [[d, −b], [−c, a]]

For a 3×3 matrix the determinant can be expanded along the first row:

|A| = a(ei − fh) − b(di − fg) + c(dh − eg)

For larger matrices the calculator uses Gaussian elimination with partial pivoting: it reduces A to triangular form (the determinant is the product of the pivots, with a sign change for each row swap) and uses Gauss-Jordan elimination on [A | I] to produce the inverse. Results are shown as fractions when they have small denominators, with a decimal view available.

Example

Take A = [[2, 1, 3], [0, −1, 4], [1, 2, 1]].

  1. Expand along the first row: |A| = 2((−1)(1) − (4)(2)) − 1((0)(1) − (4)(1)) + 3((0)(2) − (−1)(1)).
  2. = 2(−9) − 1(−4) + 3(1) = −18 + 4 + 3 = −11.
  3. Because |A| ≠ 0, A is invertible and has full rank 3. Every entry of A⁻¹ is a cofactor divided by −11, so the inverse is displayed with denominators of 11.

A classic use of matrix powers: [[1, 1], [1, 0]]¹⁰ = [[89, 55], [55, 34]], which contains Fibonacci numbers.

Where matrices are used

Matrices solve systems of linear equations, describe rotations and scaling in computer graphics, model networks and Markov chains, store images, and power statistics and machine learning (regression is solved with matrix inverses). Floating-point arithmetic can produce tiny rounding errors such as 1e-16 instead of 0; the calculator cleans these up, and treats pivots smaller than 10⁻¹⁰ as zero when detecting singular matrices.

Frequently asked questions

When does a matrix have no inverse?

When it is not square or its determinant is 0 (its rows are linearly dependent). Such a matrix is called singular.

Why can't I multiply these two matrices?

A × B requires the number of columns of A to equal the number of rows of B. A 2×3 matrix can multiply a 3×4 matrix, giving 2×4.

Can I enter fractions?

Yes. Type entries like 3/4 or -2/5; results are shown as fractions when possible.

What is the rank of a matrix?

The number of linearly independent rows or columns. A square matrix with full rank is invertible.

Last reviewed: