You are on page 1of 12

Faculty of Mathematics Centre for Education in

Waterloo, Ontario N2L 3G1 Mathematics and Computing

Grade 7/8 Math Circles


November 1 & 2, 2016
The Matrix

1 0
0 1
0
0
1

0
1 0 0
1

1
1 1 1

0 1 0

1 1
0

Introduction to Matrices
A matrix is a rectangular arrangement of numbers. We can talk about one matrix or several
matrices. Matrices are often used to represent information without labels. For example,
suppose you and a friend each have a box of Smarties and you each want to count all your
red and blue Smarties. This information is represented in the table below.

Red Blue " #


5 4
You 5 4 =⇒
3 6
Friend 3 6

1
Example Suppose Farm A has 8 pigs and 14 cows and Farm B has 13 pigs and 9 cows.
Represent this information in a matrix.

Now we know how to translate information from a table to a matrix. Let’s talk about the
dimensions of a matrix. So far, we have only seen 2 × 2 matrices.
In general, an m × n matrix has m rows and n columns. Matrix A, in the example below, is
a 2 × 3 matrix since there are two rows and three columns.
" #)
4 1 6
A= 2 rows
2 5 3
| {z }
3 columns
If a matrix has m rows and m columns, it is an m × m matrix or a square matrix. The
matrix below is an example of a 2 × 2 matrix which is a square matrix.
" #
1 2
3 4

Example What are the dimensions of the following matrices?


" #  
3 1 4 7 4 5
(a)
2 8 6 (b) 4 2 3
 

7 2 1

The numbers inside a matrix are called elements. To generalize, we can label each element
using variables in our matrices. For example,

2×2 3×2 2×3 3×3 3×1


     
" # a b " # a b c a
a b 
c d
 a b c 
d e f 
  
b
c d   d e f    
e f g h i c

2
Life With Matrices
How exactly are matrices used in the world? Matrices have many real-life applications. Here
are a few examples:

• Cryptography - Matrices can be used to encrypt and decrypt secret messages. The
sender encrypts the message using an encoding matrix and the receiver decrypts it
using a decoding matrix.

encoding matrix message encrypted message

decoding matrix encrypted message message

• Economics - Businesses use matrices to study stock market trends to earn a larger
profit and to lower their losses
Revenue Costs P rof it
" # " # " #
125 55 240 50 75 60 75 −20 80
N ovember − =
125 80 200 40 70 60 85 10 140

• Google - Ever wonder how Google always knows what you search for? Or wonder how
they determine what sites to direct you to? Google uses a page ranking method that
uses matrices!

3
Matrix Operations
Matrix operations are quite interesting. They do not follow the same rules as numbers do
and have their own ways of performing our usual operations.

Matrix Addition
Matrix addition is fairly straightforward. To perform matrix addition, we add together
elements that are in the same position in each matrix. Suppose we want to add the two 2 × 2
matrices:

" # " # " #


a b e f a+e b+f
+ =
c d g h c+g d+h
Note that when adding matrices together, all matrices must have the same dimensions! We
were able to add the matrices above together because both matrices are 2 × 2.

Example 1 Add the following matrices:


" # " #
11 3 5 2 2 9
+ =
−1 8 4 5 3 1

Example 2 Go Raptors! You’re watching a Toronto Raptors basketball game.


• In the first quarter, Kyle Lowry scored 11 points with 1 block and 2 assists. DeMar
DeRozan scored 13 points with 0 blocks and 1 assist. Jonas Valanciunas scored 9 points
with 3 blocks and 0 assists

• In the second quarter, Lowry scored 15 points with 0 blocks and 3 assists. DeRozan
scored 11 points with 0 blocks and 2 assists. JV scored 14 points with 2 blocks and 1
assist.
How many points, blocks, and assists does each player have by halftime?

4
Matrix Subtraction
Matrix subtraction works the same way as addition! To perform matrix subtraction, we
subtract elements that are in the same position in each matrix.

" # " # " #


a b e f a−e b−f
− =
c d g h c−g d−h
Similar to matrix addition, matrices need to have the same dimensions in order to perform
matrix subtraction.

Example 1 Subtract the following matrices:


" # " #
11 8 7 2 4 9
− =
5 24 3 0 15 1

Example 2 Bart and Lisa get a weekly allowance of $5 and they are competing to see who
can save the most money until Wednesday.

• On Monday, Bart and Lisa do not spend anything

• On Tuesday, Bart buys a snack at the vending machine for $1.25

• On Wednesday, Bart loses $0.25 in a bet with his friends and Lisa spend $1.70 on
bubble gum

On Wednesday, who saved the most amount of money? Bart or Lisa?

5
Scalar Multiplication
A scalar is a any number outside of the matrix. To perform scalar multiplication, we
multiply each element by the same number. Suppose we want to calculate the following:

" # " #
a b ka kb
k =
c d kc kd
Example 1 Calculate the following:
 
1 2 3
5 7 5 6 =
 

5 2 8

Example 2 Yesterday, there are were 45 kids, 72 teenagers, and 31 adults who played
Laser Tag and 22 kids, 55 teenagers, and 53 adults who played the Escape Room. Today,
there were twice as many people because of a coupon found in the flyers. How many kids,
teenagers, and adults played Laser Tag? How many played the Escape Room?

Matrix Multiplication
Here, we are multiplying a matrix by another matrix. To perform matrix multiplication, we
multiply each element of a row from one matrix by the corresponding element of the column
from the other matrix and add the products together. Below, see what happens when we
multiply two 2 × 2 matrices together.

" #" # " #


a b e f ae + bg af + bh
=
c d g h ce + dg cf + dh

6
Example Calculate the following:
" #" #
1 5 4 3
(a)
12 7 2 1

 
" # 7 1
3 2 1 
(b)  2 5

5 3 4
10 4

  
3 4 2 2
(c) 1 5 6 4
  

7 9 3 1

There are a few things we need to take note of:

Suppose A is an m × n matrix and B is a p × q matrix.

1. Matrices A and B can be multiplied together only if n = p


(i.e. # of columns in A = # of rows in B)

2. The product of the two matrices, A and B, will be an m × q matrix


(i.e. AB will be an m × q matrix.)

7
Problem Set

1. Construct a matrix for the following scenarios:

(a) We are doing a class vote on which one is better: books or movies. For books,
there were 10 votes from the Grades 7s and 6 votes from the Grade 8s. For movies,
there were 8 votes from the Grade 7s and 11 votes from the Grade 8s.
(b) It’s the season for apple ciders and hot chocolate drinks! On Friday, Tim Hor-
ton’s sells 25 apple ciders, 32 hot chocolates, and 28 white hot chocolates. On
Saturday, they sell 53 apple ciders, 55 hot chocolates, and 46 white hot choco-
lates. On Sunday, they sell 45 apple ciders, 45, hot chocolates, and 47 white hot
chocolates.

2. Add or subtract the following matrices:


     
1 4 14 12 23 34 9 28 3
A = 15 22 6  B = 10 5 16 C = 17 6 14
     

11 3 20 25 30 8 24 12 13

(a) A + B (c) A + B − C
(b) B − C (d) B + C − A

3. Multiply the following matrices:


 
" # 8 3 " #
2 4 1 13 6
D= E =  1 9 F =
 
6 11 3 7 8
15 4

(a) DE (c) F D
(b) EF (d) F × DE

4. Calculate the following given matrices G and H:


" # " #
1 3 8 3
G= H=
9 4 2 5

(a) 3G + H (b) 5G − 4H

8
5. When multiplying numbers, we can say 2 × 3 = 3 × 2 = 6. In general,
a×b=b×a
where a and b is any number. This is called the commutative property of numbers.
Is this property true for matrices? Answer the following questions to find out.
Suppose we have the following matrices:
 
" # 2 3
5 6 2
A= B = 8 5
 
10 4 1
1 1

(a) Calculate the following:

i. AB ii. BA

(b) Does AB = BA? Is the commutative property true for matrices?

6. Suppose CD = E. What are the missing elements in matrix C?


 
" # 2 " #
a 1 2 13
C= D = 1 E=
 
7 b 3 28
1

7. Suppose D − 2E = F . What are the missing elements in matrices D, E and F ?


" # " # " #
12 x 5 3 5 2 6 −4 1
D= E= F =
1 4 8 y 9 1 −3 −14 z

8. Suppose 4M + N P = Q. What is the matrix M ?


 
" # 1 5 " #
6 7 1 79 61
N= P = 8 3 Q=
 
4 3 10 114 81
5 2

9. If you multiply a 3 × 6 matrix by a 6 × 2 matrix, what are the dimensions of the


product?

10. What is another application of matrices in real life? (Do some research!)

9
11. An electronics company called Alpha wants to determine which of their phone products
made the most profit (or made the most money). In the last month,

• Phone A earned $150, 000 and Phone B earned $200, 000 in total
• Phone A cost $100, 000 and Phone B cost $175, 000 to manufacture

(Hint: The equation to calculate profit is Revenue − Cost = P rof it where revenue is the
amount of money earned, cost is the amount of money spent, and profit is the amount of
money leftover.)

(a) How much profit did Alpha make in the last month total?
(b) Which phone product made the most profit in the last month?

12. During recess, T.J., Vince, and Mikey decide to combine their piggy bank money to
buy $10.00 worth of bubble gum after school at the convenience store.

• T.J. has 6 dimes, 10 quarters, and 2 loonies,


• Vince has 12 dimes, and 7 quarters,
• Mikey has 8 dimes, 6 quarters, and 1 loonie.
• Mikey, the kind soul that he is, buys a juice box for a thirsty first grader. It costs
him $1.25.

Do they have enough money to buy $10.00 worth of bubble gum?

*13. Jean, Logan, and Scott all go to Professor X’s School for Mutants. It’s the end of the
year and they all want to calculate their final grades for their Mutant History class.
Their grade is made up of three tests: Test A, Test B, and Test C.

• Jean received an 85% on Test A, 80% on Test B, and 86% on Test C


• Logan received a 74% on Test A, 64% on Test B, and 88% on Test C
• Scott received an 77% on Test A, 92% on Test B, and an 74% on Test C

Suppose Test A is worth 20% of their final grade, Test B is worth 30%, and Test C is
worth 50%. What are the final grades in class for Jean, Logan, and Scott?

10
**14. Hill Cipher (Cryptography)
Suppose we number the alphabet from 0 to 25. (i.e. A = 0, B = 1, C = 2, ...). As an
example, consider the message FRIEND as a 3 × 2 matrix and the 3 × 3 key matrix (or
encoding matrix) below:
     
F E 5 4 6 12 1
FRIEND ⇒ R N ⇒ 17 13 Key matrix ⇒ 15 7 2
     

I D 8 3 8 13 3

To encrypt the message, multiply the key matrix by the message. For the resulting
matrix, subtract 26 from each element repeatedly until the element is less than 26.
        
6 12 1 5 4 242 183 8 1 I B
15 7 2 17 13 = 210 157 ⇒  2 1 ⇒ C B ⇒ ICZBBC
        

8 13 3 8 3 285 210 25 2 Z C

The encrypted message is ICZBBC. To decrpyt a message, you need another key matrix.
Multiply this key matrix by the encrypted message matrix to determine the actual
message. (Note that all elements in every matrix must be a number from 0 to 25.)

(a) Encrypt the following message given the key matrix: HAPPINESS
 
2 10 5
Key matrix ⇒ 21 4 6
 

11 8 3

(b) Decrypt the following encrypted message given the key matrix: YKVJ
" #
8 21
Key matrix ⇒
23 2

11
***15. Google Page Rank Method
Google determines which webpages to display first based on how often a webpage is
visited using a combination of different mathematical concepts including matrices. At
this point, the page rank method is quite complex to explain but if you are up for a
serious challenge, research “Google Page Rank”. For now, to simplify, the following
equation is used to rank webpages:
(1 − d)
G=d·L+ ·e
N
• L is the matrix that tell us whether there is a link between webpages (i.e. If there
is a link between A and B, the matrix element is 1. Otherwise, it is 0.)
• d is a number between 0 and 1, called the damping factor, which ensures that we
will not be calculating the page rank infinitely
(i.e. At some point, you stop clicking other webpages)
• N is the number of webpages
• e is a ones matrix with the same dimensions as G and L
(i.e. All matrix elements are 1)
• G is the updated matrix L or our rank matrix
• p is the probability matrix that a page will be clicked

After calculating G,
R=G·p
R is our final matrix with the final ranking of all the webpages. The page with the
highest ranking is displayed first on your Google search.

(a) For webpages A, B, and C, determine rank matrix G.

A B C
   
A 0 1 1 1 1 1
d = 0.85 L = B 1 0 0  N =3 e = 1 1 1
   

C 1 0 0 1 1 1

(b) Given the probabiliy matrix p, what are the page rankings of webpages A, B, and
C? (i.e. Determine matrix R.)
 
0.15
p =  0.5 
 

0.35

12

You might also like