topic badge

4.03 Operations with matrices

Lesson

Concept summary

Data may be represented in a matrix to make it easier to manipulate the data and solve problems in a given context. We can then manipulate the data sets by adding, subtracting, or multiplying the matrices as necessary to solve the problem.

The solution of the problem may require the entire resulting matrix or just the elements of the resulting matrix. The final answer should be written in the context of the problem.

Matrix Addition

The process of adding corresponding elements of multiple matrices of the same order.

If A=\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} and B= \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} , to add A+B add each corresponding element a_{ij}+b_{ij}.

This process is shown below:

\begin{aligned} 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} \\ b_{21}+b_{21} & a_{22}+b_{22} \end{bmatrix} \end{aligned}
Matrix Subtraction

The process of subtracting corresponding elements of multiple matrices of the same order.

If A=\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} and B= \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} , to subtract A-B subtract each corresponding element a_{ij}-b_{ij}.

This process is shown below:

\begin{aligned} 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} \\ b_{21}-b_{21} & a_{22}-b_{22} \end{bmatrix} \end{aligned}
Matrix Multiplication

The process of multiplying two matrices, where the ijth entry of the product matrix is the product of the ith row of the left matrix and the jth column of the right matrix.

To find the product of a row and column, we multiply the corresponding row entries and column entries together and take their sum. For example:\begin{bmatrix} a_{11} & a_{12} \end{bmatrix} \begin{bmatrix} b_{11} \\ b_{21} \end{bmatrix}=\begin{bmatrix} a_{11}b_{11}+a_{12}b_{21}\end{bmatrix}It is for this reason that the number of columns of the left matrix must be the same as the number of rows of the right matrix, otherwise we cannot multiply the rows and columns together.

If the order of the first matrix being multiplied is a\times b and the order of the second matrix being multiplied is b\times c, then the multiplication results in an a\times c matrix.

For example:

\displaystyle \begin{aligned} AB &=\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}\begin{bmatrix} b_{11} & b_{12} & b_{13} \\ b_{21} & b_{22} & b_{23} \end{bmatrix} \\ &= \begin{bmatrix} a_{11}b_{11} +a_{12}b_{21} & a_{11}b_{12} +a_{12}b_{22} & a_{11}b_{13} +a_{12}b_{23}\\ a_{21}b_{11} +a_{22}b_{21} & a_{21}b_{12} +a_{22}b_{22} & a_{21}b_{13} +a_{22}b_{23} \end{bmatrix} \end{aligned}
\bm{A}
the 2\times 2 matrix being multiplied
\bm{B}
the 2\times 3 matrix being multiplied
\bm{a_{ij}}
the element from matrix A in row i, column j
\bm{b_{ij}}
the element from matrix B in row i, column j
Scalar Multiplication

The process of multiplying a matrix, by a constant or scalar, k, where each term in the matrix is multiplied by the scalar k.

Example:

2\begin{bmatrix} 1 & -3 \\ 4 & 0 \end{bmatrix}=\begin{bmatrix} 2 & -6 \\ 8 & 0 \end{bmatrix}

Scalar

A single number or constant

For the matrix A=\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}, and the scalar k: \quad kA=\begin{bmatrix} k \cdot a_{11} & k \cdot a_{12} \\ k \cdot a_{21} & k \cdot a_{22} \end{bmatrix}.

Two special types of matrices are a zero matrix and identity matrix. The roles that zero matrices and identity matrices play in matrix addition and multiplication are similar to the roles of 0 and 1 in the real number system.

Zero matrix

A matrix of any dimension where all of the elements are zero.

A zero matrix is indicated by O.

Example:

O=\begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}

Is the 2\times 3 zero matrix

Identity matrix

A square matrix where all of the elements along the main diagonal are 1 and all remaining elements are 0.

An identity matrix is indicated by I.

Example:

I=\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

Is the 3\times 3 identity matrix

The following are some key properties of these matrices under matrix addition and multiplication:

Additive identity property

Adding a zero matrix to any matrix A is equal to the matrix A. Where the order of A and O are equal.

A+O=O+A=A

Multiplicative identity property

The product of a square matrix A and the identity matrix I of the same order is matrix A.

A\cdot I=I\cdot A = A

Additive inverse property

Adding any matrix A to its opposite (-A) will result in the zero matrix.

A+\left(-A\right)=\left(-A\right)+ A = O

Multiplication property of zero

Multiplying any matrix A by either the scalar zero or an appropriately sized zero matrix will result in a zero matrix.

0\cdot A=A \cdot 0 = O or O \cdot A=A \cdot O = O

Worked examples

Example 1

The tables below show the number of small, medium, and large pizzas sold at David's two stores on Monday and Tuesday:

Monday:

SmallMediumLarge
Store 1283632
Store 2252724

Tuesday:

SmallMediumLarge
Store 1253328
Store 2262023
a

Find the total number of sales of small, medium, and large pizzas for each store over Monday and Tuesday. Express your answer as a 2 \times 3 matrix.

Approach

The matrix for the sales of small, medium, and large pizzas on Monday is: \begin{bmatrix} 28 & 36 & 32 \\ 25 & 27 & 24 \end{bmatrix}.

The matrix for the sales of small, medium, and large pizzas on Tuesday is: \begin{bmatrix} 25 & 33 & 28 \\ 26 & 20 & 23 \end{bmatrix}.

To find the total number of sales across Monday and Tuesday, we can add the matrices for Monday and Tuesday's sales together.

If A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{bmatrix},\, B = \begin{bmatrix} b_{11} & b_{12} & b_{13} \\ b_{21} & b_{22} & b_{23} \end{bmatrix}then A+B = \begin{bmatrix} a_{11}+b_{11} & a_{12}+b_{12} & a_{13}+b_{13} \\ b_{21}+b_{21} & a_{22}+b_{22} & a_{23}+b_{23} \end{bmatrix}

Solution

The matrix for the total number of sales for each size of pizza at each store is: \begin{bmatrix} 28 & 36 & 32 \\ 25 & 27 & 24 \end{bmatrix}+\begin{bmatrix} 25 & 33 & 28 \\ 26 & 20 & 23 \end{bmatrix}=\begin{bmatrix} 53 & 69 & 60 \\ 51 & 47 & 47 \end{bmatrix}

Reflection

Notice that the position of the data has not changed in the resulting matrix.

  • Row 1 still corresponds to Store 1.

  • Row 2 still corresponds to Store 2.

  • Column 1 still corresponds to small pizzas.

  • Column 2 still corresponds to medium pizzas.

  • Column 3 still corresponds to large pizzas.

b

Identify the number of large pizzas that were sold at Store 2 over Monday and Tuesday.

Approach

In the previous part, we found the matrix whose entries represent the number of pizzas sold over Monday and Tuesday for each store and size.

'Store 2' corresponds to the second row of the matrix, and 'Large pizzas' correspond to the third column of the matrix. So we can find the answer at a_{23} in the matrix from part (c).

Solution

The matrix that shows the total sales over Monday and Tuesday is: \begin{bmatrix} 53 & 69 & 60 \\ 51 & 47 & 47 \end{bmatrix}.

For this matrix, a_{23}=47.

Therefore, 47 large pizzas were sold at Store 2 over Monday and Tuesday.

Example 2

Consider the following matrices:

A = \begin{bmatrix} 7 & 0 & -2 \\ -4 & 9 & -5 \end{bmatrix},\, B=\begin{bmatrix} 8 & -4 & 2 \\ -7 & 4 & 5 \end{bmatrix},\, C=\begin{bmatrix} 9 & 5 \\ -3 & 2 \\ 6 & -1 \end{bmatrix}\text{ and } D = \begin{bmatrix} 4 & -1 & 3 \\ 2 & 0 & 1 \\ 1 & 2 & -3\end{bmatrix}

a

Find 3A.

Approach

To find the scalar product 3A we multiply each element of matrix A by 3.

Solution

\displaystyle A\displaystyle =\displaystyle \begin{bmatrix} 7 & 0 & -2 \\ -4 & 9 & -5 \end{bmatrix}Given
\displaystyle 3A\displaystyle =\displaystyle 3\begin{bmatrix} 7 & 0 & -2 \\ -4 & 9 & -5 \end{bmatrix}
\displaystyle \text{}\displaystyle =\displaystyle \begin{bmatrix} 3(7) & 3(0) & 3(-2) \\ 3(-4) & 3(9) & 3(-5) \end{bmatrix}Multiply each element in matrix A by 3
\displaystyle \text{}\displaystyle =\displaystyle \begin{bmatrix} 21 & 0 & -6 \\ -12 & 27 & -15 \end{bmatrix}Simplify the products
b

Find AB.

Approach

The product AB is defined only if the number of columns in the matrix A is equal to the number of rows in the matrix B.

Solution

The number of columns in A=\begin{bmatrix} 7 & 0 & -2 \\ -4 & 9 & -5 \end{bmatrix} is 3.

The number of rows in B=\begin{bmatrix} 8 & -4 & 2 \\ -7 & 4 & 5\end{bmatrix} is 2.

Since 2 \neq 3, the product AB is undefined.

c

Find AC.

Approach

The product AC is defined only if the number of columns in the matrix A is equal to the number of rows in the matrix C.

If A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{bmatrix} and C=\begin{bmatrix} c_{11} & c_{12} \\ c_{21} & c_{22} \\ c_{31} & c_{32} \end{bmatrix}, then AC = \begin{bmatrix} a_{11}c_{11}+a_{12}c_{21}+a_{13}c_{31} & a_{11}c_{12}+a_{12}c_{22}+a_{13}c_{32} \\ a_{21}c_{11}+a_{22}c_{21}+a_{23}c_{31} & a_{21}c_{12}+a_{22}c_{22}+a_{23}c_{32} \end{bmatrix}

Solution

The number of columns in A = \begin{bmatrix} 7 & 0 & -2 \\ -4 & 9 & -5 \end{bmatrix} is 4. The number of rows in C=\begin{bmatrix} 9 & 5 \\ -3 & 2 \\ 6 & -1 \end{bmatrix} is 4. Since they are equal, the product AC is defined.

\displaystyle AC\displaystyle =\displaystyle \begin{bmatrix} 7 & 0 & -2 \\ -4 & 9 & -5 \end{bmatrix}\begin{bmatrix} 9 & 5 \\ -3 & 2 \\ 6 & -1 \end{bmatrix}
\displaystyle =\displaystyle \begin{bmatrix} (7)(9)+(0)(-3)+(-2)(6)& ac_{12} \\ ac_{21} & ac_{22} \end{bmatrix}Multiply the first row of A by the first column of C. ac_{ij} is the element in AC in row i column j
\displaystyle =\displaystyle \begin{bmatrix} 51 & ac_{12} \\ ac_{21} & ac_{22} \end{bmatrix}Evaluate ac_{11}
\displaystyle =\displaystyle \begin{bmatrix} 51 & (7)(5)+(0)(2)+(-2)(-1) \\ ac_{21} & ac_{22} \end{bmatrix}Multiply the first row of A by the second column of C.
\displaystyle =\displaystyle \begin{bmatrix} 51 & 37 \\ ac_{21} & ac_{22} \end{bmatrix}Evaluate ac_{12}
\displaystyle =\displaystyle \begin{bmatrix} 51 & 37 \\ (-4)(9)+(9)(-3)+(-5)(6) & ac_{22} \end{bmatrix}Multiply the second row of A by the first column of C.
\displaystyle =\displaystyle \begin{bmatrix} 51 & 37 \\ -93 & ac_{22} \end{bmatrix}Evaluate ac_{21}
\displaystyle =\displaystyle \begin{bmatrix} 51 & 37 \\ -93 & (-4)(5)+(9)(2)+(-5)(-1) \end{bmatrix}Multiply the second row of A by the second column of C.
\displaystyle =\displaystyle \begin{bmatrix} 51 & 37 \\ -93 & 3 \end{bmatrix}Evaluate ac_{22}
d

Use technology to find DC.

Approach

Open the graphing calculator and enter each matrix as its own input:

Then input DC to evaluate the product.

Solution

DC=\begin{bmatrix} 57 & 15 \\ 24 & 9 \\ -15 & 12 \end{bmatrix}

Reflection

The product of CD can not be evaluated because the dimensions do not match. If you try inputting CD in the calculator you should receive an error.

Example 3

Consider the following matrices:

I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix},\, O=\begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} \text{ and }A=\begin{bmatrix} 2 & -4 \\ 7 & 3 \end{bmatrix}

a

Show that A-A=O.

Approach

To find the difference of two matrices we subtract corresponding elements.

Solution

\displaystyle A-A\displaystyle =\displaystyle \begin{bmatrix} 2 & -4 \\ 7 & 3 \end{bmatrix}-\begin{bmatrix} 2 & -4 \\ 7 & 3 \end{bmatrix}
\displaystyle \text{}\displaystyle =\displaystyle \begin{bmatrix} 2-(2) & -4-(-4) \\ 7-(7) & 3-(3) \end{bmatrix}Subtract corresponding entries
\displaystyle \text{}\displaystyle =\displaystyle \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}Evaluate each subtraction
\displaystyle \text{}\displaystyle =\displaystyle O

So we have A-A=O.

b

Show that IA=A.

Approach

The product IA is found by calculating the product of each row of matrix I with each column of matrix A.

If I = \begin{bmatrix} i_{11} & i_{12} \\ i_{21} & i_{22} \end{bmatrix} and A=\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}, then IA = \begin{bmatrix} i_{11}a_{11}+i_{12}a_{21} & i_{11}a_{12}+i_{12}a_{22} \\ i_{21}a_{11}+i_{22}a_{21} & i_{21}a_{12}+i_{22}a_{22} \end{bmatrix}

Solution

\displaystyle IA\displaystyle =\displaystyle \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 2 & -4 \\ 7 & 3 \end{bmatrix}
\displaystyle =\displaystyle \begin{bmatrix} (1)(2)+(0)(7)& (1)(-4)+(0)(3) \\ (0)(2)+(1)(7) & (0)(-4)+(1)(3) \end{bmatrix}Use the process for matrix multiplication
\displaystyle =\displaystyle \begin{bmatrix} 2+0 & -4+0 \\ 0+7 & 0+3 \end{bmatrix}Evaluate the products
\displaystyle =\displaystyle \begin{bmatrix} 2 & -4 \\ 7 & 3 \end{bmatrix}Evaluate the sums
\displaystyle =\displaystyle A

So we have IA=A.

Reflection

To be the identity matrix it should also be true that AI=A. Check if this also holds for the given matrices.

Consider the similarities between the multiplicative identity property for matrices and the multiplicative identity property for real numbers:

  • For real numbers: The product of 1 and any number a is a.1\cdot a=a\cdot 1=a

  • For matrices: The product of a square matrix A and the identity matrix I of the same order is matrix A. I\cdot A=A\cdot I=A

Outcomes

M1.N.M.A.2

Perform operations on matrices in a real-world context.*

M1.N.M.A.2.A

Multiply a matrix by a scalar to produce a new matrix.

M1.N.M.A.2.B

Add and/or subtract matrices by hand and using technology.

M1.N.M.A.2.C

Multiply matrices of appropriate dimensions, by hand in simple cases and using technology for more complicated cases.

M1.N.M.A.2.D

Describe the roles that zero matrices and identity matrices play in matrix addition and multiplication, recognizing that they are similar to the roles of 0 and 1 in the real number system.

M1.MP1

Make sense of problems and persevere in solving them.

M1.MP6

Attend to precision.

M1.MP7

Look for and make use of structure.

What is Mathspace

About Mathspace