Add and subtract matrices

It is easy to add and subtract matrices. If you know how to add and subtract integers, this lesson will be a piece of cake. First, study the figure below carefully to see how it is done for a 2 × 2 matrix.

Add and subtract matrices

Based on the example in the figure above, to add or subtract matrices, we add or subtract their corresponding elements. For example, we add 8 and 9 to get 17.

Given two m × n matrices A = [ aij ] and B = [ bij ], with a and b located in row i and column j.

The sum is A + B = [ aij ] + [ bij ]

The difference is A - B = [ aij ] - [ bij ]

Using two 2 × 2 matrices,

  • the elements in the first row and first column are a11 and b11
  • the elements in the first row and second column are a12 and b12
  • the elements in the second row and first column are a21 and b21
  • the elements in the second row and second column are a22 and b22

Notice how we get the sum of the corresponding elements in the following addition of matrices:

$$ A + B = \begin{bmatrix} a_{11} & a_{12}\\ a_{21} & a_{22}\\ \end{bmatrix} + \begin{bmatrix} b_{11} & b_{12}\\ b_{21} & b_{22}\\ \end{bmatrix} = \begin{bmatrix} a_{11} + b_{11} & a_{12} + b_{12}\\ a_{21} + b_{21} & a_{22} + b_{22}\\ \end{bmatrix} $$

Notice also how we get the difference of the corresponding elements in the following subtraction of matrices:

$$ A - B = \begin{bmatrix} a_{11} & a_{12}\\ a_{21} & a_{22}\\ \end{bmatrix} - \begin{bmatrix} b_{11} & b_{12}\\ b_{21} & b_{22}\\ \end{bmatrix} = \begin{bmatrix} a_{11} - b_{11} & a_{12} - b_{12}\\ a_{21} - b_{21} & a_{22} - b_{22}\\ \end{bmatrix} $$

The important rule to know is that when adding and subtracting matrices, first make sure the matrices have the same dimensions. Suppose you are adding two matrices.

Then, this means that the number of rows in the first matrix must be equal to the number of rows in the second matrix. Similarly, the number of columns in the first matrix must be equal to the number of columns in the second matrix.

In order words, you can add or subtract a 2x3 with a 2x3 or a 3x3 with a 3x3. However, you cannot add a 3x2 with a 2x3 or a 2x2 with a 3x3.

More examples showing how to add and subtract matrices

Matrix addition


Add the two matrices shown below:

1 -4 0
8 -1 6
0 3 2
+   
9 3 7
-8 0 5
-3 2 9

Matrix addition


Add the two matrices shown below:

1 -4 0
8 -1 6
0 3 2
+   
9 3 7
-8 0 5
-3 2 9

Rule to follow in order to add and subtract matrices

You can add elements in the same position or elements in the same row and same column. We show these elements with the same color to make this crystal clear.

1 -4 0
8 -1 6
0 3 2
+   
9 3 7
-8 0 5
-3 2 9


1 + 9 -4 + 3 0 + 7
8 + -8 -1 + 0 6 + 5
0 + -3 3 + 2 2 + 9


10 -1 7
0 -1 11
-3 5 11
1 -4 0
8 -1 6
0 3 2
+   
9 3 7
-8 0 5
-3 2 9



1 + 9 -4 + 3 0 + 7
8 + -8 -1 + 0 6 + 5
0 + -3 3 + 2 2 + 9



10 -1 7
0 -1 11
-3 5 11

Matrix subtraction

Matrix subtraction is similar to matrix addition with the exception that you are subtracting elements in the same row and same column.

Subtract the two matrices below:

9 7 1
-2 0 4
8 -5 3
-   
6 1 8
-3 0 9
-1 2 1



9 - 6 7 - 1 1 - 8
-2 - -3 0 - 0 4 - 9
8 - -1 -5 - 2 3 - 1


3 6 -7
1 0 -5
9 -7 2

Matrix subtraction is similar to matrix addition with the exception that you are subtracting elements in the same row and same column.

Subtract the two matrices below:

9 7 1
-2 0 4
8 -5 3
-   
6 1 8
-3 0 9
-1 2 1



9 - 6 7 - 1 1 - 8
-2 - -3 0 - 0 4 - 9
8 - -1 -5 - 2 3 - 1


3 6 -7
1 0 -5
9 -7 2

Real-world connection

You have a business selling shirts and pants. The matrices below represent the number of shirts and pants that you sold in two weeks. The matrix on the left is week #1 and the matrix on the right is week #2.

Row #1 represents number of pants that you sold and row #2 represents number of shirts that you sold from Monday to Friday.

For example, you sold 40 pants on Wednesday (week 1).

You sold 28 shirts on Friday (week 2)

How many pants and shirts have you sold in two weeks?

Just perform matrix addition!

50 25 40 80 10
30 90 60 12 45
+   
20 30 70 65 80
55 35 75 14 28


50 + 20 25 + 30 40 + 70 80 + 65 10 + 80
30 + 55 90 + 35 60 + 75 12 + 14 45 + 28



70 55 110 145 90
85 125 135 26 73

Real-world connection

You have a business selling shirts and pants. The matrices below represent the number of shirts and pants that you sold in two weeks. The matrix on the left is week #1 and the matrix on the right is week #2.

Row #1 represents number of pants that you sold and row #2 represents number of shirts that you sold from Monday to Friday.

For example, you sold 40 pants on Wednesday (week 1).

You sold 28 shirts on Friday (week 2)

How many pants and shirts have you sold in two weeks?

Just perform matrix addition!

50 25 40 80 10
30 90 60 12 45
+   
20 30 70 65 80
55 35 75 14 28


50 + 20 25 + 30 40 + 70 80 + 65 10 + 80
30 + 55 90 + 35 60 + 75 12 + 14 45 + 28



70 55 110 145 90
85 125 135 26 73

Add and subtract matrices quiz. Check how well you understand this lesson.