Omni Calculator logo

Matrix Addition And Subtraction Calculator

Created by Maciej Kowalski, PhD candidate
Reviewed by Bogna Szyk and Jack Bowater
Last updated: Jul 13, 2023

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 ? 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.

Adding and subtracting matrices is mind-blowing.

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:

A=[310211]A = \begin{bmatrix} 3 & -1 \\ 0 & 2 \\ 1 & -1 \end{bmatrix}

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.

You might want to check out our matrix determinant calculator to learn about how to determine a determinant of matrices.

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. For example, recall the matrix A\text A from the above section:

A=[310211]A = \begin{bmatrix} 3 & -1 \\ 0 & 2 \\ 1 & -1 \end{bmatrix}

If we have two other matrices:

B=[1014]B = \begin{bmatrix} 1 & 0 \\ -1 & 4 \end{bmatrix}


C=[442824]C = \begin{bmatrix} 4 & -4 \\ -2 & 8 \\ 2 & -4 \end{bmatrix}

then there is no such thing as A + B or A − B, but A + C and A − C are perfectly fine.

Now, how do we know how to add matrices? It's just as you might have expected: we do it cell by cell. In general, let us take two matrices of the same size and call them A and B. Say that their cells are indexed by aij and bij, respectively, where i denotes the number of the row and j denotes the number of the column. Then if A + B has cells cij and A − B has cells dij, then:

cij = aij + bij and dij = aij - bij

A piece of cake, wouldn't you say? Also, in particular, observe that A + B and A − B have the same size as the matrices we started with.

Might we suggest trying out the reduced row echelon form calculator, where we solve a system of equations of your choice using the matrix row reduction and elementary row operations?

Why don't we make good use of the time we spent reading through all this theory and see some examples?

Example: using the matrix addition and subtraction calculator

Suppose that you'd like to keep track of your monthly budget throughout the year. We'll do it with the help of matrices and the matrix addition and subtraction calculator.

Say that you make $3,000 per month, so, let's put that in each cell of our matrix as the base amount we'll be working with.

base=[$3,000$3,000$3,000$3,000$3,000$3,000$3,000$3,000$3,000]\footnotesize \text {base} = \begin{bmatrix} \$3,\!000 & \$3,\!000 & \$3,\!000 \\ \$3,\!000 & \$3,\!000 & \$3,\!000 \\ \$3,\!000 & \$3,\!000 & \$3,\!000 \end{bmatrix}

We see that we have a matrix with four rows and three columns, so, if we'd like to use the matrix addition and subtraction calculator, we need to input those dimensions at the top of our tool. This will show us a symbolic picture of the operation we'll be doing. The first matrix in our calculations will be the base described above. This means that the $3,000-values need to be input as the left array's cells. Since its coefficients are a₁, b₁, c₁, a₂, and so on, we should put

a₁ = 3,000, a₂ = 3,000, a₃ = 3,000,

b₁ = 3,000, b₂ = 3,000, b₃ = 3,000,

c₁ = 3,000, c₂ = 3,000, c₃ = 3,000,

d₁ = 3,000, d₂ = 3,000, d₃ = 3,000.

Here each cell represents one month, and each row represents a quarter of the year. Suppose that you get an additional $250 Easter bonus in April (first month of the second quarter) and a $250 Christmas bonus in December (third month of the fourth quarter). Also, in September (third month of the third quarter), you've earnt a raise netting you $300 more a month since then. Lastly, you've taken some time off to drink a cold one at the beach between July and August (first and second month of the third quarter), so they've cut a percentage of your salary for those months, by, say, $400.

Let's try to translate all that information into a new matrix:

changes=[$0$0$0$250$0$0$400$400$300$300$300$550]\footnotesize \text {changes} = \begin{bmatrix} \$0 & \$0 & \$0 \\ \$250 & \$0 & \$0 \\ -\$400 & -\$400 & \$300 \\ \$300 & \$300 & \$550 \\ \end{bmatrix}

Observe that we have the $400 cells with a minus since that amount was deducted from the income. Similarly to what we did above, we now input the values as the cells of the second matrix:

x₁ = 0, x₂ = 0, x₃ = 0,

y₁ = 250, y₂ = 0, y₃ = 0,

z₁ = -400, z₂ = -400, z₃ = 300,

u₁ = 300, u₂ = 300, u₃ = 550.

Once we put the last number, the matrix addition and subtraction calculator will spit out the sum of the two arrays, which will be the monthly income. However, now that we know how to add matrices, we can also do that by hand:

 income=base+change=[$3,000+$0$3,000+$0$3,000+$0$3,000+$250$3,000+$0$3,000+$0$3,000+($400)$3,000+($400)$3,000+$300$3,000+$300$3,000+$300$3,000+$550]\footnotesize \ \text {income} = \text {base}+ \text {change} \\[1em] \tiny = \begin{bmatrix} \$3,\!000+\$0 & \$3,\!000+\$0 & \$3,\!000+\$0\\ \$3,\!000+\$250 & \$3,\!000+\$0 & \$3,\!000+\$0\\ \$3,\!000+(-\$400) & \$3,\!000+(-\$400) & \$3,\!000+\$300\\ \$3,\!000+\$300 & \$3,\!000+\$300 & \$3,\!000+\$550 \end{bmatrix}
=[$3,000$3,000$3,000$3,250$3,000$3,000$2,600$2,600$3,300$3,300$3,3000$3,550]\footnotesize = \begin{bmatrix} \$3,\!000 & \$3,\!000 & \$3,\!000\\ \$3,\!250 & \$3,\!000 & \$3,\!000\\ \$2,\!600 & \$2,\!600 & \$3,\!300\\ \$3,\!300 & \$3,\!3000 & \$3,\!550 \end{bmatrix}

Unfortunately, that is only the income. It would be far easier to [make our dreams come true if we didn't spend any of that on bills or whatnot, wouldn't you say?

Now let's try to sum up your regular monthly expenses:

  • $850 for rent and bills;
  • $600 for loan repayment;
  • $150 for gas;
  • $700 for groceries;
  • $150 for eating out (including tips); and
  • $250 for other expenses.

This means that we have

$750+$600+$150+$700+$150+$250=$2, ⁣700\$750 + \$600 + \$150 + \$700 + \$150 + \$250 = \$2,\!700

as a base for how much you spend. If we add to that a $1,000 vacation that you paid in July, a $600 car repair in May, and a $400 Black Friday shopping spree in November, we can make a new matrix:

 expenses=[$2,700$2,700$2,700$2,700$2,700+$600$2,700$2,700+$1,000$2,700$2,700$2,700$2,700+$400$2,700]\footnotesize \ \text {expenses} \\[1em] \tiny = \begin{bmatrix} \$2,700 & \$2,700 & \$2,700\\ \$2,700 & \$2,700+\$600 & \$2,700\\ \$2,700+\$1,000 & \$2,700 &\$2,700\\ \$2,700 & \$2,700+\$400 & \$2,700 \end{bmatrix}
=[$2,700$2,700$2,700$2,700$3,300$2,700$3,700$2,700$2,700$2,700$3,100$2,700]\footnotesize = \begin{bmatrix} \$2,700 & \$2,700 & \$2,700\\ \$2,700 & \$3,300 & \$2,700\\ \$3,700 & \$2,700 &\$2,700\\ \$2,700 & \$3,100 & \$2,700 \end{bmatrix}

No different signs this time. It's difficult to make any profit when taking care of expenses. Boy, how we wish that wasn't the case.

We're left with nothing else than to calculate the total monthly balance, i.e., the difference between our income and expenses. Remember, however, that if you're using the matrix addition and subtraction calculator for that, you need to change the operation at the top to subtraction. But we know all about adding and subtracting matrices, so we can also do it ourselves:

 budget=incomeexpenses=[$3,000$2,700$3,000$2,700$3,000$2,700$3,250$2,700$3,000$3,300$3,000$2,700$2,600$3,700$2,600$2,700$3,300$2,700$3,300$2,700$3,300$3,100$3,550$2,700]\footnotesize \ \text {budget} = \text {income}- \text {expenses} \\[1em] = \tiny \begin{bmatrix} \$3,\!000 - \$2,\!700 & \$3,\!000 - \$2,\!700 & \$3,\!000 - \$2,\!700\\ \$3,\!250 - \$2,\!700 & \$3,\!000 - \$3,\!300 & \$3,\!000 - \$2,\!700\\ \$2,\!600 - \$3,\!700 & \$2,\!600 - \$2,\!700 & \$3,\!300 - \$2,\!700\\ \$3,\!300 - \$2,\!700 & \$3,\!300 - \$3,\!100 & \$3,\!550 - \$2,\!700\\ \end{bmatrix}
=[$300$300$300$550$300$300$1,100$100$600$600$200$850]\footnotesize = \begin{bmatrix} \$300 & \$300 & \$300\\ \$550 & -\$300 & \$300\\ -\$1,100 & -\$100 & \$600\\ \$600 & \$200 & \$850\\ \end{bmatrix}

Well, there are a few minuses, but thankfully, the savings we made were able to take care of that. Also, the end of the year seemed promising. If we changed the car for a bike from time to time, then we might make use of a cash ISA. Something with a good interest rate, perhaps?

Maciej Kowalski, PhD candidate
Related calculators
Addition ➕
The sum of two matrices.
Matrix size
Number of rows
Number of columns
First matrix entries
Second matrix entries
Check out 35 similar linear algebra calculators 🔢
Adjoint matrixCharacteristic polynomialCholesky decomposition… 32 more
People also viewed…

Coffee kick

A long night of studying? Or maybe you're on a deadline? The coffee kick calculator will tell you when and how much caffeine you need to stay alert after not sleeping enough 😀☕ Check out the graph below!

Multiplying fractions

Use this multiplying fractions calculator to multiply up to 5 fractions. You can multiply simple fractions by whole numbers, mixed numbers, improper numbers, or negative fractions.

Simplify ratio

Calculate the simplest form of a ratio with this simplify ratio calculator.


Do you always remember to put on sunscreen before going outside? Are you sure that you use enough? The Sunbathing Calculator ☀ will tell you when's the time to go back under an umbrella not to suffer from a sunburn!
Copyright by Omni Calculator sp. z o.o.
Privacy, Cookies & Terms of Service