Download Matrix Operations

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Location arithmetic wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Determinant wikipedia , lookup

Non-negative matrix factorization wikipedia , lookup

Matrix calculus wikipedia , lookup

Transcript
Basic Matrix Operations
Matrix – a rectangular array of numbers,
variables, and both
Order (dimensions) – describes the number
of rows and columns in a matrix
Row 2
3
7
8
10
Column 1
Column 2
Column 3
Column 4
4
5
6
This is a 2 x 4 matrix.
Columns
2
Rows
Row 1
Element – each individual entry
notation – A mn : A is the name of the matrix, m is
the row number and n is column
number.
interpretation – what the number represents,
describe in words
Vins
Tonis
Pizza
$10.10
$10.86
A = Drinks
$1.09
$0.89
Salad
$3.69
$3.89
Interpret the values for A12 , A21, and A32.
Sals
$10.65
$1.05
$3.85
A12 says the price of a pizza at Tonis is $10.86
A21 says the price of drinks at Vins is $1.09
A32 says the price of salad at Tonis is $3.89
Square matrix – a matrix, where the rows
and columns are equal
23
65
12
-52
12
Column matrix – a matrix
14
made up of just one column
62
and any number of rows
Row matrix – a matrix made up of just one
row and any number of columns
121
145
324
365
Adding and subtracting matrices – (matrices of the
same dimensions can be added or subtracted)
add or subtract the element of the first matrix by
the element of the second matrix in the same
position and the answer goes in that same
position in the matrix that is representing the
answer.
2
-6
3
7
4
+
8
-5
9
=
=
2+4
3 + -5
-6 + 8
7+9
6
-2
2
16
Main diagonal – the elements whose row number and
column number are the same.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Zero matrix – a matrix of any dimensions made up of all
zeros
0
0
0
0
0
0
Scalar Multiplication – (think Distributive
Property for Matrices) the element of the
matrix are multiplied by a value outside of
the matrix
5
8
-11
23
16
=
40
115
-55
80
Matrix Multiplication – In order to multiply two matrices
the columns of the first matrix must be equal to the rows
of the second matrix.
[A] x [B]
(m x k) (k x n)
When doing word problems, make sure
the labels of the rows and columns you
are multiplying match as well as the
numbers.
A group of friends are going out for pizza. Given are
the ordering options and the prices for pizza and salad
at the two pizza places.
Option 1 Option 2
Pizza
Salad
4
6
2
8
= [A]
Vin’s Toni’s
Pizza 11.25 11.95
Salad 3.69
Find the cost of each option at each of
the two pizza places.
2.85
= [B]
Option 1 Option 2
Pizza
4
Salad
6
Vin’s Toni’s
2
= [A] Pizza
8
Salad
First take [A][B].
11.25 11.95 = [B]
3.69 2.85
Why is this wrong?
4
2
11.25 11.95
6
8
3.69
2.85
( 4 P Opt1)(11.25 P @V) + (2 P Opt 2)(3.69 S @V)
The labels in the second product do not match each other
How do we fix this?
4
2
11.25 11.95
6
8
3.69
2.85
We need to Transpose the first matrix.
4
6
11.25 11.95
2
8
3.69
2.85
And now multiply
the two matrices
together
( 4 P Opt1)(11.25 P @V) + (6 S Opt 1)(3.69 S @V)
Now all of the labels match in the product
for Row 1 Column 1
Multiplication of a Column by a Row
A= 4 5 8
B= 2
6
Now, lets multiply A x B.
9
1x3 = 3x1
4 5 8
2
6
9
4 (2) + 5 (6) + 8(9) = 110
Transpose – ( A T ) of the matrix A is the matrix
obtained by interchanging the rows and columns
of matrix A.
A=
1
2
3
4
5
6
AT
=
1
4
2
5
3
6
The transpose function is in the Matrix catalog,
MATH column and the second choice down.
If the matrices pass the first test of the columns in the first
being equal to the rows in the second use the following steps
to multiply.
2
6
A
3
4
7
8
B
5
9
Take the numbers in the first row of matrix A times the
numbers in each of the columns in matrix B. Then do the
same for the numbers in the second row of matrix A times the
numbers in each of the columns in matrix B.
2(4) + 3(8) 2(5) + 3(9)
32
37
6(4) + 7(8) 6(5) + 7(9)
80
93
Inverse – we use the inverse of a matrix when we need
to divide it is denoted as A-1
Some of you may remember using a formula to find the
inverse in Algebra 2 but in this class we will use the inverse
button on the calculator (fourth button down on left hand
side of calculator)
Identity Matrix – this acts like the number one for matrices,
denoted with a capital I. This matrix must be a square matrix
and have the number one in the main diagonal and 0’s
everywhere else.
Example:
1
0
0
1
or
1
0
0
0
1
0
0
0
1
Leslie Growth Model
The Leslie Growth Model is used to predict population
levels at different age distributions.
Needed Information:
 The length of each cycle (how long an animal is in
each age group)
 The birthrate in each of the cycles
 The survival rate of each of the cycles
 The initial distribution in each of the cycles.
(birthrate and survival rates will remain constant in the
problems and only the female population is tracted)
Population Growth
Suppose that a certain animal has the following birthrate,
survival rate, and population distribution.
Age (yrs)
0-2
2-4
4-6
6-8
8-10
Birthrate
0
0.7
1.5
1.5
0.4
Survival
0.8
0.7
0.7
0.6
0
Distribution
25
32
15
12
10
a.) Find the population distribution for the next two cycles.
b.) Find the growth rate for each cycle.
Finding the population distribution
after one cycle
Step 1: Multiply the distribution in each cycle times
the birthrate for the corresponding cycle
and add all the products
25(0) + 32(.7) + 15(1.5) + 12(1.5) + 10(.4) = 66.90
(round all numbers to 2 decimal places)
This number (66.90) will be the number of newborns
(age 0-2) after one cycle.
Age (yrs) Birthrate Survival
0-2
0
0.8
0-4
0.7
0.7
4-6
1.5
0.7
6-8
1.5
0.6
8-10
0.4
0
Distribution Cycle 1
25
66.9
32
15
12
10
Now, we need to find out many of the animals in each
distribution survived and move to the next highest
age group.
Find the number of animals that survive
to live another day.
Step 2: Multiply the numbers of animals that start in
the first age group times the survival rate in that
group and place this number in the next highest age
group (one row down the chart)
25 (.8) = 20 (these are the animals that are now 2-4
years old)
32 (.7) = 22.4 (these are the animals that are now 4-6)
Age (yrs) Birthrate Survival Distribution Cycle 1
0-2
0
0.8 x 25
66.9
0-4
0.7
0.7 x
32
20
4-6
1.5
0.7
15
22.4
6-8
1.5
0.6
12
8-10
0.4
0
10
Now, fill in the rest of the chart in the same manner.
15 ( .7) = 10.5
12 ( .6) = 7.2
10 ( 0 ) = 0 (the last one will always be zero because
this is the life expectancy of the animals)
Age (yrs) Birthrate
Survival Distribution Cycle
1
0-2
0-4
4-6
6-8
8-10
0
0.7
1.5
1.5
0.4
0.8
0.7
0.7
0.6
0
25
32
15
12
10
66.90
20
22.4
10.5
7.2
Find the Growth Rate
New – Old = Growth Rate Distribution Cycle 1
25
66.90
Old
32
20
15
22.4
12
10.5
127
–
94
Cycle 1
= .35 or 35%
10
7.2
94
94
127
Now, use the Cycle 1 numbers and the
given birth and survival rates to find
the age distribution for Cycle 2 and the
Growth Rate.
Age (yrs)BR
0-2
0
2-4
0.7
4-6
1.5
6-8
1.5
8-10
0.4
SR Dist Cycle 1
0.8 25
66.90
0.7 32
20
0.7 15
22.4
0.6 12
10.5
0 10
7.2
Cycle 2
66.23
53.52
14
15.68
6.3
Population Growth
Suppose that a certain animal has the following birthrate, survival
rate, and population distribution.
Age (yrs)
Birthrate
Survival
Distribution
0-2
0
0.7
20
2-4
0.8
0.8
15
4-6
0.9
0.9
23
6-8
1.2
0.5
17
8-10
0.5
0.4
8
10-12
0.2
0.3
5
12-14
0
0
5
a.) Find the distribution for the next three cycles.
b.) Find the growth rate for the next three cycles.
c.) After how many cycles will the population be over 1,000,000?
Leslie Matrices in the calculator
The population distribution is a row matrix [A]
The birth and survival rates make up the Leslie matrix.
(will always be a square matrix)
The birthrates are the first column and the survival
rates and zeros make up the other columns. The
survival rate go in the super diagonal (one above the
main diagonal) and zeros are all other elements of
the matrix.
[A] = [ 20 15 23 17 8 5 5 ]
[B] =
0
0.8
0.9
1.2
0.5
0.2
0
0.7 0
0 0.8
0
0
0
0
0
0
0
0
0
0
0
0
0.9
0
0
0
0
Now, [A][B] = Cycle 1
[A][B]2 = Cycle 2
0
0
0
0.5
0
0
0
0
0
0
0
0.4
0
0
0
0
0
0
0
0.3
0
Total Population
Make another matrix [C], this is a column matrix with all 1’s
for elements. This matrix will have as many rows as the
distribution matrix had columns.
For this example: [C] =
1
1
1
1
1
1
1
[A][B][C] = Total Population for Cycle 1
[A][B]2[C] = Total Population Cycle 2