331 Notes Matrix
331 Notes Matrix
1 Matrix Algebra
1. Gives us a shorthand way of writing a large system of equations.
2. Allows us to test for the existance of solutions to simultaneous systems.
3. Allows us to solve a simultaneous system.
DRAWBACK: Only works for linear systems. However, we can often covert non-linear to linear systems.
Example
y = axb
ln y = ln a + b ln x
Matrices and Vectors
Given
y = 10 − x ⇒ x + y = 10
y = 2 + 3x ⇒ −3x + y = 2
In matrix form
1 1 x = 10
−3 1 y 2
Matrix of Coefficients Vector of Unknows Vector of Constants
In general
a11 x1 + a12x2 + . . . + a1nxn = d1
a21 x1 + a22x2 + . . . + a2nxn = d2
..............................
am1 x1 + am2x2 + . . . + amnxn = dm
n-unknowns (x1, x2, . . . xn)
Matrix form
a11 a12 . . . a1n x1 d1
a21 a22 . . . a2n
x2
d2
.. ... .. .. = ..
. ... . . .
am1 am2 . . . amn xn dm
Matrix shorthand
Ax = d
Where:
A= coefficient martrix or an array
x= vector of unknowns or an array
d= vector of constants or an array
Subscript notation
aij
is the coefficient found in the i-th row (i=1,. . . ,m) and the j-th column (j=1,. . . ,n)
1
1.1 Vectors as special matrices
The number of rows and the number of columns define the DIMENSION of a matrix.
A is m rows and n is columns or ”mxn.”
A matrix containing 1 column is called a ”column VECTOR”
x is a n×1 column vector
d is a m×1 column vector
If x were arranged in a horizontal array we would have a row vector.
Row vectors are denoted by a prime
x = [x1 , x2, . . . , xn]
A 1×1 vector is known as a scalar.
x = [4] is a scalar
Matrix Operators
If we have two matrices, A and B, then
A = B iff aij = bij
Addition and Subtraction of Matrices Suppose A is an m×n matrix and B is a p×q matrix then A
and B is possible only if m=p and n=q. Matrices must have the same dimensions.
a11 a12 b11 b12 (a11 + b11 ) (a12 + b12) c11 c12
a21 a22 + b21 b22 = (a21 + b21 ) (a22 + b22) = c21 c22
Subtraction is identical to addition
9 4 − 7 2 = (9 − 7) (4 − 2) = 2 2
3 1 1 6 (3 − 1) (1 − 6) 2 −5
Scalar Multiplication Suppose we want to multiply a matrix by a scalar
k × A
1×1 m×n
We multiply every element in A by the scalar k
ka11 ka12 . . . ka1n
ka21 ka22 . . . ka2n
kA = ..
.
kam1 kam2 . . . kamn
Example
Let k=[3] and A= 64 25
then kA=
× 6 3 × 2 = 18 6
kA = 33 ×
4 3×5 12 15
Multiplication of Matrices To multiply two matrices, A and B, together it must be true that for
A × B = C
m×n n×q m×q
That A must have the same number of columns (n) as B has rows (n).
The product matrix, C, will have the same number of rows as A and the same number of columns as B.
2
Example
A × B = C
(1 × 3) (3 × 4) (1 × 4)
1row 3rows 1row
3cols 4cols 4cols
In general
A × B × C × D = E
(3 × 2) (2 × 5) (5 × 4) (4 × 1) (3 × 1)
To multiply two matrices:
(1) Multiply each element in a given row by each element in a given column
(2) Sum up their products
Example 1
a11 a12 × b11 b12 = c11 c12
a21 a22 b21 b22 c21 c22
Where:
c11=a11 b11 + a12b21 (sum of row 1 times column 1)
c12=a11 b12 + a12b22 (sum of row 1 times column 2)
c21=a21 b11 + a22b21 (sum of row 2 times column 1)
c22=a21 b12 + a22b22 (sum of row 2 times column 2)
Example 2
1 2
3 2 3 4 =
(3 × 1) +(2 × 3) (3 × 2) +(2 × 4)
= 9 14
Example 3
2
3 2 1 1 = (3 × 2) + (2 × 1) + (1 × 4) = [12]
4
12 is the inner product of two vectors.
Suppose
x = xx1
then x = x1 x2
2
therefore
x x = x1 x2
x1
x2
= x21 + x22
However
xx = 2 by 2 matrix
x1
x1 x2 = xxx1 xx1x2 2
2
x2 2 1 2
Example 4
1 3
A= 2 8
4 0
b= 5
9
(1 × 5) + (3 × 9)
32
Ab = (2 × 5) + (8 × 9) = 82
(4 × 5) + (0 × 9) 20
3
Example
Ax = d
A x d
6 3 1 x1 22
1 4 −2 x2 = 12
4 −1 5 x3 10
(3 × 3) (3 × 1) (3 × 1)
This produces
6x1 + 3x2 + x3 = 22
x1 + 4x2 − 2x3 = 12
4x1 − x2 + 5x3 = 10
1.1.1 National Income Model
y = c + I0 + G 0
C = a + bY
Arrange as
y − C = I0 + G0
−bY + C = a
Matrix form
A x =d
1 −1 Y
I
= o +a Go
−b 1 C
1.1.2 Division in Matrix Algebra
In ordinary algebra
a =c
b
is well defined iff b= 0.
Now 1b can be rewritten as b 1 , therefore ab 1 = c, also b 1a = c.
− − −
B 1 = B1
−
In some ways B −1
has the same properties as b −1
but in other ways it differs. We will explore these
differences later.
4
1.2 Linear Dependance
Ax = d
where A is a two column vectors
U1 U2
1 2
3 6
Or A is two row vector
V1 = [1 2]
V2 = [3 6]
Where column two is twice column one and/or row two is three times row one
2U1 = U2 or 3V1 = V2
Linear Dependence Generally:
A set of vectors is said to be linearly dependent iff any one of them can be expressed as a linear combination
of the remaining vectors.
Example:
Three vectors,
V1 = 27 V2 = 18 V3 = 45
are linearly dependent since
3V1 −2V2 = V3
6 2 4
21 − 16 = 5
or expressed as
3V1 − 2V2 − V3 = 0
General Rule
A set of vectors, V1, V2,..., Vn are linearly dependent if there exsists a set of scalars (i=1,. . . ,n). Not all
equal to zero, such that
n
= ki Vi = 0
i=1
Note n
5
1.3 Commutative, Associative, and Distributive Laws
AB = (1(3××10) + (2 × 6) (1 × −1) + (2 × 7)
12 13
0) + (4 × 6) (3 × −1) + (4 × 7) = 24 25
But
BA = (0)(1) − (1)(3) (0)(2) − (1)(4)
−3 −4
(6)(1) + (7)(3) (6)(2) + (7)(4) = 27 40
Therefore, we realize the distinction of post multiply and pre multiply. In the case
AB = C
B is pre multiplied by A, A is post multiplied by B.
6
1.3.4 Associative Law
Matrix multiplication is associative
(AB)C = A(BC ) = ABC
as long as their dimensions conform to our earlier rules of multiplication.
A × B × C
(m × n ) (n × p) (p × q)
1.3.5 Distributive Law
Matrix multiplication is distributive
A(B + C ) = AB + AC Pre multiplication
(B + C )A = BA + CA Post multiplication
1.4 Identity Matrices and Null Matrices
1 3 = (1 × 1) + (0 × 2) (1 × 3) + (0 × 4) = 1 3
IA = 10 01 2 4 (0 × 1) + (1 × 2) (0 × 3) + (1 × 4) 2 4
Example 2
Let A= 12 20 33
IA = 10 01 1 2 3 = 1 2 3 = A {I Case}
2 0 3 2 0 3 2
1 0 0
AI = 12 20 33 0 1 0 = 1 2 3 = A {I Case}
2 0 3 3
0 0 1
Furthermore,
AIB = (AI )B = A(IB) = AB
(m × n)(n × p) (m × n)(n × p)
7
1.4.2 Null Matrices
A null matrix is simply a matrix where all elements equal zero.
0 = 00 00 0 = 00 00 00
(2 × 2) (2 × 3)
The rules of scalar algebra apply to matrix algebra in this case.
Example
a + 0 = a ⇒ {scalar}
A + 0 = aa11 aa12 + 00 00 = A {matrix}
21 22
0
A × 0 = aa11 aa12 aa13 = 0 = 00 = 0
21 22 23
0
1.5 Idiosyncracies of matrix algebra
1) We know AB=BA
2)ab=0 implies a or b=0
In matrix
AB = 21 42
−24 0 0
1 −2 = 0 0
1.5.1 Transposes and Inverses
1)Transpose: is when the rows and columns are interchanged.
Transpose of A=A’or AT
Example
If A= 31 80 −49 and B= 31 47
3 1
A’= 8 0 and B’= 31 47
−9 4
Symmetrix Matrix
1 0 4 1 0 4
If A= 0 3 7 then A’= 0 3 7
4 7 2 4 7 2
A is a symmetric matrix.
8
then
x = ab or ba −1
In matrix algebra
if
Ax = d
then
x = A 1d −
2 −1 by factoring 1 is a scalar
A =
−1 1
0 3
6 6
Post Multiplication
2 −1 1 = 6 0 1 = 1 0
AA 1 = 30 12
−
0 3 6 0 6 6 0 1
Pre Multiplication
A A = 16 02 −31 30 12 = 16 60 06 = 10 01
−1
2) (AB) 1 = B 1 A 1
− − −
3) (A’) 1 = (A 1)1
− −
Example
Ax = d
9
1 −1813 −2616 −1310
6 3 1 x1 22
A= 1 4 −2 x = x2 d= 12 A 1 = 52
−
4 −1 5 x3 10 −17 18 21
then
18 −16 −10
x1 1 22 2
x2 = −13 26 13 12 = 3
x3 52 −17 18 21 10 1
x1 = 2 x2 = 3 x3 = 1
∗ ∗ ∗
where k is unique
any k= 0 implies linear independence
Example 1
A= 31 25
|A| = (3 × 5) − (1 × 2) = 13 {Non-singular}
Example 2
B= 28 246
|B| = (2 × 24) − (6 × 8) = 0 {Singular}
Three by three case
10
a1 a2 a3
Given A= b1 b2 b3
c1 c2 c3
then
|A| = (a b c ) + (a b c ) + (b c a ) − (a b c ) − (a b c ) − (b c a )
1 2 3 2 3 1 1 2 3 3 2 1 2 1 3 3 2 1
Cross-diagonals
a1 a2 a3
b1 b2 b3
c1 c2 c3
Use viso to display cross diagonals
Multiple along the diagonals and add up their products
⇒The product along the BLUE lines are given a positive sign
⇒The product of the RED lines are negative.
2.1 Using Laplace expansion
⇒ The cross diagonal method does not work for matrices greater than three by three
⇒ Laplace expansion evaluates the determinant of a matrix, A, by means of subdeterminants of A.
Subdeterminants
or Minors
a1 a2 a3
Given A= b1 b2 b3
c1 c2 c3
By deleting the first row and first column, we get
|M11| = cb22 cb33
The determinant of this matrix is the minor element a1 .
|Mij | ≡ is the subdeterminant from deleting the i-th row and the j-th column.
a1 a2 a3
Given A= b1 b2 b3
c1 c2 c3
then
M21 ≡ aa12 aa13 M31≡
a12 a13
a22 a23
32 33
2.1.1 Cofactors
A cofactor is a minor with a specific algebraic sign.
Cij = (−1)i+j |Mij |
therefore
C11 = (−1)2 |M11 | = |M11|
11
|A| = a |C | + a |C | + a |C | =
ai |Ci |
3
11 11 21 21 31 31 1 1
i=1
|A|
= a11 a22 a23
−
a21 a12 a13 a12 a13
a32 a33 + a31 a22 a23
a32 a33
Laplace expansion can be used to expand along any row or any column.
Example
Third row
|A| = a
a12 a13
−a
a11 a13 + a a11 a12
31
a22 a23 32
a21 a23 33 a21 a22
Example
8 1 3
A= 4 0 1
6 0 3
(1)Expand the first column
|A |
= 8 0 1
−
4 1 3 + 6 1 3
0 3 0 3 0 1
|A| = (8 × 0) − (4 × 3) + (6 × 1) = −6
(2)Expand the second column
|A| = −
1 4 1 + 0 8 3
−
0 8 3
6 3 6 3 4 1
Definition
The rank of a matrix is the maximum number linearly independent rows in the matrix.
If A is an m×n matrix, then the rank of A is
r(A) ≤ min [m, n]
Read as: the rank of A is less than or equal to the minimum of m or n.
Using Determinants to Find the Rank
(1) If A is n×m and |A|=0
(2) Then delete one row and one column, and find the determinant of this new (n-1)×(n-1) matrix.
(3) Continue this process until you have a non-zero determinant.
12
3 Matrix Inversion
Given an n×n matrix, A, the inverse of A is
A 1 = |A1 | • AdjA
−
where AdjA is the adjoint matrix of A. AdjA is the transpose of matrix A’s cofactor matrix. It is also
the adjoint, which is an n×n matrix
Cofactor Matrix (denoted C)
The cofactor matrix of A is a matrix who’s elements are the cofactors of the elements of A
If A = aa11 aa12
then C = | C | |C | = a − a
| C | |C | −a a
11 12 22 21
21 22 21 22 12 11
Example
3 2
Let A= 1 0 ⇒ |A|=-2
Step 1: Find the cofactor matrix
C= |C | |C | = 0 − 1
|C | |C | −2 3
11 12
21 22
2 2
Step 4: Check by AA = I
−1
4 Cramer’s Rule
Suppose:
Equation 1 a1 x1 + a2x2 = d1
Equation 2 b1 x1 + b2 x2 = d2
or
A x = d
a1 a2 x1 = d1
b1 b2 x2 d2
where
A = a1b2 − a2b1 = 0
Solve for x1 by substitution
From equation 1
x2 = d1 −a a1x1
2
13
and equation 2
x2 = d2 −b b1x1
2
therefore:
d1 − a1x1 = d2 − b1x1
a2 b2
Cross multiply
d1b2 − a1b2x1 = d2 a2 − b1a2x1
Collect terms
d1 b2 − d2a2 = (a1 b2 − b1a2)x1
x1 = da1bb2 −− db 2aa2
1 2 1 2
Equation 2 Qs = P − 2 Or − Q+P =2
Matrix form
A x = d
1 1 Q 10
−1 1 P =
2
| A
| = (1)(1) − (−1)(1) = 2
Find Qe
10 1
Qe =
2 1 10 − 2
= =4
2 2
14
Find Pe
1 10
Pe = −1
2
2
=
2 − (−10)
2
=6
10 − 6 = 4
C = a + bY Or bY + c = a −
In matrix form 1 −1 Y = I0 + G0
− b 1 C a
Solve for Ye
I0 + G 0
1 −
Y e = a1 1 1 = I0 +1 G0b+ a
− −
b 1 −
Solve for Ce
1 I0 + G0
Ce =
−
b a
=
a + b(I0 + G0)
1 −1
1− b
− b 1
15