Vectors and Matrices
Vectors and Matrices
Outline
This section will study properties of linear
equations
Consider a system of two equations
𝑎𝑥 + 𝑏𝑦 = 𝑐
𝑑𝑥 + 𝑒𝑦 = 𝑓
The system can be written in matrix form
𝑎 𝑏 𝑥 𝑐
=
𝑑 𝑒 𝑦 𝑓
1
Outline
We will cover topics in linear algebra
Matrix operations
◼ Addition and subtraction
◼ Multiplication
◼ Finding inverse matrices
◼ Solutions of linear equations
Applications
Solving an equation
Let 𝑎𝑥 = 𝑏
𝑥 is a variable; a and b are constants
There are three possible cases for the solution:
𝑏
if a 0, there is a unique solution: 𝑥 = 𝑎 = 𝑎−1 𝑏
if a = b = 0, any real number 𝑥 is a solution
if a = 0 and b 0, there is no solution
2
Matrices
A matrix with r rows and c columns is “an r c
matrix”
We also say it is “of order r c”
Matrix A is a 2 3 matrix
𝑎11 𝑎12 𝑎13
𝑨= 𝑎
21 𝑎22 𝑎23
The first subscript of 𝑎𝑖𝑗 is the row; the second is the
column
Vectors
A matrix with one row is a row vector:
𝒂 = 𝑎11 𝑎12 𝑎13
A matrix with one column is a column vector:
𝑏11
𝒃 = 𝑏21
𝑏31
3
Matrix addition and subtraction
Addition of matrices occurs element by element:
𝑎11 𝑎12 𝑏11 𝑏12
𝑨+𝑩= 𝑎 +
21 𝑎22 𝑏21 𝑏22
𝑎 + 𝑏11 𝑎12 + 𝑏12
= 11
𝑎21 + 𝑏21 𝑎22 + 𝑏22
Scalar multiplication rescales each element:
𝑎11 𝑎12 𝑘𝑎11 𝑘𝑎12
𝑘 𝑎 =
21 𝑎22 𝑘𝑎21 𝑘𝑎22
4
Matrix multiplication
Multiply matrices A and B to get C:
𝑎11 𝑎12 𝑏11 𝑏12
A×B= 𝑎 𝑎22 ×
21 𝑏21 𝑏22
𝑎11 𝑏11 + 𝑎12 𝑏21 𝑎11 𝑏12 + 𝑎12 𝑏22
= =𝑪
𝑎21 𝑏11 + 𝑎22 𝑏21 𝑎21 𝑏12 + 𝑎22 𝑏22
To find element cij of C, multiply each element of
row i of A by the corresponding element of
column j of B, and add the products
Vector multiplication
A special case is the product of row vector 𝒂 and
column vector 𝒃:
𝑏11
𝒂 × 𝒃 = 𝑎11 𝑎12 𝑎13 𝑏21
𝑏31
5
Vector multiplication
Now do the multiplication in the opposite order:
𝑏11
𝒃 × 𝒂 = 𝑏21 𝑎11 𝑎12 𝑎13
𝑏31
𝑏11 𝑎11 𝑏11 𝑎12 𝑏11 𝑎13
= 𝑏21 𝑎11 𝑏21 𝑎12 𝑏21 𝑎13
𝑏31 𝑎11 𝑏31 𝑎12 𝑏31 𝑎13
Example
Consider the following matrix equation:
1 2 𝑥 4
× 𝑦 =
2 1 5
Pre-multiply both sides by the same matrix:
1 2 1 2
− −
3 3 × 1 2 × 𝑥 = 3 3 × 4
2 1 2 1 𝑦 2 1 5
− −
3 3 3 3
6
Example
The lefthand side is:
1 2
− 1 2 𝑥 1 0 𝑥 𝑥
3 3
2 1 × × 𝑦 = × 𝑦 = 𝑦
− 2 1 0 1
3 3
7
Rules for matrix multiplication
Several properties hold for matrix multiplication
Associative property: (AB)C = A(BC)
Left distributive property: A(B + C) = AB + AC
Right distributive property: (A + B)C = AC + BC
Scalar multiplication: (kA)B = A(kB) = k(AB)
Examples
5 −1 2 0 1 2
Calculate
1 4 3 1 2 3
5 −1 2 0 1 2
Calculate
1 4 3 1 2 3
8
Matrix transpose
5 2
Let 𝑨 =
3 4
5 3
Its transpose is 𝑨𝑇 =
2 4
Let 𝑩 = 1 3 5
1
Its transpose is 𝑩𝑇 = 3
5
Matrix transpose
1 2 3
Let 𝑪 =
4 5 6
1 4
Its transpose is 𝑪𝑇 = 2 5
3 6
Note that 𝑪𝑇 𝑇
=𝐶
9
Symmetric matrix
Matrix 𝑨 is symmetric if 𝑨𝑇 = 𝑨
5 3
For example, 𝑨 = is symmetric
3 4
For two conformable matrices 𝑩 and 𝑪, the
transpose of the product is 𝑩𝑪 𝑇 = 𝑪𝑇 𝑩𝑇
This means 𝑨𝑇 𝑨 𝑇 = 𝑨𝑇 (𝑨𝑇 )𝑇 = 𝑨𝑇 𝑨
Example
1 2
Let 𝑨 =
3 4
Find 𝑨 𝑨 and 𝑨𝑇 𝑨
𝑇 𝑇
10
Example
1 2
Given 𝑨 = , we have
3 4
1 3 1 2 10 14
𝑨𝑇 𝑨 = =
2 4 3 4 14 20
We also have
10 14
𝑨𝑇 𝑨 𝑇 =
14 20
Example
𝑥1 1
Let 𝑨 = 𝑥2 and 𝑩 = 1
𝑥3 1
Find 𝑨 𝑩 and 𝑨 𝑨
𝑇 𝑇
11
Transposes and multiplication
Multiply matrices A and B:
𝑎11 𝑎12 𝑏11 𝑏12
A×B= 𝑎 𝑎22 ×
21 𝑏21 𝑏22
Multiply matrices 𝑩𝑻 and 𝑨𝑻 :
Identity matrix
An identity matrix is a square matrix with 1s
along the main diagonal and all other entries
equal to 0
The 22 identity matrix is
1 0
𝑰2 =
0 1
If C is an m n matrix, then ImC = C and C = CIn
12
Example
Calculate
1 0 0
1 0 𝑐11 𝑐12 𝑐13
0 1 0
0 1 𝑐21 𝑐22 𝑐23
0 0 1
Inverse matrix
𝑎11 𝑎12
The inverse matrix of 𝑨 = 𝑎 is
21 𝑎22
1 𝑎22 −𝑎12
𝑨−1 =
𝑎11 𝑎22 −𝑎21 𝑎12 −𝑎21 𝑎11
|A| = a11a22 – a21a12 is the determinant of A
An inverse matrix does not exist if |A| ≠ 0
The inverse matrix satisfies:
1 0
𝑨𝑨−1 = 𝑨−1 𝑨 =
0 1
13
Inverse matrix
Check 𝑨−1 𝑨:
1 |A| 0
=
|A| 0 |A|
Systems of equations
Consider a system of two equations:
𝑎11𝑥1 + 𝑎12𝑥2 = 𝑏1
𝑎21𝑥1 + 𝑎22𝑥2 = 𝑏2
We can write the system in matrix notation:
𝑎11 𝑎12 𝑥1 𝑏1
𝑎21 𝑎22 𝑥2 = or 𝑨𝒙 = 𝒃
𝑏2
14
Systems of equations
Let 𝑨𝒙 = 𝒃 and pre-multiply both sides by A–1:
𝑨−1 𝑨𝒙 = 𝑨−1 𝒃 ⇒ 𝑰𝒙 = 𝑨−1 𝒃 ⇒ 𝒙 = 𝑨−1 𝒃
This yields the solution:
𝑥1 1 𝑎22 −𝑎12 𝑏1
𝑥2 =
𝑎11 𝑎22 −𝑎21 𝑎12 −𝑎21 𝑎11 𝑏2
1 𝑎22 𝑏1 − 𝑎12 𝑏2
=
𝑎11 𝑎22 −𝑎21 𝑎12 −𝑎21 𝑏1 + 𝑎11 𝑏2
15
Determinant equal to zero
The original system is equivalent to the
following:
0 = 𝑏1 − 2𝑏2
2𝑥1 + 3𝑥2 = 𝑏2
There may be no solution or infinitely many
solutions to 𝑨𝒙 = 𝒃
Input-output analysis
In 1949, Leontief divided data from the U.S.
economy into 500 sectors (e.g., coal industry,
automotive industry, etc.)
A linear equation described how each sector
divided its output among the sectors
Leontief aggregated the sectors so that there were
42 equations in 42 unknowns
It took a computer 56 hours to solve the system of
equations
16
The general input-output model
There are fixed proportions and constant returns
to scale in production
Useaij units of good i when producing one unit of
good j
If the output of good j is 𝑥𝑗, total usage of 𝑥1 as an
input is:
𝑎11𝑥1 + 𝑎12𝑥2 + ⋯ + 𝑎1𝑛𝑥𝑛
Good k’s usage as an input is:
𝑎𝑘1𝑥1 + 𝑎𝑘2𝑥2 + ⋯ + 𝑎𝑘𝑛𝑥𝑛
17
The general input-output model
Production of each good is divided between
input use and consumption:
𝒙 = 𝑨𝒙 + 𝒄 ⇒ (𝑰– 𝑨)𝒙 = 𝒄
𝒙 is the production vector
𝑨𝒙 is the input requirements vector
c is the consumption vector
Production is 𝒙 = (𝑰– 𝑨)−1 𝒄
Example
Let desired consumption be c1 = 18 and c2 = 24,
0 0.5
and let 𝑨 =
0.5 0
Production is 𝒙 = (𝑰– 𝑨)−1 𝒄, where:
1 −0.5
𝑰−𝑨=
−0.5 1
4 1 0.5
(𝑰 − 𝑨)−1 =
3 0.5 1
18
Example
We now have:
4 1 0.5 18 40
𝒙 = (𝑰 − 𝑨)−1 𝒄 = =
3 0.5 1 24 44
Input requirements are:
0 0.5 40 22
𝑨𝒙 = =
0.5 0 44 20
Comparative statics
If desired consumption rises by 𝒄, we must have:
𝒙 + 𝒙 = 𝑨 𝒙 + 𝒙 + 𝒄 + 𝒄
⇒ 𝒙 = 𝑨𝒙 + 𝒄
4 1 0.5 Δ𝑐1
⇒ 𝒙 = (𝑰 − 𝑨)−1 𝒄 =
3 0.5 1 Δ𝑐2
This gives:
Δ𝑥1 4 Δ𝑐1 + 0.5Δ𝑐2 1 4Δ𝑐1 + 2Δ𝑐2
= =
Δ𝑥2 3 0.5Δ𝑐1 + Δ𝑐2 3 2Δ𝑐1 + 4Δ𝑐2
19
Comparative statics
Δ𝑐1 1
If = , the change in production is:
Δ𝑐2 0
4
4 1 0.5 1 3
𝒙 = (𝑰 − 𝑨)−1 𝒄 = = 2
3 0.5 1 0
3
1
3
⇒ 𝒙 − ∆𝒄 = 2
3
Example
Suppose that 0.8 units of good 1 are needed to
produce one unit of good 2 and 0.75 units of
good 2 are needed to produce one unit of good 1
Find the consumption matrix, 𝑨
20
Transition matrices
In many situations, the “state of the world”
tomorrow depends on the state of the world
today
Consider the case of two states
Initially, there are 𝑥𝑗0 people in state j
The number of people in state j in period t is 𝑥𝑗𝑡
Transition matrices
Let aij denote the fraction of people currently in
state j who will be in state i next period
The number in state 1 in period 1 is the number
in state 1 in period 0 who remain, plus the
number from state 2 who move in:
𝑥11 = 𝑎11 𝑥10 + 𝑎12 𝑥20
𝑥21 = 𝑎21 𝑥10 + 𝑎22 𝑥20
21
Transition matrices
The transition matrix is:
𝑎11 𝑎12
𝑨= 𝑎
21 𝑎22
Populations in period 1 are:
𝑎11 𝑎12 𝑥10 𝑥11
𝑎21 𝑎22 𝑥 0 = 𝑥1
2 2
Transition matrices
Suppose that the populations do not change
from period to period:
𝑥1𝑡+1 = 𝑥1𝑡 ⇒ 𝑥1𝑡 = 𝑎11 𝑥1𝑡 + 𝑎12 𝑥2𝑡
𝑥2𝑡+1 = 𝑥2𝑡 ⇒ 𝑥2𝑡 = 𝑎21 𝑥1𝑡 + 𝑎22 𝑥2𝑡
𝑥1
In general, 𝑥 is a steady state if 𝑨𝒙 = 𝒙 or:
2
𝑥1 = 𝑎11 𝑥1 + 𝑎12 𝑥2
𝑥2 = 𝑎21 𝑥1 + 𝑎22 𝑥2
22
Example
Let the transition matrix be:
0.5 0.5
𝑨=
0.5 0.5
The populations in period 0 are 𝑥10 and 𝑥20 , with
𝑥10 + 𝑥20 = 𝑥ҧ
Find the populations in period 1
Example
0.5 0.5
Given 𝑨 = , period-1 populations are:
0.5 0.5
0.5 0.5 𝑥1
0
0.5(𝑥10 + 𝑥20 ) 0.5𝑥ҧ
0 = 0 0 =
0.5 0.5 𝑥2 0.5(𝑥1 + 𝑥2 ) 0.5𝑥ҧ
Find the steady state
23
Example
The steady state requires:
0.5 0.5 𝑥1 𝑥1
𝑨𝒙 = 𝒙 ⇒ =
0.5 0.5 𝑥2 𝑥2
0.5(𝑥1 + 𝑥2 ) 𝑥1
⇒ = 𝑥
0.5(𝑥1 + 𝑥2 ) 2
⇒ 𝑥1 = 𝑥2 = 0.5𝑥ҧ
Example
0 1
Let the transition matrix be 𝑨 =
1 0
Solving 𝑨𝒙 = 𝒙 gives:
𝑥1 𝑥1 0 1 𝑥1 𝑥1
𝑨 𝑥 = 𝑥 ⇒ =
2 2 1 0 𝑥2 𝑥2
𝑥2 𝑥1
⇒ 𝑥 = 𝑥
1 2
24
Example
There are p people in Eatstown
If someone eats dinner at home today, there is
probability 0.85 that the individual will eat
dinner at home tomorrow
If someone eats dinner at a restaurant today,
there is probability 0.90 that the individual will
eat dinner at home tomorrow
Example
Let h0 be the number who eat at home in period
0 and let r0 be the number who eat at a
restaurant
Determine how many people eat at home in
period 1 and how many eat at a restaurant
Express the answer as two linear equations and
in matrix form:
ℎ1 = 𝑨 ℎ0
𝑟1 𝑟0
25
Eigenvectors and Eigenvalues
When a square matrix multiplies a vector, the
vector is rotated and scaled
Vectors called eigenvectors (or characteristic
vectors) are only scaled
The scaling factors are the eigenvalues (or
characteristic values)
26
Eigenvectors and Eigenvalues
1
Let 𝒙 =
1
The product is:
4 2 1 6
𝑨𝒙 = =
2 4 1 6
Eigenvalues
If 𝑨𝒙 = 𝒙 for some , then
𝑎 −𝜆 𝑎12 𝑥1
𝑨 − 𝑰 𝒙 = 11
𝑎21 𝑎22 − 𝑥2
𝑎11 − 𝜆 𝑥1 + 𝑎12 𝑥2 0
= =
𝑎21 𝑥1 + 𝑎22 − 𝜆 𝑥2 0
|A–I| = 0 yields an equation called the
characteristic polynomial or the characteristic
equation
The roots of the equation are the eigenvalues
27
Example
4 2
Return to 𝑨 =
2 4
4−𝜆 2
𝑨 − 𝜆𝑰 = and its determinant is
2 4−𝜆
(4 − 𝜆)2 − 4 = 𝜆2 − 8𝜆 + 12 = (𝜆 − 6)(𝜆 − 2)
The roots are 𝜆 = 6 and 𝜆 = 2
28
Eigenvectors and Eigenvalues
𝑨𝒙 = 2𝒙 gives two equations:
4𝑥1 + 2𝑥2 = 2𝑥1
2𝑥1 + 4𝑥2 = 2𝑥2
1
Both imply 𝑥1 = – 𝑥2, so 𝑥 = is an
−1
eigenvector
29
Steady state
Solving 𝑨𝒙 = 𝒙 yields:
𝑥1 = 𝑎11 𝑥1 + 𝑎12 𝑥2
𝑥2 = (1 − 𝑎11 )𝑥1 + (1 − 𝑎12 )𝑥2
Both equations amount to
(1 − 𝑎11 )𝑥1 − 𝑎12 𝑥2 = 0
We also have the aggregate population
condition:
𝑥1 + 𝑥2 = 𝑥
Steady state
The equations are:
(1 − 𝑎11 )𝑥1 − 𝑎12 𝑥2 = 0
𝑥1 + 𝑥2 = 𝑥
Substituting the second into the first yields:
(1 − 𝑎11 )𝑥1 − 𝑎12 ( 𝑥−𝑥1 ) = 0
⇒ 1 − 𝑎11 +𝑎12 𝑥1 = 𝑥
30
Steady state
There are two cases for 1 − 𝑎11 + 𝑎12 𝑥1 = 𝑥
If 1 − 𝑎11 +𝑎12 ≠ 0, we have:
𝑎12 𝑥
𝑥1 =
1−𝑎11 +𝑎12
Summary
We have introduced concepts from linear
algebra
Matrices
Vectors
Matrix operations
We have seen applications
Transition matrices and steady states
Eigenvectors and eigenvalues
31