Category

Matrix Addition and Subtraction Calculator — Add and Subtract Matrices Step by Step

Add or subtract two matrices from 1×1 up to 4×4 and see every cell worked out one at a time. Because adding matrices is possible if and only if they are the same size, a single shape selector sets both A and B, so the operation is never undefined. Confirms that A + B = B + A while A − B = −(B − A), detects the zero matrix and additive inverses, and checks two claims against your own numbers: the trace is linear, tr(A ± B) = tr(A) ± tr(B), but the determinant is not — det(A + B) ≠ det(A) + det(B). Integer entries stay exact. Supports metric, US customary, and 20 world currencies including USD and the Russian Ruble.

0 calculations

Calculation Parameters

Enter any real numbers — integers, decimals, or negatives. Hidden cells are ignored.

Enter Parameters

Fill in the form on the left and click "Calculate"

Welcome to the matrix addition and subtraction calculator, where you'll have the chance to learn all about adding and subtracting matrices. As opposed to matrix multiplication, the two basic operations we describe today are just as easy on matrices as they are on regular numbers. We'll start with a basic definition and quickly move on to see how to add matrices. And, if you know how to get the sum, the difference is basically the same thing.

So, sit back, grab your morning/afternoon coffee, and let's begin!

What is a matrix?

You know all those well-known numbers like 2, -16, or 7½? These are what we call rational numbers. In essence, this means that they can be described in the form of a fraction of two integers. But it would be boring if mathematics ended there, so the scientists discovered an extension of rational numbers, which they call the real numbers. This new group includes any positive or negative number, like the square roots of any positive value or the mysterious π.

As the name suggests, real numbers are the real deal. In some sense, they are what describe the world around us, i.e., they appear in all the shapes we see. That's right – even the weird ones accompany us in everyday life: √2 is what gives us the diagonal of a square, and π is present in every circle's circumference.

Again, mathematicians got too bored to stop at that. Just like a dream in that famous movie, they decided to go deeper and discovered complex numbers and quaternions. We can't see these that easily in the world around us (but believe us, they're there), and calculations with them get a little tricky. Fortunately, they don't interest us here at all.

There is another extension of the real numbers. Think about it, what if instead of a single number... bear with us! What if instead of a single number, we considered a few of them at once? Mind = blown.

A matrix is an array of elements (usually numbers) that has a set number of rows and columns. An example of a matrix would be:

        ⎡  3  -1 ⎤
  A  =  ⎢  0   2 ⎥
        ⎣  1  -1 ⎦

Moreover, we say that a matrix has cells or boxes into which we write the elements of our array. For example, matrix A above has the value 2 in the cell that is in the second row and the second column.

Matrices are a way to store more data than an individual number. They do it by containing more than one number (unless they are a 1-cell matrix). Clever, huh? They (and their determinant) are useful, especially when dealing with:

  • Systems of equations, especially when trying to find the reduced row echelon form of a system;
  • Vectors and vector spaces;
  • 3-dimensional geometry (e.g., the dot product and the cross product);
  • Eigenvalues and eigenvectors; and
  • Graph theory and discrete mathematics.

But since they contain numbers and are supposed to be an extension of numbers, can we do the usual operations on matrices the way we do them on regular numbers? Like, if we know how to add regular numbers, does it mean that we know how to add matrices?

Yes and no. All the operations that we know from arithmetics are defined for matrices, but we have to be careful. As mentioned in the beginning, multiplying matrices is a tricky business. Dividing is even worse. Lucky for us, we've met each other on the matrix addition and subtraction calculator, so all we need is adding and subtracting matrices, and that is very easy.

Adding and subtracting matrices

The first thing you need to know when learning about matrices is that you can't always do what you want. With regular numbers, the worst that can ever happen is dividing by zero. Here, however, we have it worse than that.

Adding and subtracting matrices is possible if and only if the matrices are of the same size. The matrix A above is 3×2, so it can only be added to another 3×2 matrix — never to a 2×2 or a 3×3 one. There is no rule to patch the mismatch, no convention that pads the smaller matrix with zeros. The operation simply does not exist.

This is why the calculator above gives you one pair of size selectors rather than two. Since A and B must have the same shape, a single choice of rows and columns describes both — and the operation you ask for can never be undefined. (Compare this with multiplication, which is far fussier about which dimensions must agree, yet more forgiving overall: it only needs the inner ones to match.)

Once the shapes agree, the rule itself is refreshingly dull. To add two matrices, add the numbers that sit in the same cell:

  ⎡ 3  -1 ⎤   ⎡  2   5 ⎤   ⎡ 3+2   -1+5 ⎤   ⎡  5   4 ⎤
  ⎢ 0   2 ⎥ + ⎢ -1   0 ⎥ = ⎢ 0+(-1)  2+0 ⎥ = ⎢ -1   2 ⎥
  ⎣ 1  -1 ⎦   ⎣  4   3 ⎦   ⎣ 1+4   -1+3 ⎦   ⎣  5   2 ⎦

That's it. Each cell of the result looks at exactly two numbers — the ones in its own cell in A and in B — and ignores the rest of both matrices entirely. Nothing mixes across rows or columns. This is precisely what makes addition easy and multiplication hard: in a product, every single entry is a sum of products drawn from a whole row and a whole column.

And subtraction? Basically the same thing. Subtracting matrices means subtracting the numbers in matching cells, which is the same as adding the opposite matrix:

  A - B = A + (-B)

where −B is just B with the sign of every entry flipped. So there is really only one operation here wearing two hats.

The properties worth remembering

Matrix addition keeps the pleasant habits of ordinary arithmetic — the ones that matrix multiplication famously breaks:

  • It is commutative: A + B = B + A. This is worth pausing on. Matrix multiplication is not commutative — A·B and B·A are usually different, and often B·A isn't even defined. Addition has no such drama, and not by luck: every cell is a plain sum of two numbers, and plain sums commute.
  • It is associative: (A + B) + C = A + (B + C). So you can add a pile of same-sized matrices in any order you like.
  • The zero matrix is the identity: A + 0 = A. The matrix of all zeros does for matrix addition exactly what the number 0 does for ordinary addition.
  • Every matrix has an opposite: A + (−A) = 0. Which is what lets us define subtraction at all.
  • Subtraction is anticommutative: A − B = −(B − A). Swap the order and every entry flips sign. The two differences can only ever be equal if both are the zero matrix — that is, if A and B were the same matrix all along.

What survives the operation — and what doesn't

Here is the part that is easy to miss, and the calculator checks both claims against your own numbers rather than just asserting them.

The trace is linear. The trace of a square matrix is the sum of its diagonal, and since the diagonal of A + B is the sum of the diagonals of A and B, we get tr(A ± B) = tr(A) ± tr(B). You can read off the trace of the answer without ever building the answer.

The determinant is not. It is very tempting to expect the same courtesy from the determinant, but det(A + B) is not det(A) + det(B), and no formula computes it from det(A) and det(B) alone. The classic one-line proof: take A = B = the 2×2 identity matrix. Then det(A) = det(B) = 1, but A + B is the matrix with 2s on the diagonal, whose determinant is 4 — not 2. The determinant combines entries multiplicatively, so it cannot be split across a sum the way the trace can.

Example: using the matrix addition and subtraction calculator

Say you run two shops and keep a small table for each: rows are products, columns are months. The tables have the same shape because you track the same products over the same months — which is exactly the condition that makes them addable.

  1. Choose the rows and columns of your data. One choice covers both matrices, because they must match.
  2. Pick the operation: add to combine the two tables into a total, or subtract to compare them (actuals minus budget gives you the variance).
  3. Optionally set a unit context. Note that units must agree just as strictly as shapes do: you can add metres to metres, never metres to kilograms. If you're working with money, pick from 20 world currencies — the result stays in the same currency, since adding two amounts never changes what they're denominated in.
  4. Type the entries of A and B. Integers, decimals, and negatives all work.
  5. Read the result, the cell-by-cell breakdown, and the property checks.

The default matrices are 3×3 so that the trace and determinant sections have something to say: you'll see tr(A + B) land exactly on tr(A) + tr(B), while det(A + B) misses det(A) + det(B) by a mile — a contrast that only square matrices can show you.

FAQ

Can you add matrices of different sizes?

No. Addition and subtraction are defined only for matrices with the same number of rows and the same number of columns. Unlike multiplication — which asks only that the inner dimensions agree — there is no partial-credit version of the rule here. If the shapes differ, the sum does not exist.

Is matrix addition commutative?

Yes, always: A + B = B + A for any two matrices of the same size. This is one of the clearest differences from matrix multiplication, where A·B ≠ B·A in general.

Is matrix subtraction commutative?

No. A − B and B − A are opposites: A − B = −(B − A). They are equal only when both are the zero matrix, which happens exactly when A and B are identical.

What is the zero matrix?

The matrix whose entries are all 0. It is the additive identity: adding it to any matrix of the same size changes nothing, and A + (−A) = 0 for every A.

Does det(A + B) equal det(A) + det(B)?

No, and not even approximately. Take A = B = the 2×2 identity: det(A) + det(B) = 2, but det(A + B) = 4. The trace does behave linearly; the determinant does not.

How many matrices can I add at once?

This calculator handles two at a time, for sizes from 1×1 up to 4×4. Because addition is associative, adding three or more is just a matter of repeating the operation — feed the result back in as your new A.

Calculation History

Loading...