Matrix operations made visible on a grid
Matrices are grids of numbers that follow their own rules for adding, multiplying and inverting. This article explains each operation the calculator supports, walks through the controls, and covers the shape rules that decide whether a calculation can run at all.

What a matrix is and where you meet one
A matrix is a rectangle of numbers arranged in rows and columns. A two-by-three matrix has two rows and three columns, giving six cells in total. That sounds abstract until you realise that a spreadsheet is a matrix, a digital photo is three matrices of colour values stacked on top of each other, and any system of equations you solved in school can be written as a matrix problem.
The reason matrices matter is that the operations defined on them, multiplication in particular, let you express complicated transformations in a compact way. Rotating a shape, solving five equations at once, running a search-engine ranking algorithm, and training a machine-learning model all reduce to matrix arithmetic at some level. The calculator on this page handles grids up to five by five, which is large enough for coursework, small engineering problems, and getting a feel for how the rules work.
Setting up the grids
The panel at the top holds the controls. Rows in A and Columns in A set the shape of the first grid. Rows in B and Columns in B set the shape of the second. Each can go from one to five. Once you choose the sizes, the corresponding grids appear below with empty cells ready for your numbers. You can move between cells with the arrow keys or tab, and any cell left empty counts as zero.
Three buttons sit beneath the grids. Make A the identity fills Matrix A with ones on the diagonal and zeros everywhere else, which is the matrix equivalent of the number one. Fill with examples loads sample values so you can see an operation in action without typing anything. Empty the cells clears every number from both grids so you can start fresh.
Addition, subtraction and scalar multiplication
Adding two matrices is the simplest operation. Each cell in the result is the sum of the matching cells in A and B. Subtraction works the same way but with the difference. Both require A and B to be exactly the same shape; you cannot add a two-by-three to a three-by-two, and the tool will tell you so if you try.
Scalar multiplication, listed in the Operation dropdown as A multiplied by a number, takes every cell in A and multiplies it by a single value you provide. The shape of the result is the same as the shape of A. This is how you scale a matrix up or down without changing its structure, and it works on any size.
Matrix multiplication and why order matters
Multiplying two matrices is not like multiplying two numbers. Each cell of the result is found by taking a row from the first matrix and a column from the second, multiplying the pairs, and adding them up. For this to work, the number of columns in A must equal the number of rows in B. A two-by-three times a three-by-four gives a two-by-four; the same two grids in the other order cannot be multiplied at all.
Even when both orders are possible, swapping them usually gives a different answer. Three times four and four times three are the same with ordinary numbers, but that rule does not carry over to matrices. If the tool refuses to multiply, check that the inner dimensions match: the column count of A should equal the row count of B. Once you see the result, try swapping the inputs to see how different the answer is. This non-symmetry is one of the first things that trips people up in a linear algebra course, and seeing it happen on a real grid makes the idea stick better than any textbook explanation.
Determinants and what they tell you
The determinant is a single number that belongs to any square matrix. Select Determinant of A from the dropdown, make sure A is square, and the tool shows the value. Geometrically, the determinant describes how much the matrix stretches or compresses space. A determinant of two means areas double; a determinant of negative one means areas stay the same size but orientation flips, like a reflection.
A determinant of zero is special. It means the matrix squashes space down to a lower dimension, collapsing an area to a line or a volume to a flat surface. In practical terms, a zero determinant tells you that the rows of the matrix are not all independent of each other, and it also means the matrix cannot be inverted. The calculator flags this clearly rather than producing meaningless numbers.
Inverting a matrix
The inverse of a matrix is the grid that, when multiplied by the original, gives the identity matrix. It exists only for square matrices with a non-zero determinant. Think of it as the matrix version of dividing by a number: multiplying by the inverse undoes what the original matrix did.
Select Inverse of A, enter a square grid, and the result appears below. Because inverting involves division, the numbers in the output may not be whole, and the tool rounds them to a sensible number of decimal places rather than showing exact fractions. If you want to check the answer, multiply the original by its inverse and see whether you get something close to the identity. Small rounding differences are normal and expected. In real-world applications like solving systems of equations, inverting the coefficient matrix is one of the standard methods, and this calculator lets you verify each step as you go.
Transpose and raising to a power
Transposing a matrix flips it over its diagonal. Rows become columns and columns become rows. A two-by-five becomes a five-by-two. Unlike most other operations, transposing works on any shape, and it is often a step inside a larger calculation rather than the final answer. In statistics, data is frequently stored with variables in columns and observations in rows, and transposing swaps that layout when a formula expects the other arrangement.
The A to a power option multiplies a square matrix by itself a given number of times. Squaring a matrix means multiplying it by itself once, cubing means twice, and so on. This only makes sense for square matrices, because the output of each multiplication must be the same shape as the input for the next one to work. Powers come up in areas like graph theory, where the entries of a squared adjacency matrix count the number of two-step paths between nodes.
Shape rules at a glance
The restrictions on which shapes can be combined are not arbitrary. They come from the way each operation is defined, and the calculator enforces them as you go.
- Addition and subtraction need both matrices to be the same size.
- Multiplication needs the columns of A to equal the rows of B.
- Determinant and inverse need A to be square.
- Transpose and scalar multiplication work on any shape.
- Raising to a power needs A to be square.
Tips for getting accurate results
Double-check your entries before reading the output. A single wrong digit in one cell changes the entire result, and with a grid of numbers it is easy to put a value in the wrong row. Use the Fill with examples button to see how an operation behaves before entering your own data, so you know what a correct result looks like.
When comparing your answer with a textbook, remember that the calculator uses floating-point arithmetic and may round differently. For inverses in particular, small differences in the last decimal place are normal. If the numbers are wildly different, check the input rather than assuming the tool is wrong.
Privacy and how the tool runs
Every calculation runs entirely on your own device. Nothing leaves your browser, there is no account, and the page does not store your grids after you close it. You can work through homework problems, check engineering calculations, or experiment with matrix properties without anything being recorded. The page runs the same whether you are online or offline once it has loaded, so there is no server involved in any step of the computation.
