A matrix is a grid of numbers that behaves as one number
A matrix is a rectangular grid of numbers treated as a single object you can add, subtract and multiply. Grids like that are everywhere once you look: a spreadsheet of prices by month, the coordinates of every corner of a shape, the system of equations behind a circuit or a structure, the pixel values of an image. The operations look odd at first — multiplication especially — but each one exists because it does a job: adding grids combines two data sets cell by cell, and multiplying them composes two transformations into one, which is how computer graphics moves objects and how the slope calculator's lines get rotated, scaled and shifted in real software. This calculator covers the hand-sized cases — 2 × 2 and 3 × 3 — and, in the spirit of this site, it writes out the working for the first entry of every result, because a matrix answer you cannot rebuild one entry of is an answer you cannot check.
The five operations, with every term defined
Add / subtract: entry by entry — (A + B) at row i, column j is A's entry there plus B's entry thereMultiply: (A × B) at row i, column j = row i of A, multiplied term by term into column j of B, then summedDeterminant (2 × 2): a × d − b × c, where a, b, c, d are the four entries reading across the rowsDeterminant (3 × 3): expand along the top row — each entry times the 2 × 2 determinant left when its row and column are covered, with signs + − +Transpose: rows become columns — the entry at row i, column j moves to row j, column i
The vocabulary, pinned down. An entry is one cell, always named by its row first and its column second — row 2, column 1 is the middle-left entry of a 3 × 3. A matrix's size (its order) is rows × columns; this page handles the square sizes 2 × 2 and 3 × 3, where the two grids being combined must match in size for addition and subtraction, and a square times a square of the same size always fits for multiplication. The determinant is a single number distilled from a square matrix: geometrically it is the factor by which the transformation scales areas (which is why it can be negative — a negative determinant flips orientation as it scales), and algebraically a determinant of exactly zero marks the matrix as singular — it flattens its input and cannot be undone, the matrix equivalent of dividing by zero. The transpose, written A with a small raised T, simply flips the grid across its main diagonal.
Worked example: multiplying the default matrices
The defaults above set A = [1, 2; 3, 4] and B = [5, 6; 7, 8], with multiplication selected. The top-left entry of A × B pairs the first row of A with the first column of B: (1 × 5) + (2 × 7) = 5 + 14 = 19. The top-right pairs the same row with B's second column: (1 × 6) + (2 × 8) = 22. The second row of A does the same work against both columns: (3 × 5) + (4 × 7) = 43 and (3 × 6) + (4 × 8) = 50 — so A × B = [19, 22; 43, 50], the figure in the chart near the top. The other operations on the same pair are worth placing beside it: A + B = [6, 8; 10, 12] and A − B = [−4, −4; −4, −4], plain entry-by-entry work; A's determinant is (1 × 4) − (2 × 3) = −2; and A's transpose is [1, 3; 2, 4], its first row turned into its first column. One warning the example earns honestly: B × A = [23, 34; 31, 46], a different matrix in every entry — matrix multiplication does not commute, and the page below returns to why.
A 3 × 3 example, and the identity check
| Calculation | Result |
|---|---|
| A × B — worked example | [19, 22; 43, 50] |
| B × A (order swapped) | [23, 34; 31, 46] |
| A + B | [6, 8; 10, 12] |
| A − B | [−4, −4; −4, −4] |
| Determinant of A | −2 |
| Transpose of A | [1, 3; 2, 4] |
| 3 × 3: A = [1, 2, 0; 0, 1, 3; 2, 0, 1] times B = [2, 1, 0; 1, 0, 2; 0, 2, 1] | [4, 1, 4; 1, 6, 5; 4, 4, 1] |
| 3 × 3: determinant of that A | 13 |
| 3 × 3: A + B for that pair | [3, 3, 0; 1, 1, 5; 2, 2, 2] |
The 3 × 3 determinant repays one manual pass, because it is the operation students are most often told to trust. Expanding A = [1, 2, 0; 0, 1, 3; 2, 0, 1] along its top row: the 1 multiplies the determinant left by covering row 1 and column 1 — (1 × 1) − (3 × 0) = 1 — contributing 1. The 2 carries the middle minus sign and multiplies (0 × 1) − (3 × 2) = −6, contributing −2 × −6 = 12. The 0 contributes nothing whatever its bracket holds. Total: 1 + 12 + 0 = 13, which is what the calculator reports. And one check validates multiplication itself: multiply any matrix by the identity matrix — 1s on the diagonal, 0s elsewhere, [1, 0; 0, 1] at 2 × 2 — and it comes back unchanged, A × I = A exactly, the matrix version of multiplying a number by 1. If a hand calculation fails that test, the error is in the working, not the rule.
How to read your result — and its limits
For addition, subtraction, multiplication and transpose, the large figure states the whole result grid in bracket shorthand — rows separated by semicolons — and the table underneath lays the same grid out cell by cell; for the determinant, the large figure is the single number. Read the detail line before trusting any of it: it shows the first entry's full working, and one entry rebuilt by hand is the fastest known detector of the classic matrix mistake, which is pairing the wrong row with the wrong column. Four limits belong with the page. Sizes are capped at 3 × 3 — real applications run to thousands of rows, where software libraries, not web forms, are the right tool; this page exists for learning, checking and the small systems that genuinely occur in coursework and design. There is no division of matrices: the operation does not exist; the nearest equivalent, multiplying by an inverse, is only possible when the determinant is non-zero, and inverses are deliberately left to a fuller tool rather than half-done here. Order is part of the question in multiplication and subtraction — A − B and B − A differ in every sign, A × B and B × A in almost every entry — so confirm the selector matches the question asked before copying an answer. And decimals are rounded for display to four decimal places: entries like 1.5 are handled exactly enough for any hand-check (a matrix [1.5, 0; 2, 1] has determinant exactly 1.5), but long decimal inputs chained through a 3 × 3 multiplication can shed digits in the last place, which is display rounding, not a different answer.
Frequently asked questions
Why is matrix multiplication row-by-column instead of entry-by-entry?
Because multiplication is meant to compose transformations: applying B's reshaping and then A's. When the entries are worked through, the effect of A on anything B produces lands exactly on the row-times-column rule — the top-left entry of A × B genuinely is (1 × 5) + (2 × 7) = 19 for the worked example. Entry-by-entry multiplication also exists (the Hadamard product) but it composes nothing, which is why the standard operation is the row-and-column one.
Why does A × B not equal B × A?
Because each entry mixes a row of the first matrix with a column of the second, and swapping the matrices swaps which grid supplies the rows. On this page's defaults, A × B = [19, 22; 43, 50] while B × A = [23, 34; 31, 46] — different in all four entries. In transformation language: rotating then sliding lands somewhere different from sliding then rotating. Always multiply in the order the problem states.
What does a determinant of zero mean?
That the matrix is singular: it flattens the space it acts on — a 2 × 2 with determinant zero squeezes every shape onto a single line — and it has no inverse, so a system of equations built on it has either no solution or infinitely many, never exactly one. The cleanest classroom case is [1, 2; 2, 4]: (1 × 4) − (2 × 2) = 0, and you can see why — the second row is simply the first row doubled, so the grid carries less information than its size promises.
How do I multiply a 3 × 3 matrix by hand without losing track?
One entry at a time, always in the same order: point at a row of the left matrix and a column of the right one, multiply the pairs in sequence, and add as you go — never hold two entries in your head at once. Nine entries, three products each. Then run the identity check on your method once (your matrices times [1, 0, 0; 0, 1, 0; 0, 0, 1] must come back unchanged) and use this calculator entry-by-entry: the detail line shows the first entry's working in your own numbers, which catches a mispaired row or column immediately.
Can matrices contain decimals and negative numbers?
Yes — the rules never assumed whole or positive entries. Negatives behave exactly as in ordinary arithmetic (a negative times a positive is negative, which is how the worked example's determinant reaches −2), and decimals are carried through and shown to four decimal places: [1.5, 0; 2, 1] has determinant 1.5 × 1 − 0 × 2 = 1.5. Fractions are the one gap: enter them as decimals (a third as 0.3333) and expect the last displayed digit to carry that rounding.
