Week 3 - Maths
Week 3 - Maths
Matrices are used to describe linear equations. They can be added, multiplied, and
decomposed in various ways, which also makes them a key concept in the field of
linear algebra.
Element/Component of matrix 𝐴
𝑎11 𝑎12 𝑎13 𝑎14 ⋯ 𝑎1𝑛
𝑎21 𝑎22 𝑎23 𝑎24 ⋯ 𝑎2𝑛
𝑨=[ ⋮ ⋮ ⋮ ⋮ ⋯ ⋮ ] Size/Dimension of matrix 𝐴
𝑎𝑚1 𝑎𝑚2 𝑎𝑚3 𝑎𝑚4 ⋯ 𝑎𝑚𝑛 𝑚×𝑛
Page 1 of 16
Example: 1
2 4 5 3
𝐴 = [1 2 0 −1]
0 2 5 7 3×4
This matrix has 3 rows (Horizontal lines) and 4 columns (Vertical lines) and thus
it is called 3 × 4, read as a “3 by 4 matrix”. The first number 3 indicates the number
of rows and the second number 4 indicates the number of columns.
Vector: A matrix which consists of only 1 row or 1 column. Thus, there are types
of vectors – Row vector (1 row) and Column vector (1 column).
𝑥1
𝑥2
𝑪𝒐𝒍𝒖𝒎𝒏 𝑽𝒆𝒄𝒕𝒐𝒓: 𝐴𝑛𝑦 𝑚 × 1 𝑚𝑎𝑡𝑟𝑖𝑥 − [ ⋮ ]
𝑥𝑚
Square matrix: Any matrix with the same number of rows and columns.
Identity matrix: A square matrix, where all primary diagonal elements are 1,
and off-diagonal elements (all other elements) are 0. The Identity Matrix is
generally denoted by 𝑰.
1 0
𝑰2×2 = [ ]
0 1
1 0 0 0
𝑰4×4 = [0 1 0 0]
0 0 1 0
0 0 0 1
Primary/Main Diagonal
Diagonal matrix: A square matrix in which the elements outside the main
diagonal (off-diagonal elements) are all zero. The diagonal elements themselves
Page 2 of 16
can be any number, in contrast to the Identity Matrix, where they are equal to
one.
1 0 0
𝑫 = [0 4 0]
0 0 −3 3×3
Zero (Null) matrix: A matrix composed of all zeros, and can be of any dimension.
It is necessarily a square matrix. Addition or subtraction of a null matrix leaves
the original matrix unchanged; multiplication by a null matrix produces another
null matrix.
0 0 0
𝑵 = [0 0 0]
0 0 0 3×3
1 4
1 2 3
If 𝑨2×3 = [ ] then 𝑨′ 3×2 = [2 5]
4 5 6
3 6
Properties of a Transpose
(𝑨′ )′ = 𝑨
(𝑨 + 𝑩)′ = 𝑨′ + 𝑩′
(𝑨𝑩)′ = 𝑩′ . 𝑨′
𝑨 = 𝑨𝑻
𝒂𝒊𝒋 = 𝒂𝒋𝒊
Page 3 of 16
The following 3 × 3 matrix is symmetric:
𝟏 𝟐 𝟑
𝑨 = 𝑨𝑻 = [𝟐 𝟒 −𝟓]
𝟑 −𝟓 𝟔 𝟑×𝟑
Two matrices 𝑨 and 𝑩 are equal only if they have the same dimensions (number
of rows and columns), and each element in 𝑨 is identical to the corresponding
element in 𝑩.
𝒂𝒊𝒋 = 𝒃𝒊𝒋 𝑓𝑜𝑟 𝑎𝑙𝑙 𝒊, 𝒋
1 2 4 3
𝑨=[ ] 𝑩=[ ] 𝑨 ≠ 𝑩 (Different elements)
3 4 2 1
1 2 3
1 2
𝑨=[ ] 𝑩 = [4 5 6] 𝑨 ≠ 𝑩 (Different dimensions)
3 4
7 8 9
1 2 1 2
𝑨=[ ] 𝑩=[ ] 𝑨 = 𝑩 (Same elements and dimensions)
3 4 3 4
a) Matrix Addition
Example: 2
4 9 2 0
𝑨=[ ] ,𝑩 = [ ]
2 1 2×2 0 7 2×2
4 9 2 0 4+2 9+0 6 9
Then, 𝑨 + 𝑩 = [ ]+[ ]=[ ]=[ ]
2 1 0 7 2+0 1+7 2 8
Page 4 of 16
Laws of Matrix Addition
Commutative Law: 𝑨 + 𝑩 = 𝑩 + 𝑨
Associative Law: 𝑨 + (𝑩 + 𝑪) = (𝑨 + 𝑩) + 𝑪
b) Matrix Subtraction
𝑨 − 𝑩 = 𝑨 + (−𝑩)
Example: 3
1 2 2 −3
𝑨=[ ] ,𝑩 = [ ]
0 −1 2×2 −1 7 2×2
1 2 2 −3 1−2 2 − (−3) −1 5
Then, 𝑨 − 𝑩 = [ ]−[ ]=[ ]=[ ]
0 −1 −1 7 0 − (−1) −1 − 7 1 −8
c) Matrix Multiplication
𝒌. 𝑨 = [𝒌. 𝒂𝒊𝒋 ]
𝒎×𝒏
Example: 4
1 2 4 8
𝑨=[ ] , 𝑘 = 4, Then, 𝑘. 𝐴 = [ ]
0 −1 2×2 0 −4 2×2
Page 5 of 16
Matrix Multiplication
𝑨. 𝑩 = [𝒂𝟏 𝒃𝟏 + 𝒂𝟐 𝒃𝟐 + ⋯ ⋯ 𝒂𝒏 𝒃𝒏 ]𝟏×𝟏
Example: 5
4
𝑨 = [1 2 3]1×3 , 𝑩 = [5]
6 3×1
The resulting matrix is the matrix whose elements are the products of the
𝒊𝒕𝒉 row of 𝑨 and 𝒋𝒕𝒉 column of 𝑩.
No of
Dimension of the resulting matrix columns
in B
Page 6 of 16
Example: 6
2 4 5 6 1
𝑨=[ ] ,𝑩 = [ ]
3 1 2×2 7 8 3 2×3
[2 4] [5] [2 6 1
4] [ ] [2 4] [ ]
𝑨. 𝑩 = [ 7 8 3]
[3 1] [5] [3 6 1
1] [ ] [3 1] [ ]
7 8 3
10 + 28 12 + 32 2 + 12
𝑨. 𝑩 = [ ]
15 + 7 18 + 8 3+3
38 44 14
𝑨. 𝑩 = [ ]
22 26 6 2×3
a) Determinant of a matrix
Then, the scalar 𝑴𝒊𝒋 = |𝑨𝒊𝒋 | = 𝐝𝐞𝐭 𝑨𝒊𝒋 is called (𝒊𝒋)𝒕𝒉 minor of the element 𝒂𝒊𝒋 of
matrix 𝑨.
Page 7 of 16
Cofactor: It is a scalar 𝑪𝒊𝒋 is called the (𝒊𝒋)𝒕𝒉 cofactor of the element 𝒂𝒊𝒋 of
matrix 𝑨. It is the minor with a specified sign (signed minor).
Determinant of a 𝟐 × 𝟐 Matrix
𝒂𝟏𝟏 𝒂𝟏𝟐
𝑨 = [𝒂 𝒂𝟐𝟐 ]
𝟐𝟏
Set of Minors
𝒂𝟏𝟏 𝒂𝟏𝟐
𝑴𝟏𝟏 = |𝒂
𝟐𝟏 𝒂𝟐𝟐 | = |𝒂𝟐𝟐 |
Similarly
𝑴𝟏𝟐 = |𝒂𝟐𝟏 |
𝑴𝟐𝟏 = |𝒂𝟏𝟐 |
𝑴𝟐𝟐 = |𝒂𝟏𝟏 |
Set of Cofactors
Row one: 𝑹𝟏 = 𝒂𝟏𝟏 ∙ 𝑪𝟏𝟏 + 𝒂𝟏𝟐 ∙ 𝑪𝟏𝟐 = 𝒂𝟏𝟏 ∙ 𝒂𝟐𝟐 − 𝒂𝟏𝟐 ∙ 𝒂𝟐𝟏
Row two: 𝑹𝟐 = 𝒂𝟐𝟏 ∙ 𝑪𝟐𝟏 + 𝒂𝟐𝟐 ∙ 𝑪𝟐𝟐 = −𝒂𝟐𝟏 ∙ 𝒂𝟏𝟐 + 𝒂𝟐𝟐 ∙ 𝒂𝟏𝟏
Page 8 of 16
Example: 7
1 2
𝑨=[ ]
3 4
𝒂𝟏𝟏 𝒂𝟏𝟐
𝑨 = [𝒂 𝒂𝟐𝟐 ]
𝟐𝟏
Example: 8
−1 −4
𝑨=[ ]
5 57
Determinant of a 𝟑 × 𝟑 Matrix
Page 9 of 16
Next, find the cofactors
|𝑨| = 𝒂𝟏𝟏 (𝒂𝟐𝟐 𝒂𝟑𝟑 − 𝒂𝟐𝟑 𝒂𝟑𝟐 ) − 𝒂𝟐𝟐 (𝒂𝟐𝟏 𝒂𝟑𝟑 − 𝒂𝟐𝟑 𝒂𝟑𝟏 ) − 𝒂𝟏𝟑 (𝒂𝟐𝟏 𝒂𝟑𝟐 − 𝒂𝟐𝟐 𝒂𝟑𝟏 )
Example: 9
3 2 5
𝑨 = [ 3 4 1]
5 6 1
Page 10 of 16
b) Inverse of a Matrix
Let, 𝑨(𝒌,𝒌) be a non-singular matrix. Then there exists a unique matrix, call it
𝑩(𝒌,𝒌) , such that
𝑨𝑩 = 𝑩𝑨 = 𝑰(𝒌,𝒌)
𝟏
𝑨−𝟏 = 𝒂𝒅𝒋𝑨
𝑨
Example: 10
1 2
𝑨=[ ]
3 4
(−1)1+1 ∙ 4 (−1)1+2 ∙ 2 4 −2
𝑪=[ ]=[ ]
(−1)2+1 ∙ 3 (−1)2+2 ∙ 1 −3 1
4 −2
𝒂𝒅𝒋𝑨 = 𝑪𝑻 = [ ]
−3 1
Page 11 of 16
𝟏
𝑨−𝟏 = 𝒂𝒅𝒋𝑨, 𝒅𝒆𝒕𝑨 = −𝟐
𝑨
1 4 −2
𝑨−1 =− ∙[ ]=
2 −3 1
−2 1
[ ]
3⁄2 −1⁄2
Of course, if 𝑨−𝟏 really is the inverse of 𝑨, then 𝑨 𝑨−𝟏 and 𝑨−𝟏 𝑨 should
multiply out to give 𝑰(Identity matrix). Checking this condition:
−2 1 1 2 1 0
𝑨−1 𝑨 = [ ]∙[ ]=[ ]
3⁄2 −1⁄2 3 4 0 1
1 2 −2 1 1 0
𝑨 𝑨−1 = [ ]∙[ ]=[ ]
3 4 3⁄2 −1⁄2 0 1
Example: 11
9 1 5
𝑨 = [1 2 3]
5 3 4
𝑨𝒅𝒋 𝑨 = 𝑪𝑻
𝟐 𝟑
𝐶𝟏𝟏 = (−𝟏)(𝟏+𝟏) ∙ | | = 1 × (8 − 9) = −1
𝟑 𝟒
(𝟏+2) 1 3
𝐶𝟏2 = (−𝟏) ∙| | = −1 × (4 − 15) = 11
5 4
(1+3) 1 2
𝐶𝟏3 = (−1) ∙| | = 1 × (3 − 10) = −7
5 3
(2+1) 1 5
𝐶21 = (−1) ∙| | = −1 × (4 − 15) = 11
3 4
(2+2) 9 5
𝐶22 = (−1) ∙| | = 1 × (36 − 25) = 11
5 4
(2+3) 9 1
𝐶23 = (−1) ∙| | = −1 × (27 − 5) = −22
5 3
(3+1) 1 5
𝐶31 = (−1) ∙| | = 1 × (3 − 10) = −7
2 3
(3+2) 9 5
𝐶32 = (−1) ∙| | = −1 × (27 − 5) = −22
1 3
Page 12 of 16
9 1
𝐶33 = (−1)(3+3) ∙ | | = 1 × (18 − 1) = 17
1 2
−𝟏 𝟏𝟏 −𝟕 −𝟏 𝟏𝟏 −𝟕
𝑪 = [ 𝟏𝟏 𝟏𝟏 −𝟐𝟐] → 𝑪𝑻 = [ 𝟏𝟏 𝟏𝟏 −𝟐𝟐]
−𝟕 −𝟐𝟐 𝟏𝟕 −𝟕 −𝟐𝟐 𝟏𝟕
You can multiply this answer (𝑨−𝟏 ) by 𝑨 and see whether you get the identity
matrix.
`` Example: 12
2 5
𝑩=[ ]
4 10
2 5
det 𝑩 = | | = (2 × 10) − (5 × 4) = 0
4 10
We see that det 𝑩 = 0 so this matrix is singular and the inverse does not
exist.
Properties of an Inverse
𝑨−𝑘 = (𝐴−1 )𝑘
(𝐴−1 )−1 = 𝑨
1
(𝑘 ∙ 𝑨)−1 = 𝐴−1 𝑓𝑜𝑟 𝑘 ≠ 0
𝑘
𝑎21 𝑥1 + 𝑎22 𝑥2 = 𝑏2
𝑎11 𝑎12 𝑥1 𝑏1
In matrix form: [𝑎 𝑎22 ] ∙ [𝑥2 ] = [𝑏2 ] → 𝑨 ∙ 𝑿 = 𝑩
21
Page 13 of 16
𝑨 → 𝐶𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 𝑚𝑎𝑡𝑟𝑖𝑥
𝑿 → 𝑉𝑒𝑐𝑡𝑜𝑟 𝑜𝑓 𝑢𝑛𝑘𝑛𝑜𝑤𝑛𝑠
𝑩 → 𝑅𝑖𝑔ℎ𝑡 − ℎ𝑎𝑛𝑑 𝑠𝑖𝑑𝑒 𝑉𝑒𝑐𝑡𝑜𝑟 𝑜𝑓 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡𝑠
Basic equation: 𝑨 ∙ 𝑿 = 𝑩
Therefore, 𝑿 = 𝑨−𝟏 ∙ 𝑩
Example: 13
The equilibrium prices 𝑃1 and 𝑃2 for two goods satisfy y=the equations,
−4𝑃1 + 𝑃2 = −13
2𝑃1 − 5𝑃2 = −7
To find 𝑨−𝟏 we swap the diagonal elements −4 and −5, and change the sign
of the off-diagonal elements, 1 and 2, and divide by the determinant 18, to
get
1 −5 −1
𝑨−𝟏 = [ ]
18 −2 −4
Page 14 of 16
Using Cramer’s Rule
|𝑨𝒊 |
̅𝒊 =
𝒙
|𝑨|
Where 𝒙𝒊 is the 𝒊𝒕𝒉 unknown variable in a series of equations, |𝑨| is the
determinant of the coefficient matrix and |𝑨𝒊 | is the determinant of a special
matrix formed from the original coefficient matrix by replacing the column of
coefficients of 𝒙𝒊 with the column vector of constants.
Example: 14
Then to solve for 𝑥1 , replace column 1, the coefficients of 𝑥1 with the vector
of constants 𝑩, forming a new matrix 𝑨1 ,
49 5
𝑨1 = [ ]
32 4
Page 15 of 16
Find the determinant of 𝑨1 ,
|𝑨𝟏 | 𝟑𝟔
̅𝟏 =
𝒙 = =𝟒
|𝑨| 𝟗
Then to solve for 𝑥2 , replace column 2, the coefficients of 𝑥2 from the original
matrix, with the vector of constants 𝑩, forming a new matrix 𝑨2 ,
6 49
𝑨2 = [ ]
3 32
|𝑨𝟐 | 𝟒𝟓
̅𝟐 =
𝒙 = =𝟓
|𝑨| 𝟗
Page 16 of 16