You are on page 1of 23

Foundations in Calculus

and Probability
YU SHENG LOH
Matrix Algebra
What is a Matrix
A matrix is an array of values that is contained within rows and columns
Horizontal ‘rows’ and vertical ‘columns’
A matrix with 𝑚 rows and 𝑛 columns is an 𝑚 x 𝑛 matrix

𝑎!! 𝑎!" 𝑎!# 𝑎!$


𝑎"! 𝑎"" 𝑎"# ⋯ 𝑎"$
𝑎#! 𝑎#" 𝑎## 𝑎#$
⋮ ⋱ ⋮
𝑎%! 𝑎%" 𝑎%# ⋯ 𝑎%$
Operations of Matrices
Addition
𝑎 𝑏 𝑒 𝑓 𝑎+𝑒 𝑏+𝑓
+ =
𝑐 𝑑 𝑔 ℎ 𝑐+𝑔 𝑑+ℎ

Subtraction
𝑎 𝑏 𝑒 𝑓 𝑎−𝑒 𝑏−𝑓
− =
𝑐 𝑑 𝑔 ℎ 𝑐−𝑔 𝑑−ℎ
Multiplication of Matrices
By a scalar
𝑎 𝑏 2𝑎 2𝑏
2∗ =
𝑐 𝑑 2𝑐 2𝑑

if 2 columns need 2 raws


Between matrices
𝑎 𝑏 𝑒 𝑓 𝑎𝑒 + 𝑏𝑔 𝑎𝑓 + 𝑏ℎ
. =
𝑐 𝑑 𝑔 ℎ 𝑐𝑒 + 𝑑𝑔 𝑐𝑓 + 𝑑ℎ

Nb ligne 1 Nb Column 2

Must be 𝑚! x 𝑛 ' 𝑛 x 𝑚"


Identity Matrix
1 0
𝑰=
0 1

Any matrix 𝑨 multiplied by the Identity matrix returns itself


𝑨𝑰 = 𝑨

Verification
𝑎 𝑏 1 0 𝑎∗1+𝑏∗0 𝑎∗0+𝑏∗1
=
𝑐 𝑑 0 1 𝑐∗1+𝑑∗0 𝑐∗0+𝑑∗1
𝑎 𝑏
=
𝑐 𝑑
Determinant and Inverse of 2x2 Matrix
For a matrix 𝑨 = 𝑎 𝑏 , its determinant 𝑨 = 𝑎𝑑 − 𝑏𝑐
𝑐 𝑑
If the determinant is non-zero, then its inverse exists. Otherwise it is a singular matrix

Inverse of a 2x2 matrix


! 𝑑 −𝑏
𝑨!" = Pour résoudre une equation on multiplie l’inverse par le résultat
|𝑨| −𝑐 𝑎
𝑨𝑨!" = 𝑰
Determinant and Inverse of 2x2 Matrix
𝑎 𝑏 " 𝑑 −𝑏 " 𝑎𝑑 − 𝑏𝑐 0
𝑨𝑨!" = ∗ =
𝑐 𝑑 |𝑨| −𝑐 𝑎 %&!'( 0 𝑎𝑑 − 𝑏𝑐

%&!'( )
" 𝑎 𝑏 𝑑 −𝑏 %&!'( %&!'(
= = ) %&!'(
%&!'( 𝑐 𝑑 −𝑐 𝑎
%&!'( %&!'(

" 𝑎𝑑 − 𝑏𝑐 −𝑎𝑏 + 𝑏𝑎 1 0
= %&!'( =
𝑐𝑑 − 𝑑𝑐 −𝑐𝑏 + 𝑑𝑎 0 1

" 𝑎𝑑 − 𝑏𝑐 𝑎𝑏 − 𝑎𝑏
= =𝑰
%&!'( 𝑐𝑑 − 𝑐𝑑 𝑎𝑑 − 𝑏𝑐
Transpose
𝑎"" 𝑎"* 𝑎"+
For matrix 𝑨 = 𝑎*" 𝑎** 𝑎*+
𝑎+" 𝑎+* 𝑎++

𝑎"" 𝑎*" 𝑎+"


Its transpose 𝑨, = 𝑎"* 𝑎** 𝑎+*
𝑎"+ 𝑎*+ 𝑎++

In a transposed matrix, the original rows become columns and columns become rows
3x3 Matrix
𝑎"" 𝑎"* 𝑎"+
For matrix 𝑨 = 𝑎*" 𝑎** 𝑎*+
𝑎+" 𝑎+* 𝑎++
Its determinant 𝑨 = 𝑎"" 𝑎** 𝑎++ + 𝑎"* 𝑎*+ 𝑎+" + 𝑎"+ 𝑎*" 𝑎+* − 𝑎"" 𝑎*+ 𝑎+* − 𝑎"* 𝑎*" 𝑎++ − 𝑎"+ 𝑎** 𝑎+"

𝑎!! 𝑎!" 𝑎!# 𝑎!! 𝑎!" 𝑎!#


𝑎"! 𝑎"" 𝑎"# 𝑎"! 𝑎"" 𝑎"#
𝑎#! 𝑎#" 𝑎## 𝑎#! 𝑎#" 𝑎##
3x3 Matrix
𝑎"" 𝑎"* 𝑎"+
Cofactor matrix of 𝑨 = 𝑎*" 𝑎** 𝑎*+
𝑎+" 𝑎+* 𝑎++
𝑎** 𝑎*+ 𝑎*" 𝑎*+ 𝑎*" 𝑎**
𝑎+* 𝑎++ − 𝑎+" 𝑎++ 𝑎+" 𝑎+*
𝑎"* 𝑎"+ 𝑎"" 𝑎"+ 𝑎"" 𝑎"*
𝑪= − 𝑎 𝑎+" 𝑎++ −
+* 𝑎++ 𝑎+" 𝑎+*
𝑎"* 𝑎"+ 𝑎"" 𝑎"+ 𝑎"" 𝑎"*
𝑎** 𝑎*+ − 𝑎*" 𝑎*+ 𝑎*" 𝑎**
For each term in 𝑨, remove its associated row and column
The remaining values form the minor matrix to be used
Determinant determined from Cofactor matrix
Inverse of 3x3 Matrix
Adjugate Matrix
𝑎** 𝑎*+ 𝑎"* 𝑎"+ 𝑎"* 𝑎"+
𝑎+* 𝑎++ − 𝑎 𝑎++ 𝑎** 𝑎*+
+*
,
𝑎*" 𝑎*+ 𝑎"" 𝑎"+ 𝑎"" 𝑎"+
𝐴𝑑𝑗 𝑨 = 𝑪 = − 𝑎 𝑎++ 𝑎+" 𝑎++ − 𝑎 𝑎*+
+" *"
𝑎*" 𝑎** 𝑎"" 𝑎"* 𝑎"" 𝑎"*
𝑎+" 𝑎+* − 𝑎 𝑎+* 𝑎*" 𝑎**
+"

"
𝑨!" = 𝑪,
|𝑨|
Inverse of 3x3 Matrix Using Gaussian
Elimination
1 0 1
Linear row reduction of 2 1 1
0 1 3
Start with
1 0 11 0 0
2 1 10 1 0
0 1 30 0 1

The aim is to reduce the left-hand side to an identity matrix


The matrix on the right will then give you the inverse
Inverse of 3x3 Matrix Using Gaussian
Elimination
r2 – r1
1 0 1 1 0 0
1 1 0 −1 1 0
0 1 3 0 0 1
r3 – r2
1 0 1 1 0 0
1 1 0 −1 1 0
−1 0 3 1 −1 1
r3 + r1
1 0 1 1 0 0
1 1 0 −1 1 0
0 0 4 2 −1 1
Inverse of 3x3 Matrix Using Gaussian
Elimination
r4 / 4
1 0 1 1 0 0
1 1 0 −1 1 0
0 0 1 0.5 −0.25 0.25
r1 – r3
1 0 0 0.5 0.25 −0.25
1 1 0 −1 1 0
0 0 1 0.5 −0.25 0.25
r2 –r1
1 0 0 0.5 0.25 −0.25
0 1 0 −1.5 0.75 0.25
0 0 1 0.5 −0.25 0.25
Inverse of 3x3 Matrix Using Gaussian
Elimination
Verify 𝑩𝑩(! = 𝑰

1 0 1 0.5 0.25 −0.25 0.5 + 0.5 0.25 − 0.25 −0.25 + 0.25


2 1 1 −1.5 0.75 0.25 = 1 − 1.5 + 0.5 0.5 + 0.75 − 0.25 −0.5 + 0.25 + 0.25
0 1 3 0.5 −0.25 0.25 −1.5 + 1.5 0.75 − 0.75 0.25 + 0.75
1 0 0
= 0 1 0
0 0 1
=𝑰
System of Linear Equations
Matrices useful for solving linear equations
Example:
𝑥" − 𝑥* + 𝑥+ = 1
2𝑥" + 3𝑥* + 𝑥+ = 10
3𝑥" + 2𝑥* − 4𝑥+ = 3

This can be rewritten into:


1 −1 1 𝑥" 1
2 3 1 𝑥* = 10
3 2 −4 𝑥+ 3
Solving System of Linear Equations
Find inverse
!"
1 −1 1 0.4667 0.0667 0.1333
2 3 1 = −0.3667 0.2333 −0.0333
3 2 −4 0.1667 0.1667 −0.1667
Multiply it to both sides
1 −1 1 !"
1 −1 1 𝑥" 0.4667 0.0667 0.1333 1
2 3 1 2 3 1 𝑥* = −0.3667 0.2333 −0.0333 10
3 2 −4 3 2 −4 𝑥+ 0.1667 0.1667 −0.1667 3
𝑥" 0.4667 0.0667 0.1333 1
𝑥* = −0.3667 0.2333 −0.0333 10
𝑥+ 0.1667 0.1667 −0.1667 3
𝑥" 1.5333
𝑥* = 1.8667
𝑥+ 1.3333
Eigen Decomposition
Linear transformation of a matrix 𝑨 such that
𝑨𝒗 = 𝜆𝒗

𝑣"
Where 𝒗 = 𝑣 is the eigenvector of matrix 𝑨 and 𝜆 is its associated eigenvalue, which is a scalar
*

We are then able to rewrite the equation as


𝑨 − 𝝀𝑰 𝒗 = 𝟎

In order to solve for the eigenvalues and eigenvectors we use the following relationship
𝑨 − 𝜆𝑰 = 0
Eigen Decomposition
Example: 𝑨 = 2 1
1 2
2 1 1 0
− 𝜆 =0
1 2 0 1
2−𝜆 1
=0
1 2−𝜆
(2 − 𝜆)* −1 = 0
𝜆* − 4𝜆 + 3 = 0
𝜆−3 𝜆−1 =0

𝜆 = 1 𝑜𝑟 3
Eigen Decomposition
Next, we find 𝒗
𝑨 − 𝝀𝑰 𝒗 = 𝟎
2 1 1 0
𝑨 − 𝝀𝑰 = −𝜆
1 2 0 1
2−𝜆 1
=
1 2−𝜆

For 𝜆 = 1 For 𝜆 = 3

1 1 −1 1 1 1
𝑨 − 𝝀𝑰 = 𝑨 − 𝝀𝑰 = 𝒗!"# = , 𝒗!"$ =
1 1 1 −1 −1 1

𝑣# + 𝑣% = 0 𝑣# − 𝑣% = 0

Setting 𝑣# = 1, 𝑣% = −1 Setting 𝑣# = 1, 𝑣% = 1
Example in Finance
Optimisation of portfolio
Portfolio return
𝜇)
𝑤) 𝑤* 𝑤+ ' 𝜇* = 𝜇,
𝜇+
Portfolio variance
𝜎)" 𝜎)* 𝜎)+ 𝑤)
𝑤) 𝑤* 𝑤+ 𝜎)* 𝜎*" 𝜎*+ 𝑤* = 𝜎,"
𝜎)+ 𝜎*+ 𝜎+" 𝑤+

Subject to 𝒘- 𝟏 = 1
Practice Questions
1 3
6 2 3
1. Find the solution to 4 1
1 4 2
2 7

2 1 2
2. Find the inverse of 1 2 1
3 2 0

3 2
3. Find the eigenvalues and eigenvectors of
1 2

You might also like