Matrices
Matrices
E LECTRONIC LECTURE
Hoang Hai Ha
HCMUT-OISP
Email: hoanghaiha@hcmut.edu.vn
1 M ATRIX : DEFINITIONS
2 E LEMENTARY R OW O PERATIONS
3 O PERATIONS ON M ATRICES
4 I NVERSE OF A M ATRIX
¡ ¢
Ai ∗ = ai 1 ai 2 . . . ai n is the i −th row of matrix A, 1 É i É m,
¡ ¢
Ai ∗ = ai 1 ai 2 . . . ai n is the i −th row of matrix A, 1 É i É m,
a1 j
a2 j
and A ∗ j = .. is the j −th column. If matrix A, 1 É j É n then
.
am j
¡ ¢
Ai ∗ = ai 1 ai 2 . . . ai n is the i −th row of matrix A, 1 É i É m,
a1 j
a2 j
and A ∗ j = .. is the j −th column. If matrix A, 1 É j É n then
.
am j
A=
¡ ¢
Ai ∗ = ai 1 ai 2 . . . ai n is the i −th row of matrix A, 1 É i É m,
a1 j
a2 j
and A ∗ j = .. is the j −th column. If matrix A, 1 É j É n then
.
am j
A 1∗
A 2∗
A= =
..
.
A m∗
¡ ¢
Ai ∗ = ai 1 ai 2 . . . ai n is the i −th row of matrix A, 1 É i É m,
a1 j
a2 j
and A ∗ j = .. is the j −th column. If matrix A, 1 É j É n then
.
am j
A 1∗
A 2∗ ¡ ¢
A= = A ∗1 A ∗2 . . . A ∗n
..
.
A m∗
D EFINITION 1.2
A matrix whose entries are all zero is called a zero matrix, that is
a i j = 0, ∀i , j.
D EFINITION 1.2
A matrix whose entries are all zero is called a zero matrix, that is
a i j = 0, ∀i , j.
E XAMPLE 1.2
µ ¶
0 0 0
A= is the zero matrix of order 2 × 3.
0 0 0
D EFINITION 1.3
A matrix A with n rows and n columns is called a square matrix of
order n
a 11 . . . a 1i . . . a 1n
.. .. .. .. ..
. . . . .
A = ai 1 . . . ai i . . . ai n
.
.. . .. .
.. . .. .
..
.
a n1 . . . a ni . . . a nn
D EFINITION 1.3
A matrix A with n rows and n columns is called a square matrix of
order n
a 11 . . . a 1i . . . a 1n
.. .. .. .. ..
. . . . .
A = ai 1 . . . ai i . . . ai n
.
.. . .. .
.. . .. .
..
.
a n1 . . . a ni . . . a nn
The entries a 11 , a 22 , . . . , a nn are said to be on the main diagonal of A.
D EFINITION 1.3
A matrix A with n rows and n columns is called a square matrix of
order n
a 11 . . . a 1i . . . a 1n
.. .. .. .. ..
. . . . .
A = ai 1 . . . ai i . . . ai n
.
.. . .. .
.. . .. .
..
.
a n1 . . . a ni . . . a nn
The entries a 11 , a 22 , . . . , a nn are said to be on the main diagonal of A.
E XAMPLE 1.3
1 2 3
A = 0 −3 −2 is the square matrix of order 3.
5 4 −5
D EFINITION 1.3
A matrix A with n rows and n columns is called a square matrix of
order n
a 11 . . . a 1i . . . a 1n
.. .. .. .. ..
. . . . .
A = ai 1 . . . ai i . . . ai n
.
.. . .. .
.. . .. .
..
.
a n1 . . . a ni . . . a nn
The entries a 11 , a 22 , . . . , a nn are said to be on the main diagonal of A.
E XAMPLE 1.3
1 2 3
A = 0 −3 −2 is the square matrix of order 3. The entries on the
5 4 −5
main diagonal of A are 1, −3, −5
Hoang Hai Ha (HCMUT) Matrices January 16, 2024 7 / 66
D IAGONAL MATRIX
D EFINITION 1.4
Diagonal matrix is the square matrix in which all the entries outside
the main diagonal are zeros.
E XAMPLE 1.4
2 0 0
A = 0 3 0.
0 0 9
E XAMPLE 1.5
2 8 9
A = 0 1 9 .
0 0 5
⇒ upper triangular matrix
E XAMPLE 1.5
2 8 9
A = 0 1 9 .
0 0 5
⇒ upper triangular matrix
E XAMPLE 1.6
2 0 0
A = 1 1 0
1 3 5
⇒ lower triangular matrix.
D EFINITION 1.5
1 0 ... 0
0 1 ... 0
′
A square matrix I = . . . . , with 1 s on the main diagonal
.. .. . . ..
0 0 ... 1
and zeros elsewhere, i.e. (a i i = 1, i = 1, ..n; a i j = 0, ∀i ̸= j ) is called an
identity matrix of order n and is denoted by I or I n .
D EFINITION 1.5
1 0 ... 0
0 1 ... 0
′
A square matrix I = . . . . , with 1 s on the main diagonal
.. .. . . ..
0 0 ... 1
and zeros elsewhere, i.e. (a i i = 1, i = 1, ..n; a i j = 0, ∀i ̸= j ) is called an
identity matrix of order n and is denoted by I or I n .
E XAMPLE 1.7
1 0 0
I = 0 1 0 is the identity matrix of order 3.
0 0 1
We
apply some operations
on rows
of this matrix:
1 −2 3 9 r 2 =r 2 +r 1 1 −2 3 9
−1 3 0 −4 −−−−−−→ 0 1 3 5
r 3 =r 3 −2×r 1
2 −5 5 17 −
− − − −− −− → 0 −1 −1 −1
1 −2 3 9
r 3 =r 3 +r 2
−−−−−−→ 0 1 3 5 .
0 0 2 4
We get the last matrix the same with the last system above. Matrix
form is convenient for linear system with large number of equations
and variables.
1 Interchange 2 rows r i ↔ r j
1 Interchange 2 rows r i ↔ r j
2 Multiply a row through by a nonzero constant: r i → λr i ,
(λ ̸= 0).
1 Interchange 2 rows r i ↔ r j
2 Multiply a row through by a nonzero constant: r i → λr i ,
(λ ̸= 0).
3 Add a constant times one row to another: r i → r i + λ.r j , ∀λ
1 Interchange 2 rows r i ↔ r j
2 Multiply a row through by a nonzero constant: r i → λr i ,
(λ ̸= 0).
3 Add a constant times one row to another: r i → r i + λ.r j , ∀λ
D EFINITION 2.2
The first non-zero element of each row is called the leading entry of
this row.
D EFINITION 2.2
The first non-zero element of each row is called the leading entry of
this row.
D EFINITION 2.3
A matrix is said to be in row echelon form if it has the following
conditions
1 Each leading entry is in the column to the right of the leading
entry in the previous row.
2 Rows with all zero elements, if any, are below rows having
non-zero element.
E XAMPLE 2.1
1 4 −3 7
This is not an echelon matrix 1 1 6 2 ;
0 0 1 5
E XAMPLE 2.1
1 4 −3 7
This is not an echelon matrix 1 1 6 2 ; the following
0 0 1 5
matrices
are
in echelon form:
1 1 0
0 1 0 ;
0 0 0
E XAMPLE 2.1
1 4 −3 7
This is not an echelon matrix 1 1 6 2 ; the following
0 0 1 5
matrices
are in
echelon form:
1 1 0 0 1 2 6 0
0 1 0 ; 0 0 1 −1 0 .
0 0 0 0 0 0 0 1
D EFINITION 2.4
We denote A −→ B to show that B is the matrix that results from A by
performing some of the Elementary Row Operations.
D EFINITION 2.5
If A m×n −→ B m×n , where B is in row-echelon form, then rank of the
matrix A is the number of non-zero rows of matrix B and is denoted
by r (A).
1 r (A) = 0 ⇔ A = 0.
1 r (A) = 0 ⇔ A = 0.
2 0 É r (A m×n ) É min{m, n}.
1 r (A) = 0 ⇔ A = 0.
2 0 É r (A m×n ) É min{m, n}.
D EFINITION 3.1
If A = (a i j )m×n is any m × n matrix, then the transpose of A, denoted
by A T = (a j i )n×m is defined to be the n × m matrix that results by
interchanging the rows and columns of A; that is,
a 11 a 12 . . . a 1n a 11 a 21 . . . a m1
a 21 a 22 . . . a 2n
T a 12 a 22 . . . a m2
A= . , A =
.. .. .. . .. .. ..
.. ..
. . . . . .
a m1 a m2 . . . a mn a 1n a 2n . . . a mn
D EFINITION 3.2
Two matrices A and B are defined to be equal if they have the same
size and their corresponding entries are equal, i.e.
D EFINITION 3.2
Two matrices A and B are defined to be equal if they have the same
size and their corresponding entries are equal, i.e.
E XAMPLE 3.2
Find real numbers x, y, z, t such that the following 2 matrices are
equal µ ¶ µ ¶
x + y 2z + t 3 7
= .
x −y z −t 1 5
x+y = 3
x = 2
x−y = 1 y = 1
⇔ .
2z +t = 7
z = 4
z −t = 5 t = −1
D EFINITION 3.3
If A = (a i j )m×n is any matrix and α is any scalar, then the product αA
obtained by the multiplying each entry of the matrix A by α. The
matrix αA is said to be a scalar multiple of A, i.e.
D EFINITION 3.4
If A and B are matrices of the same size, then the sum A + B is the
matrix obtained by adding the entries of B to the corresponding
entries of A.
Solution.
The new production levels are: 1.2A.
D EFINITION 3.5
If
A = (a i j )m×n ∈ M m×n
(K ), B = (b i j )n×p ∈ M n×p (K ).
a 11 a 12 ... a 1n
. .. .. ..
. b 11 b 12 ... b1 j ... b 1p
.
. . .
. .. .. .. .. ..
ai 1
ai 2 ... ai n
. ..
. . . .
. =
. .. .. ..
. b n1 b n2 ... bn j ... b np n×p
. . . .
a a m2 ... a mn
m1 m×n
c 11 c 12 ... c1 j ... c 1p
. .. .. .. .. ..
.
.
. . . . .
ci 1 ci 2 ... ci j ... ci p
. .. .. .. .. ..
.
. . . . . .
c m1 c m2 ... cm j ... c mp m×p
D EFINITION 3.5
If
A = (a i j )m×n ∈ M m×n
(K ), B = (b i j )n×p ∈ M n×p (K ).
a 11 a 12 ... a 1n
. .. .. ..
. b 11 b 12 ... b1 j ... b 1p
.
. . .
. .. .. .. .. ..
ai 1
ai 2 ... ai n
. ..
. . . .
. =
. .. .. ..
. b n1 b n2 ... bn j ... b np n×p
. . . .
a a m2 ... a mn
m1 m×n
c 11 c 12 ... c1 j ... c 1p
. .. .. .. .. ..
.
.
. . . . .
ci 1 ci 2 ... ci j ... ci p then the product AB is the matrix
. .. .. .. .. ..
.
. . . . . .
c m1 c m2 ... cm j ... c mp m×p
n
P
C = A.B = (c i j )m×p whose entries are defined by c i j = a i k .b k j , i = 1..m; j = 1..p
k=1
D EFINITION 3.5
If
A = (a i j )m×n ∈ M m×n
(K ), B = (b i j )n×p ∈ M n×p (K ).
a 11 a 12 ... a 1n
. .. .. ..
. b 11 b 12 ... b1 j ... b 1p
.
. . .
. .. .. .. .. ..
ai 1
ai 2 ... ai n
. ..
. . . .
. =
. .. .. ..
. b n1 b n2 ... bn j ... b np n×p
. . . .
a a m2 ... a mn
m1 m×n
c 11 c 12 ... c1 j ... c 1p
. .. .. .. .. ..
.
.
. . . . .
ci 1 ci 2 ... ci j ... ci p then the product AB is the matrix
. .. .. .. .. ..
.
. . . . . .
c m1 c m2 ... cm j ... c mp m×p
n
P
C = A.B = (c i j )m×p whose entries are defined by c i j = a i k .b k j , i = 1..m; j = 1..p
k=1
−1 4×1
−1 4×1
1
¡ ¢ 2
A.B = 2 −1 4 5 .
0 =
−1
−1 4×1
1
¡ ¢ 2
A.B = 2 −1 4 5 . 0 =
−1
³ ´ ³ ´
2 × 1 + (−1) × 2 + 4 × 0 + 5 × (−1) = − 5
1×1
µ ¶ 2 1 −1
2 3 1
. 1 3 −2 =
−1 0 1
0 2 1
¡ 2¢
c 11 = 2 3 1 . 1 = 2×2+3×1+1×0 = 7
0
Remark
AB #B A .
D EFINITION 3.6
If A is a square matrix and
p(x) = a 0 + a 1 x + a 2 x 2 + . . . + a m x m
p(A) = a 0 I + a 1 A + a 2 A 2 + . . . + a m A m . (3)
p(A) = A 2 − 2A − 3I =
· ¸2 · ¸ · ¸ · ¸
−1 2 −1 2 1 0 0 0
= −2 −3 = .
0 3 0 3 0 1 0 0
D EFINITION 3.7
A matrix E is called an elementary matrix if it can be obtained from
an identity matrix I by performing a single elementary row operation.
D EFINITION 3.7
A matrix E is called an elementary matrix if it can be obtained from
an identity matrix I by performing a single elementary row operation.
E XAMPLE 3.9
1 0 0 1 0 3
r 1 →r 1 +r 3 ×3
0 1 0 − −−−−−−−→ 0 1 0 .
0 0 1 0 0 1
| {z }
elementary matrix
D EFINITION 4.1
If A is a square matrix, and if a matrix B of the same size can be found
such that
B A = AB = I , (4)
D EFINITION 4.1
If A is a square matrix, and if a matrix B of the same size can be found
such that
B A = AB = I , (4)
T HEOREM 4.1
If A is an n × n matrix, then the following statements are equivalent
1 A is invertible;
T HEOREM 4.1
If A is an n × n matrix, then the following statements are equivalent
1 A is invertible;
Elementary Row Operations
2 A −−−−−−−−−−−−−−−−−−−−−−−−→ I n ;
T HEOREM 4.1
If A is an n × n matrix, then the following statements are equivalent
1 A is invertible;
Elementary Row Operations
2 A −−−−−−−−−−−−−−−−−−−−−−−−→ I n ;
3 r (A) = n.
I NVERSION A LGORITHM
Elementary Row Operations ¡
(A|I ) −−−−−−−−−−−−−−−−−−−−−−−−−→ I |A −1 .
¢
I NVERSION A LGORITHM
Elementary Row Operations ¡
(A|I ) −−−−−−−−−−−−−−−−−−−−−−−−−→ I |A −1 .
¢
Solution ¯
1 2 3 ¯¯ 1 0 0 r 2 →r 2 −2r 1
r 3 →r 3 −3r 1
(A|I 3 ) = 2
5 4 ¯¯ 0 1 0 −−−−−−−→
3 7 8 ¯ 0 0 1
¯ ¯
1 2 3 ¯ 1 0 0 1 2 3 ¯¯ 1 0 0
¯ r 3 →r 3 −r 2
0 1 −2 ¯ −2 1 0 −−−−−−→ 0 1 −2 ¯ −2 1 0
¯ ¯
0 1 −1 ¯ −3 0 1 0 0 1 ¯ −1 −1 1
¯
r 1 →r 1 −3r 3 1 2 0 ¯¯ 4 3 −3
r 2 →r 2 +2r 3 r 1 →r 1 −2r 2
−−−−−−−→ 0 1 0 ¯¯ −4 −1 2 −− −−−−−→
0 0 1 −1 −1 1
¯
¯
1 0 0 ¯¯ 12 5 −7 12 5 −7
0 1 0 ¯
¯ −4 −1 2 . Thus, A −1 = −4 −1 2 .
0 0 1 ¯ −1 −1 1 −1 −1 1
Hoang Hai Ha (HCMUT) Matrices January 16, 2024 45 / 66
M ARKOV MODEL
D EFINITION 5.1
Markov Model is the model or problem in which there is a transition
from one state to another state.
D EFINITION 5.1
Markov Model is the model or problem in which there is a transition
from one state to another state.
E XAMPLE 5.1
The market research department at a manufacturing plant
determines that 20% of the people who purchase the plant’s product
during any month will not purchase it the next month. On the other
hand, 30% of the people who do not purchase the product during any
month will purchase it the next month. In a population of 1000
people, 100 people purchased the product this month. How many will
purchase the product next month? In 2 months?
D EFINITION 5.2
Cryptogram is a message written according to a secret code. We can
use matrix multiplication to encode and decode messages.
E XAMPLE 5.4
1 −2 2
Use the matrix A = −1 1 3 to decode the message
1 −1 −4
13 − 26 21 33 − 53 − 12 18 − 23 − 42 5 − 20
56 − 24 23 77
E XAMPLE 5.4
1 −2 2
Use the matrix A = −1 1 3 to decode the message
1 −1 −4
13 − 26 21 33 − 53 − 12 18 − 23 − 42 5 − 20
56 − 24 23 77
Solution. To crack the code, we write numbers in the message in a
matrix with 3 columns, that is
E XAMPLE 5.4
1 −2 2
Use the matrix A = −1 1 3 to decode the message
1 −1 −4
13 − 26 21 33 − 53 − 12 18 − 23 − 42 5 − 20
56 − 24 23 77
Solution. To crack the code, we write numbers in the message in a
matrix with 3 columns, that is
13 −26 21
33 −53 −12
−1
B = 18 −23 −42 , then find the uncoded row by evaluating B A .
5 −20 56
−24 23 77
Hoang Hai Ha (HCMUT) Matrices January 16, 2024 55 / 66
O PEN L EONTIEF MODEL
An economic system has n different industries I 1 , I 2 , ...I n each of
which has input needs(raw materials, utilities,...) and an
output(finished output).
X = PX +D
¶¾ µ µ ¶
x 0.1 0.2
Where X = 1 -output value vector, P = and
x2 0.8 0.1
| {z }
Input-Output matrix
µ ¶
10000
D= - external demand vector.
20000
X = PX +D
¶¾ µ µ ¶
x 0.1 0.2
Where X = 1 -output value vector, P = and
x2 0.8 0.1
| {z }
Input-Output matrix
µ ¶
10000
D= - external demand vector.
20000
X is found by the formula
X = (I − P )−1 D.
Hoang Hai Ha (HCMUT) Matrices January 16, 2024 58 / 66
I NPUT-O UTPUT MATRIX
Matrix P is constructed by
Users(Output)
z }|
{
p 11 p 12 · · · p 1n
p 21 p 22 ... p 2n
Supplier(Input) ..
.. ..
. . ··· .
p n1 p n2 · · · p nn
X (k+1) = AX (k) .
24
The current age distribution vector is: X (0) = 24.
20
0 6 8
The age transition matrix is : A = 0.5 0 0.
0 0.5 0
The age distribution vector after k years is : X (k) = A k X (0) .
Solution.
0 6 4
The age distribution matrix: P = 0.7 0 0.
0.5 0.6 0