Skip to main content
CalcMax

Matrix Calculator

Result

25.0000

Result, row 1 column 1

Result, row 1 column 2
36.0000
Result, row 2 column 1
20.0000
Result, row 2 column 2
28.0000
Determinant of A
10.0000

A 2×2 matrix calculator that adds, multiplies or inverts matrices, and prints the four elements of the result along with the determinant of the first matrix. Fill in each matrix one row per box: the row 4 7 goes in one box and the row 2 6 in the next, with the two numbers separated by a space or a comma. Pick the operation from the dropdown and the page does the rest. Only the second matrix's boxes can be left empty, and whether they need filling in depends on what you asked for: adding and multiplying use both matrices, inverting uses only the first, so with invert selected the second matrix is not read at all. Three operations, and each is a different kind of thing. Adding two matrices adds them element by element — top left to top left, and so on — and it is the only one of the three that behaves the way ordinary numbers do. Multiplying them is not element by element: each element of the answer comes from a whole row of the first matrix and a whole column of the second, multiplied together pairwise and added up, which is why the top left of the answer uses neither of the top left entries alone. And inverting asks for the matrix that undoes the first one, the one you would multiply by to get the identity. Inverting is the operation with a condition attached: it needs the determinant to be non-zero, and when the determinant is zero the page refuses rather than returning anything, because the matrix that would undo it does not exist. Adding and multiplying a matrix with a zero determinant are perfectly ordinary — it is only the inverse that goes missing. The determinant itself is printed on every calculation, whichever operation you picked, and it always belongs to the first matrix. That is deliberate: it is a fact about that matrix rather than about the arithmetic you asked for, so it stays put as you switch between adding, multiplying and inverting the same input. It is the number that decides whether the inverse exists, and its sign tells you whether the matrix flips the plane over, which is why having it on screen next to the answer is more useful than having it on a page of its own.

2×2 matrices and their inverses

Matrix A, row 1Matrix A, row 2Determinant of AResult, row 1 column 1Result, row 1 column 2Result, row 2 column 1Result, row 2 column 2
4 72 6100.6-0.7-0.20.4
1 00 111001
1 23 4-2-211.5-0.5
2 00 360.5000.3333
0 11 0-10110
2 41 321.5-2-0.51
3 51 212-5-13
1 11 212-1-11

Eight matrices with their inverses, and the table shows one operation rather than three: every row here is an inverse, because that is the operation the columns have to be read against and because adding and multiplying need a second matrix that a table of single matrices cannot supply. The first row is the one the page loads with: determinant 10, and four elements that come out exactly, since 10 divides the swapped entries evenly. The second row is the identity, whose inverse is itself. The third is the smallest matrix with a negative determinant, and the negative sign flips every element of the inverse, which is the quickest way to see what the determinant's sign is doing. The fourth is diagonal, and the inverse is just the two diagonal entries turned upside down — which is also where the page's commonest untidy answer comes from, since one third does not come out even. The fifth has its ones off the diagonal rather than on it — the matrix that swaps the two coordinates of a vector. Its determinant is −1, so the inverse is again exact, and the matrix is its own inverse. The sixth has determinant 2 and produces halves. The seventh has determinant 1 and produces whole numbers — which is exactly what a determinant of 1 buys, since dividing the whole-number adjugate by 1 cannot change it. A determinant of 1 is worth recognising for that reason. The eighth also has determinant 1 and also comes out in whole numbers. No row here has a zero determinant, deliberately: those matrices are the ones the page refuses to invert, and a row of four blanks in a reference table would say less than the sentence in the limitations does. Every figure is recomputed when the page is built, and the spaces inside the first two columns are the separators, not part of the numbers.

Formula

A + B = (aᵢⱼ + bᵢⱼ) (A × B)ᵢⱼ = aᵢ₁b₁ⱼ + aᵢ₂b₂ⱼ det A = a₁₁a₂₂ − a₁₂a₂₁ A⁻¹ = (1 ÷ det A)× (a₂₂, −a₁₂; −a₂₁, a₁₁)

Matrix A, row 1 / row 2
The first matrix, one row per box and two numbers in each, such as 4 7 and 2 6. Rows rather than four separate cells because a matrix is one object: splitting it into four boxes would turn a single input into four and make it possible to fill in something that is not a matrix at all
Matrix B, row 1 / row 2
The second matrix, written the same way, and the only optional input on the page. Adding and multiplying both need it; inverting ignores it entirely, so with that operation selected you can leave both boxes empty. Leaving them empty is not an error — the key is simply absent
Operation
Which of the three things to do: add the two matrices, multiply them, or invert the first. One page rather than three, because all three take the same input and differ only in the arithmetic applied to it
Result, row 1 column 1
The top left element of the answer, and with it the other three by the same labels. For addition it is the two top left numbers added; for multiplication it is the whole first row of A against the whole first column of B, which is why it is not simply the product of the two top left entries
det A
The determinant of the first matrix: top left times bottom right, minus top right times bottom left. Printed for every operation and always belonging to A, not to the answer — it is a property of the matrix you typed, so it does not change when you switch from adding to multiplying to inverting the same numbers
1 ÷ det A
The scale factor in the inverse, and the reason a zero determinant is refused: it is the number the inverse is divided by. Nothing about adding or multiplying needs it, which is why those two keep working on a matrix whose determinant is zero
A⁻¹
The matrix that undoes A: multiply the two together in either order and you get the identity, ones down the diagonal and zeros elsewhere. That is what makes it worth having, and it exists exactly when the determinant is non-zero
Identity
The matrix with ones down the diagonal and zeros off it, which is to matrix multiplication what the number 1 is to ordinary multiplication. The check that an inverse is right is to multiply it back and get this
Four decimal places
How wide the outputs are written. Adding and multiplying whole numbers gives exact results, as does inverting any matrix with determinant 1 or −1; the rest are rounded, and a diagonal matrix with a 3 on it is the commonest case that does not come out even

Addition is the operation almost nobody wants, and it is here mainly so that the three can sit next to each other: it adds element by element, it always works, and it is the one place where matrices behave like ordinary numbers. Multiplication is the one that matters for transformations — applying a rotation and then a scale to the same figure is multiplying their two matrices, and the order you multiply them in is the order you apply them in. Inversion is for undoing: if a matrix turns coordinates one way, its inverse turns them back, which is what you want when you have the result of a transformation and need the input that produced it. The determinant, printed alongside, is worth reading in its own right. A determinant of zero means the matrix flattens the plane onto a line, so different inputs land on the same output and nothing can be undone — that is the same statement as the inverse not existing. Its sign tells you whether the matrix preserves the orientation of the plane or flips it over. Two things to keep in mind while using this page. Multiplication is not commutative: swapping the two matrices gives a different answer, so if you are composing transformations, the order is part of the problem and not a detail. And only the first matrix's determinant is shown, so if you also want the second one's, invert it on its own — the dropdown, not the boxes, is what decides whether a matrix counts as the first one.

Worked examples

  1. 4 7 over 2 6, times 1 2 over 3 4

    1. Top left: (4 × 1) + (7 × 3) = 4 + 21 = 25
    2. Top right: (4 × 2) + (7 × 4) = 8 + 28 = 36
    3. Bottom left: (2 × 1) + (6 × 3) = 2 + 18 = 20
    4. Bottom right: (2 × 2) + (6 × 4) = 4 + 24 = 28
    5. Determinant of A: (4 × 6) − (7 × 2) = 24 − 14 = 10

    The input the page loads with. Each element of the answer is a whole row of the first matrix against a whole column of the second, which is the thing to look at here: the top left of the answer is 25, and neither of the two numbers sitting in the top left of the inputs, 4 and 1, is 25. Their product is 4. The determinant of 10 is printed as well, and it is A's — 4 and 7 over 2 and 6 — not the answer's.

  2. The same two matrices, added

    1. Top left: 4 + 1 = 5
    2. Top right: 7 + 2 = 9
    3. Bottom left: 2 + 3 = 5
    4. Bottom right: 6 + 4 = 10
    5. Determinant of A: unchanged at 10, since A is the same matrix as in the previous example

    The previous example with one thing changed: the dropdown. Every element is now a plain sum, and this is the only one of the three operations where matrices behave the way ordinary numbers do — order does not matter, and there is nothing that can go wrong. The determinant is still 10, because it is a fact about A and A has not changed. Switching the dropdown back and forth between add and multiply is the quickest way to see that the determinant is not a property of the calculation.

  3. Inverting 4 7 over 2 6

    1. Determinant of A: (4 × 6) − (7 × 2) = 24 − 14 = 10
    2. Swap the two diagonal entries: 6 and 4
    3. Negate the two off-diagonal entries: −7 becomes 7, 2 becomes −2
    4. Divide each by the determinant: 6 ÷ 10 = 0.6, −7 ÷ 10 = −0.7, −2 ÷ 10 = −0.2, 4 ÷ 10 = 0.4
    5. Check: (4 × 0.6) + (7 × −0.2) = 2.4 − 1.4 = 1, which is the top left of the identity

    The first of the three operations with a condition attached, and the second matrix's boxes are empty on purpose — inverting reads only A, and the page does not object. The recipe is the same four steps every time: swap the diagonal, negate the other two, divide by the determinant. The check at the end is worth doing once by hand: multiplying the answer back into the original gives ones down the diagonal and zeros off it, and getting anything else means a sign slipped.

  4. 1 2 over 3 4, times 5 6 over 7 8

    1. Top left: (1 × 5) + (2 × 7) = 5 + 14 = 19
    2. Top right: (1 × 6) + (2 × 8) = 6 + 16 = 22
    3. Bottom left: (3 × 5) + (4 × 7) = 15 + 28 = 43
    4. Bottom right: (3 × 6) + (4 × 8) = 18 + 32 = 50
    5. Determinant of A: (1 × 4) − (2 × 3) = 4 − 6 = −2

    The row to swap. Put the same four numbers in with A and B exchanged and the answer becomes 23, 34, 31 and 46 — a completely different matrix, from the same inputs in a different order. Matrix multiplication is not commutative, and this is what that means in practice: if the two matrices are two transformations, the order they are multiplied in is the order they are applied in. Notice that the determinant of A is −2 here and −2 there, since both matrices happen to have the same determinant — the two answers differ in the four result elements, and the determinant column cannot tell them apart.

  5. A matrix whose determinant is zero, multiplied

    1. Top left: (1 × 1) + (2 × 3) = 1 + 6 = 7
    2. Top right: (1 × 2) + (2 × 4) = 2 + 8 = 10
    3. Bottom left: (2 × 1) + (4 × 3) = 2 + 12 = 14
    4. Bottom right: (2 × 2) + (4 × 4) = 4 + 16 = 20
    5. Determinant of A: (1 × 4) − (2 × 2) = 4 − 4 = 0

    The first matrix has a determinant of zero — its second row is exactly twice its first, so it squeezes the plane onto a line — and the multiplication is computed normally anyway. That is the point of the example: a zero determinant is a problem for inverting and for nothing else. Ask the same page to invert this matrix and it will decline. Ask it to add or multiply and it will answer, because both of those have perfectly well-defined answers here. The determinant column reads 0 either way.

Limitations

Only 2×2 matrices are accepted, one row per box, two numbers in each. Larger matrices would need a different layout rather than a bigger box, since the number of cells grows with the square of the size. The second matrix's boxes can be left empty, and whether they must be filled in depends on the operation rather than on the box: adding and multiplying need both matrices, inverting reads only the first. The inverse exists only when the determinant is non-zero, and that test is made against exactly zero rather than nearly zero, which is a real limitation as well as a decision. A tolerance would have to refuse genuinely invertible matrices to catch the cases near the boundary, so there is none; the cost is that a matrix entered with decimal elements that is singular in exact arithmetic can produce a determinant like 1.4e-17 instead of 0 and be inverted, giving four enormous numbers rather than a refusal. Entering whole numbers avoids this entirely, and a determinant that small is a signal in itself. Only the first matrix's determinant is shown, so the second one's has to be worked out by putting it in the first position. Components are read as ordinary numbers: a comma followed by a space separates the two numbers in a row, a comma with no space after it is read as a decimal point (1,5 is one and a half), and a thousands grouping is refused rather than guessed at — write 1500, not 1,500. Four decimal places is a display width rather than a claim about precision, and the inverse is computed from the unrounded determinant, so multiplying the printed answer back into A may not give exactly ones and zeros on the printed figures. There are no units anywhere on this page, and none are implied: the elements are plain numbers, and the four decimal places are the only thing being claimed about them.

Frequently asked questions

Why one box per row instead of one per number?
Because a matrix is one object, and four boxes would turn it into four inputs that can be filled in independently — including in ways that are not a matrix at all. A whole matrix in a single box has the opposite problem: there is no way to tell a missing element from a misplaced one. One box per row keeps the two numbers of a row together and still lets the page check that each row has exactly two.
When can I leave the second matrix empty?
When the operation you picked does not need it. Inverting reads only the first matrix, so both of the second matrix's boxes can stay empty and nothing is missing. Adding and multiplying need both, and the page will wait rather than complain while you are still typing. Whether a box must be filled in is decided by the operation, not by the box.
Why does inverting a matrix sometimes get refused?
Because the inverse is the matrix that undoes the first one, and a singular matrix — one whose determinant is zero — has no such inverse — the first matrix flattens the plane onto a line, so different inputs land on the same output and nothing can be reversed. The page refuses rather than printing four numbers that look like an answer. Adding and multiplying the same matrix work normally.
Which matrix does the determinant belong to?
Always the first one, whichever operation you chose, so it stays put as you switch between adding, multiplying and inverting the same input. It is a property of that matrix rather than of the answer, and it is what decides whether the inverse exists. If you want the second matrix's determinant, put it in the first position and invert it.
Does the order of the two matrices matter?
For multiplication, yes, and it is a real difference rather than a technicality: swapping the two matrices gives four different elements. If they are two transformations, the order they are multiplied in is the order they are applied in. Addition is the exception — matrices add the way ordinary numbers do, and the order makes no difference at all.
What is the inverse for?
Undoing the matrix. Multiply a matrix by its inverse in either order and you get the identity: ones down the diagonal, zeros off it. That is what makes it useful for going backwards — from a transformed set of coordinates back to the ones that produced it. The page prints the determinant next to it because a zero determinant is exactly the case where this cannot be done.

References

Related calculators