ZumaTools

Matrix Calculator

Enter matrices A and B, pick an operation, and the result updates instantly — including determinant steps for 2×2 and 3×3.

Matrix A

Matrix B

Result

6
8
10
12

Values are rounded to 4 decimal places — hover any result for full precision. Empty cells count as 0.

How it works

  1. Choose the size of matrix A (2×2 to 4×4) and type its entries into the grid.
  2. Pick an operation — A+B, A−B, A×B, scalar × A, det(A), A⁻¹, Aᵀ, or rank. Matrix B and the scalar field appear only when needed.
  3. Read the live result below; for the determinant of a 2×2 or 3×3 matrix, open the steps panel to see the cofactor expansion.

Frequently asked questions

How does the calculator find the determinant?
It uses cofactor expansion along the first row: each entry is multiplied by the determinant of the submatrix left after deleting its row and column, with alternating signs. For 2×2 and 3×3 matrices the tool also writes out every term of this expansion so you can follow or check homework by hand.
Why do I get a singular matrix warning for the inverse?
A matrix has an inverse only when its determinant is non-zero. If the determinant is zero — or so close to zero that it is indistinguishable within floating-point precision — the rows are linearly dependent and no inverse exists, so the calculator reports the matrix as singular instead of showing meaningless numbers.
Why do the sizes of A and B have to match for A×B?
Matrix multiplication requires the number of columns in A to equal the number of rows in B. Since this tool works with square matrices from 2×2 to 4×4, that means both matrices must be the same size. Addition and subtraction have the same requirement because they combine entries position by position.
How accurate are the decimal results?
All arithmetic uses double-precision floating point, accurate to roughly 15 significant digits. Displayed values are rounded to four decimal places for readability, but hovering over any result cell shows the full-precision value, so tiny rounding artifacts like 0.30000000000000004 are visible rather than hidden.
Is anything I enter sent to a server?
No. Every operation — multiplication, inversion, rank via Gaussian elimination — runs as JavaScript in your browser tab. There are no network requests, nothing is stored, and the calculator keeps working offline once the page has loaded.

About this tool

This matrix calculator handles the operations that come up constantly in linear algebra courses and applied work: addition, subtraction, and multiplication of two matrices, multiplication by a scalar, determinant, inverse, transpose, and rank. It supports square matrices from 2×2 up to 4×4, entered directly into an on-screen grid, and recomputes the answer live with every keystroke — there is no calculate button to press and no page reload.

Under the hood the determinant is computed by cofactor expansion, the inverse by Gauss–Jordan elimination with partial pivoting, and the rank by reducing the matrix to row echelon form and counting non-zero rows against a small numerical tolerance. When you ask for det(A) on a 2×2 or 3×3 matrix, an expandable steps panel writes out the full expansion — every product, every sign, every 2×2 minor — which makes the tool useful for learning the method, not just getting the number. Everything runs client-side in your browser, so the matrices you type never leave your device.

Typical uses include checking homework answers before submitting, verifying a hand-computed inverse (multiply A by the result and confirm you get the identity), testing whether a system of linear equations has a unique solution (non-zero determinant), and finding the rank of a coefficient matrix to see how many equations are independent. Engineers and programmers also use it for quick sanity checks on transformation matrices in graphics or robotics work.

A few practical tips: entries can be negative and decimal, and an empty cell counts as zero, so you can sketch sparse matrices quickly. Results are shown rounded to four decimal places — hover over any cell to see the exact stored value. If an inverse comes back marked singular, compute det(A) first; a determinant that is exactly zero means dependent rows, while one that is merely tiny suggests an ill-conditioned matrix whose inverse would be numerically unreliable anyway.

Related tools