Matrix Algebra - Phil Dybvig Home

Download Report

Transcript Matrix Algebra - Phil Dybvig Home

Fin500J Mathematical Foundations in Finance
Topic 1: Matrix Algebra
Philip H. Dybvig
Reference: Mathematics for Economists, Carl Simon and Lawrence Blume, Chapter 8 Chapter 9
and Chapter 16
Slides designed by Yajun Wang
Fin500J Topic 1
Fall 2010 Olin Business School
1
Outline
 Definition of a Matrix
 Operations of Matrices
 Determinants
 Inverse of a Matrix
 Linear System
 Matrix Definiteness
Fin500J Topic 1
Fall 2010 Olin Business School
2
Matrix (Basic Definitions)
An k × n matrix A is a rectangular array of numbers with k rows and n
columns. (Rows are horizontal and columns are vertical.) The numbers k and n
are the dimensions of A. The numbers in the matrix are called its entries. The
entry in row i and column j is called aij .
 a11 , , a1n 


 a21 , , a2 n 
A
 Aij




 a , , a 
kn 
 k1
Fin500J Topic 1
Fall 2010 Olin Business School
3
Operations with Matrices (Sum, Difference)
Sum, Difference
If A and B have the same dimensions, then their sum, A + B, is obtained by
adding corresponding entries. In symbols, (A + B)ij = aij + bij . If A and B
have the same dimensions, then their difference, A − B, is obtained by
subtracting corresponding entries. In symbols, (A - B)ij = aij - bij .
Example:
 3 4 1   1 0 7   2 4 8

 6 7 0

 6 5 1

12 12 1 


 
 

T hemat rix0 whose ent riesare all zero.T hen,for all A
A0  A
Fin500J Topic 1
Fall 2010 Olin Business School
4
Operations with Matrices (Scalar Multiple)
Scalar Multiple
If A is a matrix and r is a number (sometimes called a scalar in this
context), then the scalar multiple, rA, is obtained by multiplying every
entry in A by r. In symbols, (rA)ij = raij .
Example:
3 4 1   6 8 2
2
 6 7 0

12 14 0 


 

Fin500J Topic 1
Fall 2010 Olin Business School
5
Operations with Matrices (Product)
Product
If A has dimensions k × m and B has dimensions m × n, then the product
AB is defined, and has dimensions k × n. The entry (AB)ij is obtained
by multiplying row i of A by column j of B, which is done by multiplying
corresponding entries together and then adding the results i.e.,
( ai1 ai 2
 b1 j

 b2 j
... aim )
 
b
 mj



  ai1b1 j  ai 2b2 j  ...  aimbmj .



Exam ple
a b 
 aA  bC aB  bD 

 A B  



c
d
.

cA

dC
cB

dD



 
 e f   C D   eA  fC eB  fD 




1 0  0 


0
1

0


Ident it ym at rixI  
for any m  n m at rixA, AI  A and for
   


 0 0 1 

 nn
any n  m m at rixB, IB  B.
Fin500J Topic 1
Fall 2010 Olin Business School
6
Laws of Matrix Algebra
 The matrix addition, subtraction, scalar multiplication and matrix
multiplication, have the following properties.
Associat ive Laws :
A  (B  C)  (A  B)  C, (AB)C  A(BC).
Commutative Law for Addit ion:
A  B  B  A
Dist ributive Laws :
A(B  C)  AB  AC, (A  B)C  AC  BC.
Fin500J Topic 1
Fall 2010 Olin Business School
7
Operations with Matrices (Transpose)
Transpose
The transpose, AT , of a matrix A is the matrix obtained from A by
writing its rows as columns. If A is an k×n matrix and B = AT then
B is the n×k matrix with bij = aji. If AT=A, then A is symmetric.
Example:
 a11 a21 
T


a
a
a
 11 12 13 

   a12 a22 
a
a
a
 21 22 23 
a a 
 13 23 
It it easy t overify:
(A  B)T  AT  B T , (A  B)T  AT  B T ,
(AT )T  A, (rA)T  rAT
where A and B are k  n and r is a scalar.
Let C be a k  m mat rixand D be an m  n mat rix.T hen,
(CD)T  D T C T ,
Fin500J Topic 1
Fall 2010 Olin Business School
8
Determinants
 Determinant is a scalar
 Defined for a square matrix
 Is the sum of selected products of the elements of the matrix, each
product being multiplied by +1 or -1
det( A) 
a11 a12
a21 a22
a1n
a2 n
n
j 1
an1 an 2
n
  aij (1) M ij   aij (1)i j M ij
i j
i 1
ann
• Mij=det(Aij), Aij is the (n-1)×(n-1)
submatrix obtained by deleting row
i and column j from A.
Fin500J Topic 1
Fall 2010 Olin Business School
9
Determinants
a b
 ad  bc
 The determinant of a 2 ×2 matrix A is det(A) 
c d
 The determinant of a 3 ×3 matrix is
a11 a12 a13
11
a21 a22 a23  a11 (1)
a31 a32 a33
a22 a23
a32 a33
12
 a12 (1)
a21 a23
a31 a33
13
 a13 (1)
a21 a22
a31 a32
 Example
1 2 3
5 6
4 6
4 5
4 5 6  1(1)11
 2(1)12
 3(1)13
8 10
7 10
7 8
7 8 10
 50  48  2(40  42)  3(32  35)  3
• In Matlab: det(A) = det(A)
Fin500J Topic 1
Fall 2010 Olin Business School
10
Inverse of a Matrix
 Definition. If A is a square matrix, i.e., A has dimensions n×n. Matrix
A is nonsingular or invertible if there exists a matrix B such that
AB=BA=In. For example.
2
1   3
1

 

1
2

 1

3
1  2 1
1 1
   
  
3  3 3
3 3  1 0 


1   2 2 1 2   0 1
 
  
3   3 3 3 3
 Common notation for the inverse of a matrix A is A-1
 The inverse matrix A-1 is unique when it exists.
 If A is invertible, A-1 is also invertible  A is the inverse matrix of A-1.
(A-1)-1=A.
• Matrix division:
 If A is an invertible matrix, then (AT)-1 = (A-1)T
A/B = AB-1
• In Matlab: A-1 = inv(A)
Fin500J Topic 1
Fall 2010 Olin Business School
11
Calculation of Inversion using Determinants
Def: For any n×n matrix A, let Cij denote the (i,j) th cofactor of A, that is, (-1)i+j
times the determinant of the submatrix obtained by deleting row i and column j
form A, i.e., Cij = (-1)i+j Mij . The n×n matrix whose (i,j)th entry is Cji, the (j,i)th
cofactor of A is called the adjoint of A and is written adj A.
Thm: Let A be a nonsingular matrix. Then,
1
A-1 
adj A.
det A
thus
Fin500J Topic 1
Fall 2010 Olin Business School
12
Calculation of Inversion using Determinants
2 4 5
Example: find the inverse of the matrix


A  0 3 0
1 0 1
Solve:


C11  
3
0
0
1
C21  
4
5
0
1
4
5
3
0
C31  
 3, C12  
0
0
1
 4, C22  
1
2
5
1
 15, C32  
 0, C13  
1
0
3
1
0
 3, C23  
2
5
0
0
 0, C33  
 3,
2
4
1
0
2
4
0
3
 4,
 6,
det A  9,
C31   3
4 15 
 

C22 C32    0
3
0 .

C23 C33 
4
6 
  3

4 15  thus
 3
Using Determinants to find the
1

  0
3
0 .
inverse of a matrix can be very
9

4
6 
 3
complicated. Gaussian elimination is
 C11

adjA   C12
C
 13
So,
A1
C21
more efficient for high dimension matrix.
Fin500J Topic 1
Fall 2010 Olin Business School
13
Calculation of Inversion using Gaussian Elimination
 Elementary row operations:
o Interchange two rows of a matrix
o Change a row by adding to it a multiple of another row
o Multiply each element in a row by the same nonzero number
•
To calculate the inverse of matrix A, we apply the elementary row
operations on the augmented matrix [A I] and reduce this matrix to the
form of [I B]
•
The right half of this augmented matrix B is the inverse of A
Fin500J Topic 1
Fall 2010 Olin Business School
14
Calculation of inversion using Gaussian elimination
 a11 ,  , a1n 


a
,

,
a

2n 
A   21
 


 a ,, a 
nn 
 n1
 a11 , , a1n 1 0  0 


 a , , a2 n 0 1 0 
[ A I ]   21



 a , , a 0 0  1 
nn
 n1

I is the identity matrix, and use Gaussian elimination to obtain a matrix of the form
1 0  0 b11 b12 b1n

 0 1 0 b21 b22  b2 n
 

 0 0 1 b b  b
n1 n 2
nn

The matrix
Fin500J Topic 1
 b11 b12  b1n

 b b  b2 n
B   21 22
   

b b b
nn
 n1 n 2














is then the matrix inverse of A
Fall 2010 Olin Business School
15
Example
1

A   12
3

1
2
4
 1 1 1 |1 0 0 


[ A | I ]  12 2  3 | 0 1 0 
3 4 1 | 0 0 1 


1 

3 
1 
(ii)+(-12)×(i), (iii)+(-3) ×(i), (iii)+(ii) ×(1/10)
1 | 1
0 0
1 1


0

10

15
|

12
1
0


 0 0  3.5 |  4.2 0.1 1 


The matrix
Fin500J Topic 1
3
1

0.4


35
7

3
  0.6  2

35 7

1
2
1.2



35
7











1

0


0


0
1
0
3
1 
 
35
7 
2
3 
0 |  0.6 
35 7 

1
2
1 | 1.2 
 
35
7
0 | 0.4
is then the matrix inverse of A
Fall 2010 Olin Business School
16
Systems of Equations in Matrix Form
The system of linear equations
a11 x1  a12 x2  a13 x3 
 a1n xn  b1
a21 x1  a22 x2  a23 x3 
 a2 n xn  b2
ak1 x1  ak 2 x2  ak 3 x3 
 akn xn  bk
can be rewritten as the matrix equation Ax=b, where
 a11

A
a
 k1
 x1 
 b1 
a1n 
 
 
x
b2 

2



 , x    , b   .
 
 
akn 
 xn 
 bk 
If an n×n matrix A is invertible, then it is nonsingular, and the
unique solution to the system of linear equations Ax=b is x=A-1b.
Fin500J Topic 1
Fall 2010 Olin Business School
17
Example: solve the linear system
4 x  y  2 z  4

5 x  2 y  z  4
 x  3z  3

Matrix Inversion
AX  db
4 1 2
x 
4
A   5 2 1  ; X   y  ; b   4 
1 0 3 
 z 
 3 
X  A1b
• In Matlab
>>x=inv(A)*b
or
>> x=A\b
 6 -3 -3
1
A -1   -14 10 6 
6
 -2 1 3 
x 
 6 -3 -3  4 
 y   1 -14 10 6   4 
  6
 
 z 
 -2 1 3   3 
x  1 2; y  1 3; z  5 6
Fin500J Topic 1
Fall 2010 Olin Business School
18
Matrix Operations in Matlab
>> A=[2 3; 1 1; 1 0]
A =
Sum
>> A+B1
ans =
2
3
3
4
1
1
1
2
1
0
3
4
>> B1=[1 1; 0 1; 2 4]
Difference
B1 =
>> A-B1
ans =
1
1
1
2
0
1
1
0
2
4
-1
-4
>> B2=[1 1 1; 1 0 2]
Product
B2 =
>> A*B2
ans =
1
1
1
5
2
8
1
0
2
2
1
3
1
1
1
Fin500J Topic 1
Fall 2010 Olin Business School
19
Matrix Operations in Matlab
transpose
>> C'
ans =
>> C=[1 1 1; 12 2 -3;
3 4 1]
C =
1
1
1
12
2
-3
3
4
1
determinant
1
12
3
1
2
4
1
-3
1
>> det(C)
ans =
35
>> inv(C)
inverse
Fin500J Topic 1
ans =
Fall 2010 Olin Business School
0.4000
0.0857
-0.1429
-0.6000
-0.0571
0.4286
1.2000
-0.0286
-0.2857
20
Positive Definite Matrix
Fin500J Topic 1
Fall 2010 Olin Business School
21
Negative Definite, Positive Semidefinite, Negative
Semidefinite, Indefinite Matrix
Let A be an N×N symmetric matrix, then A is
•
•
•
•
negative definite if and only if vTAv <0 for all v≠0 in RN
positive semidefinite if and only if vTAv ≥0 for all v≠0, in RN
negative semidefinite if and only if vTAv ≤0 for all v≠0, in
RN
indefinite if and only if vTAv >0 for some v in RN and <0 for
other v in RN
Fin500J Topic 1
Fall 2010 Olin Business School
22