Matrices 26.03.2023 KU
Matrices 26.03.2023 KU
Rza Mustafayev
In physics, such as for the study of electrical circuits, quantum mechanics, optics ...
In computer science, such as to code and encrypt messages, manage databases ...
where aij are entries or coefficients of the matrix A. Each entry has two subscripts. The first one stands for the
row number and the second one stands for the column number.
If m = 1, then the matrix is defined to be a row matrix or a row vector, i.e.,
A = (a1 , a2 , . . . , an ).
a1
a2
A = . .
.
.
am
If m = n, then the matrix A will be called as a square matrix. In this case, a11 , a22 , . . . , ann are called as the
main diagonal entries of the matrix A. We denote
diag(A) = (a11 , a22 , . . . , ann ).
!
3 (−2)
1) A = is a 2 × 2 matrix.
1 7
!
3 2 (−2)
2) A = is a 2 × 3 matrix.
1 0 7
3
3) A = 1 is a 3 × 1 matrix or a column vector.
4
4) A = 3 1 4 is a 1 × 3 matrix or a row vector.
1, if i = j
,
aij =
0,
if i , j
is called the identity matrix of size n × n and denoted by In . That is,
We denote by Omn the so-called null matrix (or zero matrix) of size m × n containing only zero entries:
Let K be any of C, R, Q, or Z. Then, we denote by Mmn (K) the set of all matrices of size m × n with entries in K
(By Mn (K), we denote the set of all square n × n matrices with entries in K).
!
3 2
1) A = ∈ M22 (N).
1 7
!
3 2 (−2)
2) A = ∈ M23 (Z).
1 0 7
(1/2)
3) A = (3/2) ∈ M31 (Q).
2
4) A = π (1/3) e ∈ M13 (R).
So,
a11 ... a1n b ... b1n
. 11
.. . . .. .
. . = . . ⇐⇒ aij = bij for 1 ≤ i ≤ m, 1 ≤ j ≤ n.
. . . . . .
am1 ... amn bm1 ... bmn
Matrices which are not equal are called as different.
So,
a11 ··· a1n b ··· b1n a + b11 ··· a1n + b1n
. 11 11
.. . . .. . . .. .
. . + .. . = . . .
. . . . . . . .
am1 ··· amn bm1 ··· bmn am1 + bm1 ··· amn + bmn
Matrix subtraction is similarly defined: The difference of two matrices A = (aij ) and B = (bij ) of the same sizes is
written as A − B and is the matrix A − B = (aij − bij ).
Hence,
a11 ··· a1n b ··· b1n a − b11 ··· a1n − b1n
. 11 11
.. . . .. . . .. .
. . − .. . = . . .
. . . . . . . .
am1 ··· amn bm1 ··· bmn am1 − bm1 ··· amn − bmn
! !
3 (−2) 0 5
Example: Let A = ,B= , compute A + B and A − B.
1 7 2 (−1)
Proposition: Let A be any matrix. Then for the null matrix of the size same as of A
A + O = A.
Thus,
a11 ... a1n αa ... α a1n
. 11
.. . . .. .
α . . . = .. . . .
. . .
am1 ... amn α am1 ... α amn
! !
3 2 1 (−1) 1 (−2)
Exercise: Let A = ,B= , α = −2, and β = 3. Compute αA + βB.
1 0 1 (−2) 1 (−3)
So,
a11 ... a1n −a ... −a1n
. 11
.. . . .. .
− . . . = . . . .
. . . .
am1 ... amn −am1 ... −amn
That is, the entry cik of the product is obtained by multiplying term-by-term the entries of the ith row of A and the k th
column of B, and summing the n products. In other words, cik is the dot product of the ith row of A and the k th
column of B
Hence,
The product AB is defined if and only if the number of columns in A equals the number of rows in B.
Remark: From previous two propositions we see that matrix multiplication is distributive with respect to matrix
addition.
Proof: Let A = (aij ), B = (bjk ), and C = (ckl ). Since the entry at (i , k ) of the matrix AB is
n
X
aij bjk ,
j =1
Thus, A (B C) = (A B) C. □
Remark: In contrary to the scalar case, A B = O does not imply that either A = O or B = O and A B = A C does not
necessarily imply that B = C.
! ! !
0 (−10 4 (−1) 2 5
Exercise: Let A = ,B= , and C = . Compute A B and A C.
0 3 5 4 5 4
Proof: We are going to prove by induction. Let A, B ∈ Mn (N) such that A B = B A. Then
A2 B = A A B = A B A = B A A = B A 2 .
Assume that An B = B An for some n ∈ N such that n ≥ 3. Let us show that An+1 B = B An+1 . Indeed:
An+1 B = An A B = An B A = B An A = B An+1 .
The proof is completed. □
AB = BA =⇒ An Bk = Bk An for all n, k ∈ N.
Proof: We prove (1) by induction. It is true when p = 1. Assuming that (1) holds for p = m, we prove it for p = m + 1.
(A + B)m+1 = (A + B)m (A + B)
m ! ! m ! ! m ! !
X m m−k k X m m−k k X m m−k k
= A B (A + B) = A B A+ A B B
k =0
k k =0
k k =0
k
m ! m ! m ! m +1 !
X m X m X m X m
= Am−k +1 Bk + Am−k Bk +1 = Am−k +1 Bk + Am−k +1 Bk
k =0
k k =0
k k =0
k k =1
k −1
m ! m !
X m X m
= A m +1 + A m − k +1 B k + Am−k +1 Bk + Bm+1
k =1
k k =1
k −1
m " ! !#
X m m
= A m +1 + + Am+1−k Bk + Bm+1
k =1
k k −1
m ! m +1 !
X m+1 X m + 1 m+1−k k
= A m +1 + Am+1−k Bk + Bm+1 = A B .
k =1
k k =0
k
p
Solution: 1) Observe that A = 2I3 . So, Ap = (2I3 )p = 2p I3 = 2p I3 . Note that
0 0 0 0 0 0 0 0 0
B2 = 2 0 ,
0 0 2 0 0 = 0 0
3 1 0 3 1 0 2 0 0
0 0 0 0 0 0 0 0 0
B3 = 0 0 = O3 .
0 0 2 0 0 = 0 0
2 0 0 3 1 0 0 0 0
So, Bp = O3 for p ≥ 3.
2) Since A B = (2I3 ) B = 2B and B A = B (2I3 ) = 2B, we see that A B = B A.
3) We can use the binomial formula. Hence,
p ! ! ! !
X p p p p p −1 p p −2 2
(A + B)p = Ap −k Bk = A I3 + A B+ A B
k =0
k 0 1 2
p (p − 1) p −2
= 2p I3 + p 2p −1 I3 B + 2 I3 B 2
2
p (p − 1) p −2 2
= 2p I3 + p 2p −1 B + 2 B
2
Obviously, (AT )T = A for any matrix A. Observe that (αA)T = αAT for any scalar α and matrix A.
(A B)T = BT AT .
Proof: Let A = (ai j ) and B = (bjk ). Recall that the entry at (i , k ) of the matrix AB is
n
X
aij bjk .
j =1
On the other hand, the entry at (i , k ) of the matrix BT AT is the dot product of the ith row of BT with the k th column of
AT , which are the ith column of B
b1i
b2i
.
..
bni
with the k th row of A
ak 1 ak 2 ··· akn
Thus, (A B)T = BT AT . □
Remark: Obviously, the main diagonal entries of a skew-symmetric matrix are zeros.
(−2)
(−5)
3 2 0 1
(−5) is symmetric while B = 5 (−3) is skew-symmetric.
Example: A = 3 8 0
(−5) (−1)
2 1 3 0
Remark: Any real square matrix A may be written as the sum of a symmetric matrix and a skew-symmetric matrix.
More precisely, we write
1 1
A= A + AT + A − AT .
2 2
| {z } | {z }
symmetric skew-symmetric
(−1) 0
3 3 2 3 4 2 0
(−5) = 4 (−5) + 1 0 , where the first and the second
Example: Note that 5 4 4 0
(−5) (−5)
2 4 2 4 0 0 0
matrices on the right-hand side are symmetric and skew-symmetric, respectively.
√ !
1 3 1
√
2 B= 2
1 (− 3)
(−2)
2 1
1 1
3 C= 3 2 2
(−2)
2 1
Figure: Upper and lower triangular matrices, respectively. All the entries in the red triangles are zero.
1 0 0
Exercise: The trace of A = 1 4 0 is tr(A) = 1 + 4 − 3 = 2.
−2 −2 −3
Proof: Let us prove the last property. Assume that A = (aij ) and B = (bij ). Since
n
X n
X n
X ! n
X n
X n
X !
diag(AB) = a1k bk 1 , a2k bk 2 , . . . , ank bkn and diag(BA) = b1i ai1 , b2i ai2 , . . . , bni ain ,
k =1 k =1 k =1 i =1 i =1 i =1
Not all matrices have inverses in this way, but it is an interesting fact that the left and right inverses of a square matrix
A, if they exist, are the same.
Proposition: Let A be a square n × n matrix. Suppose that B is either a right or a left inverse of A. Then B is a
two-sided inverse, i.e.
A B = B A = I,
and this inverse is unique, so if C satisfies either C A = In or A C = In , then C = B.
Notation: We denote this unique inverse of a square matrix A when it exists by A−1 . If A−1 exists, we say A is
invertible. The subset of invertible matrices of Mn (K) is denoted by GLn (K).
The inverse of a square matrix does not always exist. If it is the case, we say that the matrix is singular.
Proposition: If A and B are invertible square matrices of the same size, then A B is also invertible and
(A B)−1 = B−1 A−1 .
Proposition (Simplification by an invertible Matrix): Let A, B ∈ Mn (K) and C ∈ GLn (K). Then
AC = BC =⇒ A = B.
Proof: Since
(A−1 )T (AT ) = (A A−1 )T ) = IT = I,
−1
then (A−1 )T is a left inverse of (AT ). So, (A−1 )T is the inverse of (AT ), that is, (A−1 )T = (AT ) . □
Exercise:
Exercise:
Thus, if
a
11 a12 ··· a1n
. . .. .
. . .
. . . .
ai1 ai2 ··· ain
. . .
..
A = . . . . ,
. . .
a
j1 aj2 ··· ajn
. . .
..
. . .
. . . .
am1 am2 ··· amn
then
a
11 a12 ··· a1n
. . .. .
. . .
. . . .
λai1 λai2 ··· λain
. . .. .
ALi ←λLi = . . . . .
. . .
a
j1 aj2 ··· ajn
. . .
..
. . .
. . . .
am1 am2 ··· amn
Example: For n = 3,
1 0 0 1 0 0 1 0 0
0, 0, 1.
EL2 ←5L2 = 0 5 EL2 ←L2 +2L1 = 2 1 EL2 ↔L3 = 0 0
0 0 1 0 0 1 0 1 0
Proposition: Application of any elementary operation to a matrix A is equivalent to multiplication of the matrix A from
the left by the corresponding elementary matrix:
applying the elementary operation Li ↔ Lj to A one gets ELi ↔Lj × A
Exercise: Check your understanding by calculating EL1 ↔L2 B, EL2 ←λL2 B, and EL3 ←L3 +2L2 B directly for
1 2 3 4
(−1) 0.
B = 2 1
(−2)
3 1 1
If E is obtained by adding λ times row j to row i, then E−1 is obtained by subtracting λ times row j from row i:
−1
ELi ←Li +λLj = ELi ←Li −λLj .
−1
If E is obtained by switching rows i and j, then E is also obtained by switching rows i and j:
−1
ELi ↔Lj = ELi ↔Lj .
Exercise:
!
1 0
Let A = . Find A−1 .
0 2
1 0 0
0. Find B−1 .
Let B = 2 1
0 0 1
1 0 0 0
0 1 0 0
Let C =
0 . Find C−1 .
0 0 1
0 0 1 0
1 If all entries in the first column are already zero there is nothing to do.
2 Else use the swap operation to arrange that the top left entry a11 in the matrix is nonzero.
3 Now use operation Lj ← Lj + µL1 for each j ≥ 2 and for suitable values of µ to ensure the rest of the first column
is zero.
Exercise:
1 2 3
1 0 1
Exercise: Are A = 1 1 2 and B = 0 1 1 equivalent?
0 1 1 0 0 0
Definition: A matrix is in row echelon form if it contains no adjacent rows of the form
!
0 0 ··· 0 x1 x2 ···
0 0 ··· 0 y1 y2 ···
with y1 , 0 (irrespective of what x1 is). In other words, we say that a matrix A is in row echelon form if the number of
zeroes at the beginning of each row is strictly increasing row by row.
Definition: If a matrix is in row echelon form, then the first nonzero entry of each row is called a pivot, and the
columns in which pivots appear are called pivot columns.
.. . . . .. . .
. . . . .
. . . . .
0 ··· 0 0 bm1 ··· bmk
Algorithm (Forward Elimination): The input is a matrix A = (aij ). The output is a row echelon form of A.
Step 1: Find the first column with a nonzero entry. Let j1 denote this column.
a Arrange so that a1 j1 , 0. That is, if necessary, apply swap operation so that a nonzero entry appears in the first
row in column j1 .
b Use a1 j1 as a pivot to obtain 0’s below a1 j1 . Specifically, for i > 1, apply the operation Li ← Li − (ai j1 /a1 j1 )L1 .
Step 2: Repeat Step 1 with the submatrix formed by all rows excluding the first row. Here we let j2 denote the first
column in the submatrix with a nonzero entry. Hence, at the end of Step 2, we have a2 j2 , 0.
Step 3 to r: Continue the above process until a submatrix has only zero rows.
Exercise: Use row operations to put the following into row echelon form:
(−1)
0 1 1
1 1 1 1
1 2 3 5
0 1 2 3
A = 0 1 0, B = 2 3 4 5, C = 1 2 3 4, D = 0 1 2 3 4 .
(−1) (−2) (−3) (−4) (−5)
1 1 0 3 4 5 6 0 0 1 1
Definition: If A can be converted to the row echelon form matrix B using row operations, and B has exactly n nonzero
rows, then the rank of A, denoted by rank(A), is k .
Exercise: Say what the ranks of the matrices in the previous exercise are?
Remark: The major difference between a row echelon matrix and a reduced row echelon matrix is that in a row
echelon matrix there must be zeros below pivots, but in a reduced row echelon matrix, each pivot must also equal to 1
and there must also be zeros above the pivots.
The zero matrix O and the identity matrix I of any size are important special examples of reduced row echelon
matrices.
Algorithm (Backward Elimination): The input is a matrix A = (aij ) in row echelon form with pivot entries
a1 j1 , a2 j2 , . . . , ar jr .
The output is the reduced row echelon form of A.
Step 1:
a Apply Lr ← (1/ar jr )Lr (Use row scaling so that the last pivot equals 1).
b Apply Li ← Li + (−ai jr )Lr for i = r − 1, r − 2, . . . , 2, 1 (Use ar jr = 1 to obtain 0’s above the pivot).
Step r: Apply L1 ← (1/a1 j1 )L1 (Use row scaling so that the first pivot equals 1).
1 2 3 4
Example: Transform A = 0 2 4 6 to its reduced row echelon form.
−1
0 1 0
Theorem: Let A ∈ Mnp (R), there exists a unique matrix U in reduced row echelon form obtained from A by means of
elementary operations on lines.
We know that, in this case, applying Gauss backward elimination algorithm, the latter can be transformed to the
following reduced row echelon form:
1
0 0 ··· 0 b1n+1 ··· b1k
0
1 0 ··· 0 b2n+1 ··· b2k
0 0 1 ··· 0 b3n+1 ··· b3k
.. . . .
..
. . .
.
. . . .
0 0 ··· 0 1 bnn+1 ··· bnk
Thus, if
a11 ··· a1m b11 ··· b1k
. . . .
.. ..
A = . . and B = . . ,
. . .
. . .
an1 ··· anm bn1 ··· bnk
then
a11 ··· a1m b11 ··· b1k
. .. . . .. .
(A | B) = . . . . . .
. . . .
an1 ··· anm bn1 ··· bnk
To see why the method works, recall that each elementary row operation corresponds to multiplying on the left by an
elementary row operation matrix. So applying several row operations to (A | I) corresponds to multiplying on the left by
a product
E = E1 E2 · · · Ek
of row operation matrices. If the result of these operations is (I | B) then by associativity of matrix multiplication
E(A | I) = (I | B),
that is,
EA = I and EI = B.
Consequently,
A−1 = E = B.
Recall that a square n × n matrix has rank n if and only if its reduced row echelon form is In . Thus, we have proven the
sufficient part of the following statement.
Theorem: A matrix A ∈ Mn (R) is invertible if and only if its reduced row echelon form is In .
1 2 3
Example: Show that A = 1 4 0 is invertible.
(−2) (−2) (−3)
Gauss method allows to find the inverse of a matrix A by means of the following steps :
1 0 1 0
1 2 1 0 2 (−2) 0
(−1) and B =
Exercise: Compute the inverse of A = 4 0 using Gauss method.
(−1) 2 0 1
(−1)
2 2
0 2 1 3