Lecture Notes For Chapters 4 & 5: 1 Matrix Algebra
Lecture Notes For Chapters 4 & 5: 1 Matrix Algebra
Lecture Notes For Chapters 4 & 5: 1 Matrix Algebra
Kevin Wainwright
April 26, 2014
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
1
Matrix of Coe¢ cients Vector of Unknows Vector of Constants
In general
Matrix form
2 32 3 2 3
a11 a12 : : : a1n x1 d1
6 a21 a22 : : : a2n 7 6 x2 7 6 d2 7
6 . . . . ... 7 6 .. 7 = 6 . 7
4 .. ::: 54 . 5 4 .. 5
am1 am2 : : : amn xn dm
Matrix shorthand
Ax = d
Where:
A= coe¢ cient martrix or an array
x= vector of unknowns or an array
d= vector of constants or an array
Subscript notation
aij
is the coe¢ cient found in the i-th row (i=1,. . . ,m) and the j-th
column (j=1,. . . ,n)
2
1.1 Vectors as special matrices
The number of rows and the number of columns de…ne the DIMEN-
SION 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
x0 = [x1 ; x2 ; : : : ; xn ]
x = [4] is a scalar
Matrix Operators
If we have two matrices, A and B, then
A = B if f 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
3
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
2 3
ka11 ka12 : : : ka1n
6 ka21 ka22 : : : ka2n 7
kA = 64 ...
7
5
kam1 kam2 : : : kamn
Example
6 2
Let k=[3] and A=
4 5
then kA=
3 6 3 2 18 6
kA = =
3 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.
Example
A B = C
(1 3) (3 4) (1 4)
1row 3rows 1row
3cols 4cols 4cols
4
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 + a12 b21 (sum of row 1 times column 1)
c12 =a11 b12 + a12 b22 (sum of row 1 times column 2)
c21 =a21 b11 + a22 b21 (sum of row 2 times column 1)
c22 =a21 b12 + a22 b22 (sum of row 2 times column 2)
Example 2
1 2
3 2 = (3 1) +(2 3) (3 2) +(2 4) = 9 14
3 4
Example 3
3 2
2
3 2 1 415= (3 2) + (2 1) + (1 4) = [12]
4
12 is the inner product of two vectors.
Suppose
x1
x= then x0 = x1 x2
x2
5
therefore
x1
x0 x = x1 x2
x2
= x21 + x22
However
xx0 = 2 by 2 matrix
x1 x21 x1 x2
x1 x2 =
x2 x2 x1 x22
Example 4 2
3
1 3
A=42 85
4 0
5
b=
9
2 3 2 3
(1 5) + (3 9) 32
Ab = 4 (2 5) + (8 9) 5 = 4 82 5
(4 5) + (0 9) 20
Example
Ax = d
2 A 3 2 x3 2 d 3
6 3 1 x1 22
41 4 2 5 4 5
x2 = 4 12 5
4 1 5 x3 10
(3 3) (3 1) (3 1)
6
This produces
6x1 + 3x2 + x3 = 22
x1 + 4x2 2x3 = 12
4x1 x2 + 5x3 = 10
In ordinary algebra
a
=c
b
is well de…ned i¤ b6= 0.
Now 1b can be rewritten as b 1 ; therefore ab 1
= c; also b 1 a = c:
7
is well de…ned. BUT
1
AB 6= B 1 A
1
B is called the inverse of B
1 1
B 6=
B
In some ways B 1 has the same properties as b 1
but in other ways
it di¤ers. We will explore these di¤erences later.
a+b=b+a
commutative law of multiplication,
ab = ba
(a + b) + c = a + (b + c)
(ab)c = a(bc)
Distributive law
a(b + c) = ab + ac
In matrix algebra most, but not all, of these laws are true.
8
1.2.1 I) Communicative Law of Addition
A+B =B+A
Since we are adding individual elements and aij + bij = bij + aij for
all i and j.
IB 6= BA
Example 1
Let A be 2 3 and B be 3 2
A B = C whereas B A = C
(2 3) (3 2) (2 2) (3 2) (2 3) (3 3)
Example 2
1 2 0 1
Let A= and B=
3 4 6 7
(1 10) + (2 6) (1 1) + (2 7) 12 13
AB = =
(3 0) + (4 6) (3 1) + (4 7) 24 25
9
But
(0)(1) (1)(3) (0)(2) (1)(4) 3 4
BA = =
(6)(1) + (7)(3) (6)(2) + (7)(4) 27 40
10
1.3 Identity Matrices and Null Matrices
1 a=a 1=a
IA = AI = A
Example 1
1 3
Let A=
2 4
1 0 1 3 (1 1) + (0 2) (1 3) + (0 4) 1 3
IA = = =
0 1 2 4 (0 1) + (1 2) (0 3) + (1 4) 2 4
Example 2
1 2 3
Let A=
2 0 3
1 0 1 2 3 1 2 3
IA = = = A fI2 Caseg
0 1 2 0 3 2 0 3
11
2 3
1 0 0
1 2 3 40 1 05= 1 2 3
AI = = A fI3 Caseg
2 0 3 2 0 3
0 0 1
Furthermore,
0 0 0 0 0
0= 0=
0 0 0 0 0
(2 2) (2 3)
Example
a + 0 = a ) fscalarg
a11 a12 0 0
A+0= + =A fmatrixg
a21 a22 0 0
23
0
a11 a12 a13 0
A 0= =405= =0
a21 a22 a23 0
0
12
1.4 Idiosyncracies of matrix algebra
1) We know AB6=BA
2)ab=0 implies a or b=0
In matrix
2 4 2 4 0 0
AB = =
1 2 1 2 0 0
Example
3 8 9 3 4
If A= and B=
1 0 4 1 7
2 3
3 1
3 4
A’=4 8 0 5 and B’=
1 7
9 4
Symmetrix Matrix
2 3 2 3
1 0 4 1 0 4
If A=4 0 3 7 5 then A’=4 0 3 75
4 7 2 4 7 2
A is a symmetric matrix.
Properties of Transposes
1) (A0)0 = A
2) (A + B)0 = A0 + B0
3) (AB)0 = B0A0
13
In scalar algebra if
ax = b
then
b 1
x= or ba
a
In matrix algebra, if
Ax = d
then
x = A 1d
1
where A is the inverse of A.
Properties of Inverses
1) Not all matrices have inverses
non-singular: if there is an inverse
singular: if there is no inverse
2) A matrix must be square in order to have an inverse. (Necessary
but not si¢ cient)
3) In scalar algebra aa = 1; in matrix algebra AA 1 = A 1 A = I
4) If an inverse exists then it must be unique.
Example
1 1
3 1 1 3 6
Let A= and A = 1
0 2 0 2
1 2 1
1 1
A = 6 by factoring 6 is a scalar
0 3
Post Multiplication
1 3 1 2 1 1 6 0 1 1 0
AA = = =
0 2 0 3 6 0 6 6 0 1
14
Pre Multiplication
1 2 1 3 1 1 6 0 1 0
A 1A = = =
6 0 3 0 2 6 0 6 0 1
Further properties
If A and B are square and non-singular then:
1) (A 1 ) 1 = A
2) (AB) 1 = B 1 A 1
3) (A0) 1 = (A 1 )1
Solving a linear system
Suppose
A x = d
(3 3) (3 1) (3 1)
then
A 1 A x = A 1 d
(3 3) (3 3) (3 1) (3 3) (3 1)
I x = A 1 d
(3 3) (3 1) (3 3) (3 1)
x = A 1d
Example
2 3 2 Ax
3 =d 2 3 2 3
6 3 1 x1 22 18 16 10
1 4
A=41 4 2 5 x = 4 x2 5 d = 4 12 5 A 1
= 13 26 13 5
4 1 5 x3 10 52 17 18 21
then 2 3 2 32 3 2 3
x1 18 16 10 22 2
4 x2 5 = 1 4 13 26 13 5 4 12 5 = 4 3 5
x3 52 17 18 21 10 1
x1 = 2 x2 = 3 x3 = 1
15
1.5 Linear Dependence and Determinants
1: x1 + 2x2 = 1
2: 2x1 + 4x2 = 2
where equation two is twice equation one. Therefore, there is no
solution for x1 ; x2 :
In matrix form:
Ax = d
a11 a12
jAj = = a11 a22 a12 a21 = k
a21 a22
where k is unique
any k6= 0 implies linear independence
Example 1
16
3 2
A=
1 5
jAj = (3 5) (1 2) = 13 fNon-singularg
Example 2
2 6
B=
8 24
Three by three
2 case 3
a1 a2 a3
4
Given A= b1 b2 b3 5
c1 c2 c3
then
Cross-diagonals 2 3
a1 a2 a3
4 b1 b2 b3 5
c1 c2 c3
Use viso to display cross diagonals
17
1.6 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
2 or Minors
3
a1 a2 a3
Given A=4 b1 b2 b3 5
c1 c2 c3
By deleting the …rst row and …rst column, we get
b2 b3
jM11 j =
c2 c3
The determinant of this matrix is the minor element a1 .
jMij j is the subdeterminant from deleting the i-th row and the
j-th column.
2 3
a1 a2 a3
Given A=4 b1 b2 b3 5
c1 c2 c3
then
a12 a13 a12 a13
M21 M31
a32 a33 a22 a23
1.6.1 Cofactors
A cofactor is a minor with a speci…c algebraic sign.
Cij = ( 1)i+j jMij j
therefore
C11 = ( 1)2 jM11 j = jM11 j
C21 = ( 1)3 jM21 j = jM21 j
18
The determinant by Laplace Expanding down the …rst column
2 3
a11 a12 a13
A = 4 a21 a22 a23 5
a31 a32 a33
3
X
jAj = a11 jC11 j + a21 jC21 j + a31 jC31 j = ai1 jCi1 j
i=1
jAj = a11 [a22 a33 a23 a32 ] a21 [a12 a33 a13 a32 ] + a31 [a12 a23 a13 a22 ]
Example
2 3
8 1 3
A=44 0 15
6 0 3
(1)Expand the …rst column
0 1 1 3 1 3
jAj = 8 4 +6
0 3 0 3 0 1
19
jAj = (8 0) (4 3) + (6 1) = 6
(2) Expand the second column
4 1 8 3 8 3
jAj = 1 +0 0
6 3 6 3 4 1
1 1
A = AdjA
jAj
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
Example
3 2
Let A= ) jAj=-2
1 0
20
Step 1: Find the cofactor matrix
jC11 j jC12 j 0 1
C= =
jC21 j jC22 j 2 3
0 2
C T = AdjA =
1 3
1 1
Step 3: Multiply all the elements of AdjA by jAj to …nd A
1 1 1 0 2 0 1
A = AdjA = = 1 3
jAj 2 1 3 2 2
1
Step 4: Check by AA =I
Equation 1 a1 x1 + a2 x2 = d1
Equation 2 b1 x1 + b2 x2 = d2
or
A x = d
a1 a2 x1 d1
=
b1 b2 x2 d2
21
where
A = a1 b 2 a2 b1 6= 0
Solve for x1 by substitution
From equation 1
d1 a1 x1
x2 =
a2
and equation 2
d2 b1 x1
x2 =
b2
therefore:
d1 a1 x 1 d2 b1 x1
=
a2 b2
Cross multiply
d1 b2 a1 b2 x1 = d2 a2 b 1 a2 x 1
Collect terms
d1 b2 d2 a2 = (a1 b2 b1 a2 )x1
d1 b2 d2 a2
x1 =
a1 b2 b1 a2
The denominator is the determinant of jAj and the numerator is the
same as the denominator except d1 d2 replaces a1 b1 :
Cramer’s Rule
d1 a2
d2 b2 d1 b2 d 2 a2
x1 = =
a1 a2 a1 b2 b 1 a2
b1 b2
Where the d vector replaces column 1 in the A matrix
22
To …nd x2 replace column 2 with the d vector
a1 d1
b1 d2 a1 d2 d1 b1
x2 = =
a1 a2 a1 b2 b 1 a2
b1 b2
23
Substitute P and Q into either equation 1 or equation 2 to verify
Qd = 10 P
10 6 = 4
Y = C + I0 + G0 Or Y C = I0 + G0
C = a + bY Or bY + c = a
In matrix form
1 1 Y I0 + G0
=
b 1 C a
Solve for Y e
I0 + G0 1
a 1 I0 + G0 + a
Ye = =
1 1 1 b
b 1
Solve for C e
1 I0 + G0
b a a + b(I0 + G0 )
Ce = =
1 1 1 b
b 1
Numeric example:
Let C = 100 + 0:75Y; I = 150 and G = 250. Then the model is
Y C = I +G
Y C = 400
24
and
C = 100 + 0:75Y
0:75Y C = 100
In Matrix form
1 1 Y 400
=
0:75 1 C 100
Solve for Y e
400 1
100 1 500
Ye = = = 2000
1 1 0:25
0:75 1
Solve for C e
1 400
0:75 100 100 + 0:75(400)
Ce = = = 1600
1 1 0:25
0:75 1
25