Professional Documents
Culture Documents
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.
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
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
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.
• 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:
• 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.
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 Wednesday, Bart loses $0.25 in a bet with his friends and Lisa spend $1.70 on
bubble gum
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.
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
7
Problem Set
(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.
11 3 20 25 30 8 24 12 13
(a) A + B (c) A + B − C
(b) B − C (d) B + C − A
(a) DE (c) F D
(b) EF (d) F × DE
(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
i. AB ii. BA
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.
*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.
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 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