Finding the Sum and Difference of Two Matrices

To solve a problem like the one described for the soccer teams, we can use a matrix, which is a rectangular array of numbers. A row in a matrix is a set of numbers that are aligned horizontally. A column in a matrix is a set of numbers that are aligned vertically. Each number is an entry, sometimes called an element, of the matrix. Matrices (plural) are enclosed in [ ] or ( ), and are usually named with capital letters. For example, three matrices named

A,B,A,B,\text{}
and
CC
are shown below.

A=[1234],B=[127056782],C=[103321]A=\left[\begin{array}{cc}1& 2\\ 3& 4\end{array}\right],B=\left[\begin{array}{ccc}1& 2& 7\\ 0& -5& 6\\ 7& 8& 2\end{array}\right],C=\left[\begin{array}{c}-1\\ 0\\ 3\end{array}\begin{array}{c}3\\ 2\\ 1\end{array}\right]

Describing Matrices

A matrix is often referred to by its size or dimensions:
 m × n \text{ }m\text{ }\times \text{ }n\text{ }
indicating
mm
rows and
nn
columns. Matrix entries are defined first by row and then by column. For example, to locate the entry in matrix
AA
identified as
aij,{a}_{ij},\text{}
we look for the entry in row
i,i,\text{}
column
jj
. In matrix
A,A\text{,} \hspace{0.17em}
shown below, the entry in row 2, column 3 is
a23{a}_{23}
.

A=[a11a12a13a21a22a23a31a32a33]A=\left[\begin{array}{ccc}{a}_{11}& {a}_{12}& {a}_{13}\\ {a}_{21}& {a}_{22}& {a}_{23}\\ {a}_{31}& {a}_{32}& {a}_{33}\end{array}\right]
A square matrix is a matrix with dimensions
 n × n,\text{ }n\text{ }\times \text{ }n,\text{}
meaning that it has the same number of rows as columns. The
3×33\times 3
matrix above is an example of a square matrix.

A row matrix is a matrix consisting of one row with dimensions
1 × n1\text{ }\times \text{ }n
.

[a11a12a13]\left[\begin{array}{ccc}{a}_{11}& {a}_{12}& {a}_{13}\end{array}\right]
A column matrix is a matrix consisting of one column with dimensions
m × 1m\text{ }\times \text{ }1
.

[a11a21a31]\left[\begin{array}{c}{a}_{11}\\ {a}_{21}\\ {a}_{31}\end{array}\right]
A matrix may be used to represent a system of equations. In these cases, the numbers represent the coefficients of the variables in the system. Matrices often make solving systems of equations easier because they are not encumbered with variables. We will investigate this idea further in the next section, but first we will look at basic matrix operations.

A General Note: Matrices

A matrix is a rectangular array of numbers that is usually named by a capital letter:
A,B,C,A,B,C,\text{}
and so on. Each entry in a matrix is referred to as
aij{a}_{ij}
, such that
ii
represents the row and
jj
represents the column. Matrices are often referred to by their dimensions:
m×nm\times n
indicating
mm
rows and
nn
columns.

Example 1: Finding the Dimensions of the Given Matrix and Locating Entries

Given matrix
A:A:


  1. What are the dimensions of matrix
    A?A?
  2. What are the entries at
    a31{a}_{31}
    and
    a22?{a}_{22}?


    A=[210247312]A=\left[\begin{array}{rrrr}\qquad 2& \qquad & \qquad 1& \qquad 0\\ \qquad 2& \qquad & \qquad 4& \qquad 7\\ \qquad 3& \qquad & \qquad 1& \qquad -2\end{array}\right]

Solution

  1. The dimensions are
     3 × 3 \text{ }3\text{ }\times \text{ }3\text{ }
    because there are three rows and three columns.
  2. Entry
    a31{a}_{31}
    is the number at row 3, column 1, which is 3. The entry
    a22{a}_{22}
    is the number at row 2, column 2, which is 4. Remember, the row comes first, then the column.

Adding and Subtracting Matrices

We use matrices to list data or to represent systems. Because the entries are numbers, we can perform operations on matrices. We add or subtract matrices by adding or subtracting corresponding entries.

In order to do this, the entries must correspond. Therefore, addition and subtraction of matrices is only possible when the matrices have the same dimensions. We can add or subtract a
 3 × 3 \text{ }3\text{ }\times \text{ }3\text{ }
matrix and another
 3 × 3 \text{ }3\text{ }\times \text{ }3\text{ }
matrix, but we cannot add or subtract a
 2 × 3 \text{ }2\text{ }\times \text{ }3\text{ }
matrix and a
 3 × 3 \text{ }3\text{ }\times \text{ }3\text{ }
matrix because some entries in one matrix will not have a corresponding entry in the other matrix.

A General Note: Adding and Subtracting Matrices

Given matrices
AA
and
BB
of like dimensions, addition and subtraction of
AA
and
BB
will produce matrix
CC
or matrix
DD
of the same dimension.

A+B=C such that aij+bij=cijA+B=C\text{ such that }{a}_{ij}+{b}_{ij}={c}_{ij}
AB=D such that aijbij=dijA-B=D\text{ such that }{a}_{ij}-{b}_{ij}={d}_{ij}
Matrix addition is commutative.

A+B=B+AA+B=B+A
It is also associative.

(A+B)+C=A+(B+C)\left(A+B\right)+C=A+\left(B+C\right)

Example 2: Finding the Sum of Matrices

Find the sum of
AA
and
B,B,\text{}
given

A=[abcd] and B=[efgh]A=\left[\begin{array}{cc}a& b\\ c& d\end{array}\right]\text{ and }B=\left[\begin{array}{cc}e& f\\ g& h\end{array}\right]

Solution

Add corresponding entries.

A+B=[abcd]+[efgh] =[a+eb+fc+gd+h]\begin{array}{l}A+B=\left[\begin{array}{cc}a& b\\ c& d\end{array}\right]+\left[\begin{array}{cc}e& f\\ g& h\end{array}\right]\qquad \\ \text{ }=\left[\begin{array}{ccc}a+e& & b+f\\ c+g& & d+h\end{array}\right]\qquad \end{array}

Example 3: Adding Matrix A and Matrix <>B

Find the sum of
AA
and
BB
.

A=[4132] and B=[5907]A=\left[\begin{array}{cc}4& 1\\ 3& 2\end{array}\right]\text{ and }B=\left[\begin{array}{cc}5& 9\\ 0& 7\end{array}\right]

Solution

Add corresponding entries. Add the entry in row 1, column 1,
a11,{a}_{11},\text{}
of matrix
AA
to the entry in row 1, column 1,
b11{b}_{11}
, of
BB
. Continue the pattern until all entries have been added.

A+B=[4132]+[5907] =[4+51+93+02+7] =[91039]\begin{array}{l}A+B=\left[\begin{array}{cc}4& 1\\ 3& 2\end{array}\right]+\left[\begin{array}{cc}5& 9\\ 0& 7\end{array}\right]\qquad \\ \text{ }=\left[\begin{array}{ccc}4+5& & 1+9\\ 3+0& & 2+7\end{array}\right]\qquad \\ \text{ }=\left[\begin{array}{cc}9& 10\\ 3& 9\end{array}\right]\qquad \end{array}

Example 4: Finding the Difference of Two Matrices

Find the difference of
AA
and
BB
.

A=[2301] and B=[8154]A=\left[\begin{array}{cc}-2& 3\\ 0& 1\end{array}\right]\text{ and }B=\left[\begin{array}{cc}8& 1\\ 5& 4\end{array}\right]

Solution

We subtract the corresponding entries of each matrix.

AB=[2301][8154] =[28310514] =[10253]\begin{array}{l}A-B=\left[\begin{array}{rr}\qquad -2& \qquad 3\\ \qquad 0& \qquad 1\end{array}\right]-\left[\begin{array}{rr}\qquad 8& \qquad 1\\ \qquad 5& \qquad 4\end{array}\right]\qquad \\ \text{ }=\left[\begin{array}{rrr}\qquad -2 - 8& \qquad & \qquad 3 - 1\\ \qquad 0 - 5& \qquad & \qquad 1 - 4\end{array}\right]\qquad \\ \text{ }=\left[\begin{array}{rrr}\qquad -10& \qquad & \qquad 2\\ \qquad -5& \qquad & \qquad -3\end{array}\right]\qquad \end{array}

Example 5: Finding the Sum and Difference of Two 3 x 3 Matrices

Given
AA
and
B:B:


  1. Find the sum.
  2. Find the difference.
A=[2102141210422] and B=[61020124522]A=\left[\begin{array}{rrr}\qquad 2& \qquad -10& \qquad -2\\ \qquad 14& \qquad 12& \qquad 10\\ \qquad 4& \qquad -2& \qquad 2\end{array}\right]\text{ and }B=\left[\begin{array}{rrr}\qquad 6& \qquad 10& \qquad -2\\ \qquad 0& \qquad -12& \qquad -4\\ \qquad -5& \qquad 2& \qquad -2\end{array}\right]

Solution

  1. Add the corresponding entries.

    A+B=[2102141210422]+[61020124522]=[2+610+102214+01212104452+222]=[8041406100]\begin{array}{l}\qquad \\ A+B=\left[\begin{array}{rrr}\qquad 2& \qquad -10& \qquad -2\\ \qquad 14& \qquad 12& \qquad 10\\ \qquad 4& \qquad -2& \qquad 2\end{array}\right]+\left[\begin{array}{rrr}\qquad 6& \qquad 10& \qquad -2\\ \qquad 0& \qquad -12& \qquad -4\\ \qquad -5& \qquad 2& \qquad -2\end{array}\right]\qquad \\ =\left[\begin{array}{rrr}\qquad 2+6& \qquad -10+10& \qquad -2 - 2\\ \qquad 14+0& \qquad 12 - 12& \qquad 10 - 4\\ \qquad 4 - 5& \qquad -2+2& \qquad 2 - 2\end{array}\right]\qquad \\ =\left[\begin{array}{rrr}\qquad 8& \qquad 0& \qquad -4\\ \qquad 14& \qquad 0& \qquad 6\\ \qquad -1& \qquad 0& \qquad 0\end{array}\right]\qquad \end{array}
  2. Subtract the corresponding entries.

    AB=[2102141210422][61020124522]=[2610102+214012+1210+44+5222+2]=[4200142414944]\begin{array}{l}\qquad \\ A-B=\left[\begin{array}{rrr}\qquad 2& \qquad -10& \qquad -2\\ \qquad 14& \qquad 12& \qquad 10\\ \qquad 4& \qquad -2& \qquad 2\end{array}\right]-\left[\begin{array}{rrr}\qquad 6& \qquad 10& \qquad -2\\ \qquad 0& \qquad -12& \qquad -4\\ \qquad -5& \qquad 2& \qquad -2\end{array}\right]\qquad \\ =\left[\begin{array}{rrr}\qquad 2 - 6& \qquad -10 - 10& \qquad -2+2\\ \qquad 14 - 0& \qquad 12+12& \qquad 10+4\\ \qquad 4+5& \qquad -2 - 2& \qquad 2+2\end{array}\right]\qquad \\ =\left[\begin{array}{rrr}\qquad -4& \qquad -20& \qquad 0\\ \qquad 14& \qquad 24& \qquad 14\\ \qquad 9& \qquad -4& \qquad 4\end{array}\right]\qquad \end{array}

Try It 1

Add matrix
AA
and matrix
BB
.

A=[261013] and B=[321543]A=\left[\begin{array}{rr}\qquad 2& \qquad 6\\ \qquad 1& \qquad 0\\ \qquad 1& \qquad -3\end{array}\right]\text{ and }B=\left[\begin{array}{rr}\qquad 3& \qquad -2\\ \qquad 1& \qquad 5\\ \qquad -4& \qquad 3\end{array}\right]
Solution

Licenses and Attributions