Precalculus by Richard Wright

Previous Lesson Table of Contents Next Lesson

Are you not my student and
has this helped you?

This book is available
to download as an epub.


You make known to me the path of life; you will fill me with joy in your presence, with eternal pleasures at your right hand. Psalms 16:11 NIV

9-03 Matrix Operations

Mr. Wright teaches the lesson.

Summary: In this section, you will:

SDA NAD Content Standards (2018): PC.6.4

Enlargement
Photo enlargement. (Wikimedia/Eric Ward)

A digital picture can be described as a matrix of colored pixels. Each element is the position and color of the pixel. If you wanted to enlarge the picture so it would be 4 times bigger, you could multiply the position elements of the photo matrix by 4. Many things in computer programming and graphics are simplified by using matrix operations. The difference is that computer programming names them arrays instead of matrices.

Matrix Addition and Subtraction

To add or subtract matrices, add or subtract the corresponding elements. Because each element is combined with its corresponding element, the matrices have to be the same size.

Matrix Addition and Subtraction

In order to add or subtract matrices, they must be the same size.

Add or subtract matrices by adding or subtracting all the corresponding elements.

Adding Two Matrices

\(\left[\begin{matrix} 1 & 3 \\ -2 & 4 \end{matrix}\right] + \left[\begin{matrix} -3 & 0 \\ -1 & 2 \end{matrix}\right]\)

Solution

The matrices are the same size, so we can add them. Add the corresponding elements as indicated by the color.

$$ \left[\begin{matrix} \color{blue}{1} & \color{red}{3} \\ \color{green}{-2} & \color{purple}{4} \end{matrix}\right] + \left[\begin{matrix} \color{blue}{-3} & \color{red}{0} \\ \color{green}{-1} & \color{purple}{2} \end{matrix}\right] $$

$$ \left[\begin{matrix} \color{blue}{1 + (-3)} & \color{red}{3 + 0} \\ \color{green}{-2 + (-1)} & \color{purple}{4 + 2} \end{matrix}\right] $$

$$ \left[\begin{matrix} \color{blue}{-2} & \color{red}{3} \\ \color{green}{-3} & \color{purple}{6} \end{matrix}\right] $$

Subtracting Two Matrices

\(\left[\begin{matrix} 1 & 3 \\ -2 & 4 \end{matrix}\right] - \left[\begin{matrix} -3 & 0 \\ -1 & 2 \end{matrix}\right]\)

Solution

The matrices are the same size, so we can subtract them. Subtract the corresponding elements as indicated by the color.

$$ \left[\begin{matrix} \color{blue}{1} & \color{red}{3} \\ \color{green}{-2} & \color{purple}{4} \end{matrix}\right] - \left[\begin{matrix} \color{blue}{-3} & \color{red}{0} \\ \color{green}{-1} & \color{purple}{2} \end{matrix}\right] $$

$$ \left[\begin{matrix} \color{blue}{1 - (-3)} & \color{red}{3 - 0} \\ \color{green}{-2 - (-1)} & \color{purple}{4 - 2} \end{matrix}\right] $$

$$ \left[\begin{matrix} \color{blue}{4} & \color{red}{3} \\ \color{green}{-1} & \color{purple}{2} \end{matrix}\right] $$

Add or subtract.

\(\left[\begin{matrix} 2 & -7 & 1 \\ 0 & 3 & -5 \end{matrix}\right] + \left[\begin{matrix} 0 & -9 & 3 \\ -1 & 8 & 4 \end{matrix}\right]\)

Answer

\(\left[\begin{matrix} 2 & -16 & 4 \\ -1 & 11 & -1 \end{matrix}\right]\)

Scalar Multiplication

A scalar is a single number as opposed to a matrix. To multiply a scalar with a matrix, multiply each element by the scalar. This is similar to distributing.

Multiply a Scalar and a Matrix

Multiply each element in the matrix by the scalar.

This is similar to distribution.

Multiply a Scalar with a Matrix

\(3 \left[\begin{matrix} 3 & -2 & 1 \\ -4 & 5 & -1 \end{matrix}\right]\)

Solution

Multiply the scalar, 3, with each of the elements in the matrix

$$ 3 \left[\begin{matrix} 3 & -2 & 1 \\ -4 & 5 & -1 \end{matrix}\right] $$

$$ \left[\begin{matrix} 3(3) & 3(-2) & 3(1) \\ 3(-4) & 3(5) & 3(-1) \end{matrix}\right] $$

$$ \left[\begin{matrix} 9 & -6 & 3 \\ -12 & 15 & -3 \end{matrix}\right] $$

Combined Operations

\(2 \left[\begin{matrix} 1 & 3 \\ -2 & 4 \end{matrix}\right] - 3 \left[\begin{matrix} 0 & -1 \\ 2 & 5 \end{matrix}\right]\)

Solution

Follow the order of operations. Multiplication comes before subtraction.

$$ 2 \left[\begin{matrix} 1 & 3 \\ -2 & 4 \end{matrix}\right] - 3 \left[\begin{matrix} 0 & -1 \\ 2 & 5 \end{matrix}\right] $$

$$ \left[\begin{matrix} 2 & 6 \\ -4 & 8 \end{matrix}\right] - \left[\begin{matrix} 0 & -3 \\ 6 & 15 \end{matrix}\right] $$

Now that the multiplication is done, subtract the matrices.

$$ \left[\begin{matrix} 2-0 & 6-(-3) \\ -4-6 & 8-15 \end{matrix}\right] $$

$$ \left[\begin{matrix} 2 & 9 \\ -10 & -7 \end{matrix}\right] $$

\(\left[\begin{matrix} 2 \\ -4 \end{matrix}\right] + 4 \left[\begin{matrix} -1 \\ 3 \end{matrix}\right]\)

Answer

\(\left[\begin{matrix} -2 \\ 8 \end{matrix}\right]\)

Matrix Multiplication

In order to multiply 2 matrices, the number of columns in the first matrix must equal the number of rows in the second matrix. If the orders of the two matrices are written in order, then the two middle numbers must be the same. The two outer numbers give the order of the product.

(3 × 2) · (2 × 4)

Notice the middle numbers, the blue 2's, are the same. The product will be the outside red numbers, 2 × 4. Because of this, order is important in matrix multiplication. It is NOT commutative! A 2 × 3 can be multiplied with a 3 × 1. It is not possible if the order is switched. A 3 × 1 cannot be multiplied by a 2 × 3.

Matrix Multiplication

Two matrices can be multiplied if and only if the number of columns in the first matrix is equal to the number of rows in the second matrix.

Matrix multiplication is not commutative.


To multiply two matrices,

  1. Verify that the number of columns in the first matrix equals the number of rows in the second matrix.
  2. Choose a row in the first matrix and a column in the second matrix.
  3. Multiply the first entries in that row and column.
  4. Put a plus sign and multiply the second entries in that row and column.
  5. Continue adding plus signs and the products of the entries in that row and column until the end of the row and column is reached.
  6. Repeat steps 2-5 for all combinations of rows and columns. The results go in the answer matrix in the same location as the chosen row and column. For example, multiplying the 2nd row and 1st column gives a result for the element in the 2nd row 1st column of the answer matrix.
  7. Simplify each element of the answer.

Matrix Multiplication

\(\left[\begin{matrix} 1 & 3 & -2 \\ 2 & 0 & -1 \end{matrix}\right] \left[\begin{matrix} 4 \\ 0 \\ -3 \end{matrix}\right]\)

Solution

First check to see if the matrices can be multiplied. Are the number of columns in the first matrix equal to the number of rows in the second matrix? Write the orders of the matrices and check to see if the middle numbers are the same.

(2 × 3) · (3 × 1)

The middle numbers are the same, so it is possible to multiply the matrices. The product will be a 2 × 1 matrix, the first and last number from above.

Pick a row in the first matrix and a column in the second matrix such as 1st row, 1st column. Multiply the left and top element, plus, multiply the next element in the row and column, plus, multiply the next element in the row and column, plus, and continue until reaching the end of the row and column. The result goes in the 1st row, 1st column of the product matrix.

$$ \left[\begin{matrix} \color{blue}{1} & \color{blue}{3} & \color{blue}{-2} \\ 2 & 0 & -1 \end{matrix}\right] \left[\begin{matrix} \color{blue}{4} \\ \color{blue}{0} \\ \color{blue}{-3} \end{matrix}\right] $$

$$ \left[\begin{matrix} \color{blue}{1} & \rightarrow & \color{purple}{3} & \rightarrow & \color{red}{-2} \\ 2 & \quad & 0 & \quad & -1 \end{matrix}\right] \left[\begin{matrix} \color{blue}{4} \\ \downarrow \\ \color{purple}{0} \\ \downarrow \\ \color{red}{-3} \end{matrix}\right] = \left[\begin{matrix} \color{blue}{1(4)} + \color{purple}{3(0)} + \color{red}{-2(-3)} \\ \quad \end{matrix}\right] $$

Pick another row in the first matrix and a column in the second matrix. The only other combination in this problem is 2nd row, 1st column. The result will go in the 2nd row, 1st column of the product.

$$ \left[\begin{matrix} 1 & \quad & 3 & \quad & -2 \\ \color{blue}{2} & \rightarrow & \color{purple}{0} & \rightarrow & \color{red}{-1} \end{matrix}\right] \left[\begin{matrix} \color{blue}{4} \\ \downarrow \\ \color{purple}{0} \\ \downarrow \\ \color{red}{-3} \end{matrix}\right] = \left[\begin{matrix} 1(4) + 3(0) + -2(-3) \\ \color{blue}{2(4)} + \color{purple}{0(0)} + \color{red}{-1(-3)} \end{matrix}\right] $$

Simplify the result.

$$ = \left[\begin{matrix} 10 \\ 11 \end{matrix}\right] $$

Matrix Multiplication

\(\left[\begin{matrix} 1 & -1 \\ 0 & 2 \end{matrix}\right] \left[\begin{matrix} 5 & 1 & 3 \\ -3 & -2 & 0 \end{matrix}\right]\)

Solution

First check to see if the matrices can be multiplied. Are the number of columns in the first matrix equal to the number of rows in the second matrix. Write the orders of the matrices and check to see if the middle numbers are the same.

(2 × 2) · (2 × 3)

The middle numbers are the same, so it is possible to multiply the matrices. The product will be a 2 × 3 matrix, the first and last number from above.

Pick a row in the first matrix and a column in the second matrix such as 1st row, 1st column. Multiply the left and top element, plus, multiply the next element in the row and column, plus, multiply the next element in the row and column, plus, and continue until reaching the end of the row and column. The result goes in the 1st row, 1st column of the product matrix.

$$ \left[\begin{matrix} \color{blue}{1} & \color{blue}{-1} \\ 0 & 2 \end{matrix}\right] \left[\begin{matrix} \color{blue}{5} & 1 & 3 \\ \color{blue}{-3} & -2 & 0 \end{matrix}\right] $$

$$ \left[\begin{matrix} \color{blue}{1} & \rightarrow & \color{purple}{-1} \\ 0 & \quad & 2 \end{matrix}\right] \left[\begin{matrix} \color{blue}{5} & 1 & 3 \\ \downarrow & \quad & \quad \\ \color{purple}{-3} & -2 & 0 \end{matrix}\right] = \left[\begin{matrix} \color{blue}{1(5)} + \color{purple}{-1(-3)} & \quad & \quad \\ \quad & \quad & \quad \end{matrix}\right] $$

Pick another row in the first matrix and a column in the second matrix. perhaps the 1st row, 2nd column. The result will go in the 1st row, 2nd column of the product.

$$ \left[\begin{matrix} \color{blue}{1} & \rightarrow & \color{purple}{-1} \\ 0 & \quad & 2 \end{matrix}\right] \left[\begin{matrix} 5 & \color{blue}{1} & 3 \\ \quad & \downarrow & \quad \\ -3 & \color{purple}{-2} & 0 \end{matrix}\right] = \left[\begin{matrix} 1(5) + -1(-3) & \color{blue}{1(1)} + \color{purple}{-1(-2)} & \quad \\ \quad & \quad & \quad \end{matrix}\right] $$

Pick another row in the first matrix and a column in the second matrix. perhaps the 1st row, 3rd column. The result will go in the 1st row, 3rd column of the product.

$$ \left[\begin{matrix} \color{blue}{1} & \rightarrow & \color{purple}{-1} \\ 0 & \quad & 2 \end{matrix}\right] \left[\begin{matrix} 5 & 1 & \color{blue}{3} \\ \quad & \quad & \downarrow \\ -3 & -2 & \color{purple}{0} \end{matrix}\right] = \left[\begin{matrix} 1(5) + -1(-3) & 1(1) + -1(-2) & \color{blue}{1(3)} + \color{purple}{-1(0)} \\ \quad & \quad & \quad \end{matrix}\right] $$

Pick another row in the first matrix and a column in the second matrix. perhaps the 2nd row, 1st column. The result will go in the 2nd row, 1st column of the product.

$$ \left[\begin{matrix} 1 & \quad & -1 \\ \color{blue}{0} & \rightarrow & \color{purple}{2} \end{matrix}\right] \left[\begin{matrix} \color{blue}{5} & 1 & 3 \\ \downarrow & \quad & \quad \\ \color{purple}{-3} & -2 & 0 \end{matrix}\right] = \left[\begin{matrix} 1(5) + -1(-3) & 1(1) + -1(-2) & 1(3) + -1(0) \\ \color{blue}{0(5)} + \color{purple}{2(-3)} & \quad & \quad \end{matrix}\right] $$

Pick another row in the first matrix and a column in the second matrix. perhaps the 2nd row, 2nd column. The result will go in the 2nd row, 2nd column of the product.

$$ \left[\begin{matrix} 1 & \quad & -1 \\ \color{blue}{0} & \rightarrow & \color{purple}{2} \end{matrix}\right] \left[\begin{matrix} 5 & \color{blue}{1} & 3 \\ \quad & \downarrow & \quad \\ -3 & \color{purple}{-2} & 0 \end{matrix}\right] = \left[\begin{matrix} 1(5) + -1(-3) & 1(1) + -1(-2) & 1(3) + -1(0) \\ 0(5) + 2(-3) & \color{blue}{0(1)} + \color{purple}{2(-2)} & \quad \end{matrix}\right] $$

Pick another row in the first matrix and a column in the second matrix. perhaps the 2nd row, 3rd column. The result will go in the 2nd row, 3rd column of the product.

$$ \left[\begin{matrix} 1 & \quad & -1 \\ \color{blue}{0} & \rightarrow & \color{purple}{2} \end{matrix}\right] \left[\begin{matrix} 5 & 1 & \color{blue}{3} \\ \quad & \quad & \downarrow \\ -3 & -2 & \color{purple}{0} \end{matrix}\right] = \left[\begin{matrix} 1(5) + -1(-3) & 1(1) + -1(-2) & 1(3) + -1(0) \\ 0(5) + 2(-3) & 0(1) + 2(-2) & \color{blue}{0(3)} + \color{purple}{2(0)} \end{matrix}\right] $$

There are no more combinations of rows and columns, so now simplify the result.

$$ = \left[\begin{matrix} 8 & 3 & 3 \\ -6 & -4 & 0 \end{matrix}\right] $$

Multiply.

\(\left[\begin{matrix} 2 & 5 \end{matrix}\right] \left[\begin{matrix} 1 & -3 \\ 0 & -2 \end{matrix}\right]\)

Answer

[2 −16]

Lesson Summary

Matrix Addition and Subtraction

In order to add or subtract matrices, they must be the same size.

Add or subtract matrices by adding or subtracting all the corresponding elements.


Multiply a Scalar and a Matrix

Multiply each element in the matrix by the scalar.

This is similar to distribution.


Matrix Multiplication

Two matrices can be multiplied if and only if the number of columns in the first matrix is equal to the number of rows in the second matrix.

Matrix multiplication is not commutative.


To multiply two matrices,

  1. Verify that the number of columns in the first matrix equals the number of rows in the second matrix.
  2. Choose a row in the first matrix and a column in the second matrix.
  3. Multiply the first entries in that row and column.
  4. Put a plus sign and multiply the second entries in that row and column.
  5. Continue adding plus signs and the products of the entries in that row and column until the end of the row and column is reached.
  6. Repeat steps 2-5 for all combinations of rows and columns. The results go in the answer matrix in the same location as the chosen row and column. For example, multiplying the 2nd row and 1st column gives a result for the element in the 2nd row 1st column of the answer matrix.
  7. Simplify each element of the answer.

Helpful videos about this lesson.

Practice Exercises

  1. Describe a scalar and give an example.
  2. Add or subtract the matrices.
  3. \(\left[\begin{matrix} 1 & 9 \\ -3 & -2 \end{matrix}\right] + \left[\begin{matrix} 0 & -4 \\ -1 & -7 \end{matrix}\right]\)
  4. \(\left[\begin{matrix} -4 & 2 & 4 \\ 1 & -2 & -7 \end{matrix}\right] + \left[\begin{matrix} 8 & 2 \\ 4 & 5 \end{matrix}\right]\)
  5. \(\left[\begin{matrix} -2 & -3 \\ 1 & -2 \\ 4 & 7 \end{matrix}\right] - \left[\begin{matrix} 2 & 1 \\ 0 & 4 \\ -5 & 6 \end{matrix}\right]\)
  6. Perform the indicated operations.
  7. \(\left[\begin{matrix} 2 & -1 \end{matrix}\right] + 2 \left[\begin{matrix} -5 & 5 \end{matrix}\right]\)
  8. \(-1 \left[\begin{matrix} -3 & 2 & 6 \\ 1 & 4 & -7 \end{matrix}\right] + 3 \left[\begin{matrix} -1 & 2 & -5 \\ 4 & -3 & 0 \end{matrix}\right]\)
  9. \(2 \left[\begin{matrix} 3 \\ 2 \\ 0 \end{matrix}\right] - 3 \left[\begin{matrix} 0 \\ -3 \\ 1 \end{matrix}\right] + \left[\begin{matrix} 4 \\ -2 \\ -1 \end{matrix}\right]\)
  10. Multiply the matrices.
  11. \(\left[\begin{matrix} 2 & 1 \end{matrix}\right] \left[\begin{matrix} 0 & -2 \\ -1 & 3 \end{matrix}\right]\)
  12. \(\left[\begin{matrix} 3 & -2 \end{matrix}\right] \left[\begin{matrix} 7 & 9 \end{matrix}\right]\)
  13. \(\left[\begin{matrix} -1 & 0 \\ 2 & -2 \end{matrix}\right] \left[\begin{matrix} 4 & 3 \\ -2 & 0 \end{matrix}\right]\)
  14. \(\left[\begin{matrix} 5 & 1 \\ -2 & -4 \\ 0 & 3 \end{matrix}\right] \left[\begin{matrix} -1 \\ 6 \end{matrix}\right]\)
  15. \(\left[\begin{matrix} 1 & 1 & 0 \\ -2 & 1 & 5 \end{matrix}\right] \left[\begin{matrix} 2 & 1 \\ 0 & 4 \\ -1 & 0 \end{matrix}\right]\)
  16. Use the matrices \(A = \left[\begin{matrix} 2 & -1 \\ 0 & -2 \end{matrix}\right]\) and \(B = \left[\begin{matrix} 1 & 3 \\ 2 & 0 \end{matrix}\right]\) to verify that matrix multiplication has no commutative property by comparing the products AB and BA.
  17. Problem Solving
  18. The corners of a figure are at the coordinates A(0, 0), B(3, 1), C(4, 5), and D(1, 5). These can be written as the matrix \(\begin{matrix} \begin{matrix} A & B & C & D \end{matrix} \\ \left[\begin{matrix} 0 & 3 & 4 & 1 \\ 0 & 1 & 5 & 5 \end{matrix}\right] \end{matrix}\) where each column is a point. Jane wants to enlarge the figure by a factor of 5. Use scalar multiplication to find the coordinates of the enlargement.
  19. A student is buying supplies for two different classes at school. Math class requires 20 pencils, 2 paper packs, and 1 textbook. English class requires 15 pencils, 2 paper packs, and 5 textbooks. Pencils are 25¢ each, paper packs are $2 each, and textbooks are $20 each. Write the supply requirements as a matrix and the costs as another matrix. Show how to use matrix multiplication to find the total cost for each class.
  20. Mixed Review
  21. (9-02) Use Gauss-Jordan Elimination to solve \(\left\{\begin{align} x + 3y - 2z &= -8 \\ y + 5z &= 16 \\ -x + z &= 8 \end{align}\right.\)
  22. (8-02) Use elimination to solve \(\left\{\begin{align} 10x + 5y &= 6 \\ 30x + 20y &= 17 \end{align}\right.\)
  23. (6-05) Find the dot product \((2\hat{i} - 3\hat{j}) · (4\hat{i} + \hat{j})\)
  24. (5-04) Solve 1 = 2 sin (2θ) on the interval 0 ≤ θ < 2π.
  25. (5-03) Verify the trigonometric identity \(\sin θ = \frac{\sin 2θ}{2 \cos θ}\)

Answers

  1. A single number, not a matrix or vector, such as 3.
  2. \(\left[\begin{matrix} 1 & 5 \\ -4 & -9 \end{matrix}\right]\)
  3. Not possible
  4. \(\left[\begin{matrix} -4 & -4 \\ 1 & -6 \\ 9 & 1 \end{matrix}\right]\)
  5. \(\left[\begin{matrix} -8 & 9 \end{matrix}\right]\)
  6. \(\left[\begin{matrix} 0 & 4 & -21 \\ 11 & -13 & 7 \end{matrix}\right]\)
  7. \(\left[\begin{matrix} 10 \\ 11 \\ -4 \end{matrix}\right]\)
  8. \(\left[\begin{matrix} -1 & -1 \end{matrix}\right]\)
  9. Not possible
  10. \(\left[\begin{matrix} -4 & -3 \\ 12 & 6 \end{matrix}\right]\)
  11. \(\left[\begin{matrix} 1 \\ -22 \\ 18 \end{matrix}\right]\)
  12. \(\left[\begin{matrix} 2 & 5 \\ -9 & 2 \end{matrix}\right]\)
  13. \(AB = \left[\begin{matrix} 0 & 6 \\ -4 & 0 \end{matrix}\right]\), \(BA = \left[\begin{matrix} 2 & -7 \\ 4 & -2 \end{matrix}\right]\)
  14. A′ = (0, 0), B′ = (15, 5), C′ = (20, 25), D′ = (5, 25)
  15. \(\begin{matrix} \begin{matrix} \quad \end{matrix} & \begin{matrix} Pencil & Paper & Book \end{matrix} \\ \begin{matrix} Math \\ Eng \end{matrix} & \left[\begin{matrix} 20 & 2 & 1 \\ 15 & 2 & 5 \end{matrix}\right] \end{matrix} \begin{matrix} \begin{matrix} Pencil \\ Paper \\ Book \end{matrix} \left[\begin{matrix} $0.25 \\ $2 \\ $20 \end{matrix}\right] \end{matrix} = \left[\begin{matrix} $29 \\ $107.75 \end{matrix}\right]\)
  16. (−5, 1, 3)
  17. \(\left(\frac{7}{10}, -\frac{1}{5}\right)\)
  18. 5
  19. \(\frac{π}{12}, \frac{5π}{12}, \frac{13π}{12}, \frac{17π}{12}\)
  20. Show work