Skip to main content

Addition and subtraction of matrices

The addition and subtraction of matrices is important across many applications, from computer graphics and image processing to statistics. Use this resource to learn the rules for adding and subtracting matrices.

Addition of matrices

There is one key rule for adding matrices.

Matrices of the same shape (same number of rows and columns) may be added by adding the corresponding elements.

Three 2 by 2 matrices. The first has the value a1 in row 1 column 1, and the second has the value b1 in row 1 column 1. The two matrices have a plus symbol between them. In the third 2 by 2 matrix, which is the answer, the equation a1+b1=c1 is shown in row 1 column 1.

Let's consider the three matrices, \(A\), \(B\) and \(C\).

\[ A = \left[\begin{array}{ccc} 3 & 2 & -1\\
1 & 5 & -4
\end{array}\right]\quad
B = \left[\begin{array}{ccc} 1 & 0 & 2\\
3 & 1 & -2
\end{array}\right]\quad
C = \left[\begin{array}{cc} 2 & -3\\
4 & 3
\end{array}\right] \]

Notice that \(A\) and \(B\) are the same shape \(\left(2\times3\right)\), whereas \(C\) is \(\left(2\times2\right)\).

We can add \(A\) and \(B\) together.

\[\begin{align*} A+B & = \left[\begin{array}{ccc} 3 & 2 & -1\\
1 & 5 & -4
\end{array}\right]
+\left[\begin{array}{ccc} 1 & 0 & 2\\
3 & 1 & -2 \end{array}\right]\\
& = \left[\begin{array}{ccc} 3+1 & 2+0 & -1+2\\
1+3 & 5+1 & -4+(-2)
\end{array}\right]\\
& = \left[\begin{array}{ccc} 4 & 2 & 1\\
4 & 6 & -6
\end{array}\right]
\end{align*}\]

\(A+B\) is the same as \(B+A\). On the other hand, \(A+C\) and \(B+C\) are not defined as these pairs of matrices have different shapes.

Subtraction of matrices

The rule for subtracting matrices is similar to adding them.

One matrix may be subtracted from another of the same shape by subtracting the corresponding elements.

Three 2 by 2 matrices. The first has the value a1 in row 1 column 1, and the second has the value b1 in row 1 column 1. The two matrices have a minus sign between them. In the third 2 by 2 matrix, which is the answer, the equation a1-b1=c1 is shown in row 1 column 1.

Let's consider the same matrices \(A\), \(B\) and \(C\).

\[ A = \left[\begin{array}{ccc} 3 & 2 & -1\\
1 & 5 & -4
\end{array}\right]\quad
B = \left[\begin{array}{ccc} 1 & 0 & 2\\
3 & 1 & -2
\end{array}\right]\quad
C = \left[\begin{array}{cc} 2 & -3\\
4 & 3
\end{array}\right] \]

We can find \(A-B\) as they are both \(\left(2\times3\right)\) matrices.

\[\begin{align*} A-B & = \left[\begin{array}{ccc} 3 & 2 & -1\\
1 & 5 & -4
\end{array}\right]
-\left[\begin{array}{ccc} 1 & 0 & 2\\
3 & 1 & -2
\end{array}\right]\\
& = \left[\begin{array}{ccc} 3-1 & 2-0 & -1-2\\
1-3 & 5-1 & -4-(-2)
\end{array}\right]\\
& = \left[\begin{array}{ccc} 2 & 2 & -3\\
-2 & 4 & -2
\end{array}\right]
\end{align*}\]

\(A-C\) and \(B-C\) are not defined as \(A\) and \(B\) are \(\left(2\times3\right)\) and \(C\) is \(\left(2\times2\right)\). Remember that you cannot subtract matrices that have different shapes.

We can also calculate \(B-A\).

\[\begin{align*} B-A & = \left[\begin{array}{ccc} 1 & 0 & 2\\
3 & 1 & -2
\end{array}\right]
-\left[\begin{array}{ccc} 3 & 2 & -1\\
1 & 5 & -4
\end{array}\right]\\
& = \left[\begin{array}{ccc} 1-3 & 0-2 & 2-(-1)\\
3-1 & 1-5 & -2-(-4)
\end{array}\right]\\
& = \left[\begin{array}{ccc} -2 & -2 & 3\\
2 & -4 & 2
\end{array}\right]
\end{align*}\]

The order in which matrices are subtracted is important just as it is when subtracting real numbers. This means that \(A-B\neq B-A\). What you might notice, however, is that \(B-A=-\left(A-B\right)\).

Your turn – adding and subtracting matrices

  1. Consider the matrices.
    \[ A = \left[\begin{array}{c} 2\\
    3
    \end{array}\right]\quad
    B = \left[\begin{array}{cc} 1 & 2\\
    4 & 3
    \end{array}\right]\quad
    C = \left[\begin{array}{cc} 5 & 3\\
    -1 & 2
    \end{array}\right]\quad
    D = \left[\begin{array}{cc} 2 & 3
    \end{array}\right]\quad
    E = \left[\begin{array}{cc} -1 & 0\\
    2 & -1
    \end{array}\right] \]
    Find, if possible:
    1. \(A+B\)
    2. \(B-C\)
    3. \(A-D\)
    4. \(B+E\)
    5. \(E-D\)

    1. not possible
    2. \(\left[ \begin{array}{cc} -4 & -1\\
      5 & 1
      \end{array} \right]\)
    3. not possible
    4. \(\left[ \begin{array}{cc} 0 & 2\\
      6 & 2
      \end{array} \right]\)
    5. not possible

Scalar multiplication of matrices

Scalar multiplication of matrices is the same as adding the matrix by itself, multiple times.

For scalar multiplication of matrices, each element in the matrix is multiplied by the scalar (number).

Two 2 by2 matrices. One 2 by 2 matrix is multiplied by a number designated the letter a. The matrix has the value b1 in row 1 column 1. In the second 2 by 2 matrix, which is the answer, the equation a times b1=c1 is shown in row 1 column 1.

Here, let's consider matrices \(D\) and \(E\).

\[ D = \left[\begin{array}{cc} 1 & 2\\
5 & 4
\end{array} \right]\quad
E = \left[\begin{array}{cc} 2 & -3\\
0 & -1
\end{array} \right] \]

We can calculate \(5D\) which is \(5\times D\).

\[\begin{align*} 5D & = 5\times\left[ \begin{array}{cc} 1 & 2\\
5 & 4
\end{array} \right]\\
& = \left[\begin{array}{cc} 5\times1 & 5\times2\\
5\times5 & 5\times4
\end{array} \right]\\
& = \left[\begin{array}{cc} 5 & 10\\
25 & 20
\end{array} \right]
\end{align*}\]

Another example is \(-2D\) or \(-2\times D\).

\[\begin{align*} -2D & = -2\times\left[ \begin{array}{cc} 1 & 2\\
5 & 4
\end{array} \right]\\
& = \left[\begin{array}{cc} -2\times1 & -2\times2\\
-2\times5 & -2\times4
\end{array} \right]\\
& = \left[\begin{array}{cc} -2 & -4\\
-10 & -8
\end{array} \right]
\end{align*}\]

You can also use scalar multiplication with addition or subtraction. For example, \(5D-2E\) is \(\left(5\times D\right)-\left(2\times E\right)\).

\[\begin{align*} 5D-2E & = 5\times\left [\begin{array}{cc} 1 & 2\\
5 & 4
\end{array}\right]
-2\times\left[ \begin{array}{cc} 2 & -3\\
0 & -1
\end{array}\right]\\
& = \left [ \begin{array}{cc} 5\times1 & 5\times2\\
5\times5 & 5\times4
\end{array} \right]
-\left[ \begin{array}{cc} 2\times2 & 2\times\left(-3\right)\\
2\times0 & 2\times\left(-1\right)
\end{array} \right]\\
& = \left[ \begin{array}{cc} 5 & 10\\
25 & 20
\end{array} \right]
-\left[ \begin{array}{cc} 4 & -6\\
0 & -2
\end{array} \right]\\
& = \left[ \begin{array}{cc} 5-4 & 10-\left(-6\right)\\
25-0 & 20-\left(-2\right)
\end{array} \right]\\
& = \left[ \begin{array}{cc} 1 & 16\\
25 & 22
\end{array} \right]
\end{align*}\]

Your turn – multiplying matrices by scalars

  1. Consider the matrices.
    \[\begin{align*} A & = \left[ \begin{array}{ccc} 2 & 3 & 1\\
    0 & 1 & 2
    \end{array} \right]\quad
    B = \left[ \begin{array}{c} 4\\
    -1\\
    2
    \end{array} \right]\quad
    C = \left[ \begin{array}{ccc} 1 & -1 & 2\\
    2 & 0 & 1
    \end{array} \right]\\
    D & = \left[ \begin{array}{c} 1\\
    0\\
    -1
    \end{array} \right]\quad
    E = \left[ \begin{array}{ccc} 0 & 1 & 3\\
    1 & 0 & 2
    \end{array} \right]
    \end{align*}\] Find, if possible.
    1. \(2A+B\)
    2. \(4D-B\)
    3. \(3C-A\)
    4. \(B+2D+E\)
    5. \(3C-A+3E\)

    1. not possible
    2. \(\left[ \begin{array}{c} 0\\
      -1\\
      -6
      \end{array} \right]\)
    3. \(\left[ \begin{array}{ccc} 1 & -6 & 5\\
      6 & -1 & 1
      \end{array} \right]\)
    4. not possible
    5. \(\left[ \begin{array}{ccc} 1 & -3 & 14\\
      9 & -1 & 7
      \end{array} \right]\)

Images on this page by RMIT, licensed under CC BY-NC 4.0


Keywords