Sma 2201 Linear Algebra I Notes 4
Sma 2201 Linear Algebra I Notes 4
Bsc. mathematics and computer science (Jomo Kenyatta University of Agriculture and
Technology)
MATRIX ALGEBRA
Definition: A matrix A is a rectangular array of scalars (numbers), i.e., a collection of
numbers ordered by rows and columns. The ij th component of the matrix A, denoted by
aij , is the number in the intersection of the ith row and j th column of A. The components
(elements/entrie)s of a matrix are usually enclosed in parentheses, brackets or braces. The
matrix A is sometimes written as A = [aij ]. A matrix with all components equal to zero
is called the zero matrix. For each matrix A = [aij ], there corresponds a unique matrix
−A = [−aij ], called the additive inverse of A, obtained by negating each entry of A.
Definition: A matrix A is said to have order (shape/size) m × n, read “m by n” if A has m
rows and n columns. In this case, if m = n (i.e. A has same number of rows and columns),
A is called a square matrix; otherwise, A is said to be rectangular. A matrix consisting of
a single row is called a row vector, while a matrix consisting of a single column is called a
column vector. Conventionally, a 1 × 1 matrix is a scalar and vice versa.
Definition: Two matrices A = [aij ] and B = [bij ] are equal if they have the same shape and
corresponding entries are equal, i.e., aij = bij for each i = 1, 2, · · · , m and j = 1, 2, · · · , n.
Matrix Addition
Let A = [aij ] and B = [bij ] be two m × n matrices. Then the sum of A and B is the m × n
matrix A + B obtained by adding corresponding entries. Matrix subtraction is done in a
similar manner except that entries are subtracted instead of being added. For two matrices
of the same shape, the difference A − B is the matrix A − B = A + (−B).
Example:
1 −2 3 −1 0 2
Let A = and B = . Then
4 5 −6 −5 −4 5
1 −2 3 −1 0 2 0 −2 5
A+B = + =
4 5 −6 −5 −4 5 −1 1 −1
and
1 −2 3 −1 0 2 2 −2 1
A−B = − = .
4 5 −6 −5 −4 5 9 9 −11
Scalar Multiplication
Let A be an m × n matrix. The product of a scalar α times a matrix A, denoted by αA, is
the matrix obtained by multiplying each entry of A by α.
Example:
−5 0 2
Let A = 3 4 −3 and let α = −1/2. Then
1 −1 1
−5 0 2 5/2 0 −1
1
αA = − 3 4 −3 = −3/2 −2 3/2 .
2
1 −1 1 −1/2 1/2 −1/2
Transpose
Let A be an m × n matrix. The transpose of A, denoted by AT , is the n × m matrix obtained
by interchanging rows and columns of A, i.e., the ith row of A is the ith column of AT and
the j th column of A is the j th row of AT .
Example:
−1 2 3
−1 0 2 5
. Then AT = 0 4 −1
Let A = 2 4 −3 2 2 −3 0 .
3 −1 0 −1
5 2 −1
Symmetry
Let A = [aij ] be an n × n matrix. Then A is said to be a symmetric matrix if A = AT , i.e.,
aij = aji . In other words, A is symmetric if the entries of A are symmetrically located about
the main diagonal (the line from the upper-left-hand corner to the lower-right-hand corner).
Example:
1 −2 0
Let A = −2 4 −3 . Then A is symmetric since A = AT .
0 −3 0
Trace
Let A = [aij ] be an n × n matrix. The trace of A, denoted by trace(A), is the sum of the
entries on the main diagonal. That is,
n
X
trace(A) = a11 + a22 + · · · + ann = aii .
i=1
Example:
−3 2 1
Let A = 4 −1 −2 . Then trace(A) = (−3) + (−1) + 0 = −4.
5 0 0
Linear Combinations
Let A1 , A2 , · · · , An be m × n matrices and let α1 , α2 , · · · , αn be scalars. Then, the expression
n
X
α1 A1 + α2 A2 + · · · + αn An = αi Ai
i=1
Matrix Multiplication
b1
b2
Let a = a1 a2 · · · an and b = .. be two n-vectors. Then the scalar product
e e .
bn
Xn
a · b = a1 b1 + a2 b2 + · · · + an bn = ai bi
e e i=1
Properties of MatrixMultiplication
For conformable matrices, we have the following:
(i ) A (B + C) = AB + AC and (D + E) F = DF + EF (distributivity of matrix
multiplication over matrix addition).
(ii ) A (BC) = (AB) C (associative law).
(iii ) (AB)T = B T AT .
Identity Matrix
1 0 ··· 0
0 1 ··· 0
The n × n matrix In = .... . . .. with 1’s on the main diagonal and 0’s elsewhere is
. . . .
0 0 ··· 1
called the identity matrix of order n.
In the notation In , the subscript is suppressed if the size is obvious from the context. For
every m × n matrix, AIn = A and Im A = A.
1 0 −1
1 0 0 0 1 0 2 5 0
0 1 0 0 , 0 1 3 6 , and 1 2 are in reduced echelon form.
0 0 0
0 0 0 0 0 0 0 0
0 0 0
The dimension of the space spanned by the four vectors is two. So, the space spanned
by the four vectors can also be spanned by only two of them. A basis for this space is
{(1, 2, 1, 4) , (−1, 0, −1, 0)} or even {(1, 2, 1, 4) , (0, 2, 0, 4)}.
To obtain the reduced echelon form of the original matrix:
1 2 1 4 1 2 1 4 1 0 1 0
0 2 0 4 1
R 0 1 0 2 R1 − 2R2 0 1 0 2
2 2 .
0 0 0 0 −→ 0 0 0 0 −→ 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
THEORY OF DETERMINANTS
The determinant function is only defined for n × n (square) matrices. If A is an n × n matrix,
the determinant of A is denoted det A or |A|.
Definition (2 × 2 Determinant):
a11 a12
Let A = be a 2 × 2 matrix. Then
a21 a22
a11 a12
det A =
a21 a22
= a11 a22 − a12 a21 . . . . . (1)
Definition (3 × 3 Determinant):
a11 a12 a13
Let A = a21 a22 a23 . Then,
a31 a32 a33
Take note of the minus sign before the second term on the right of (2).
Examples:
3 5 2
1. Let A = 4 2 3 . Calculate |A|.
−1 2 4
Solution:
3 5 2
|A| = 4 2 3
−1 2 4
2 3 4 3 4 2
=3 −5 +2
2 4 −1 4 −1 2
= 3 (2) − 5 (19) + 2 (10)
= −69.
2 −3 5
2. Calculate 1 0 4 .
3 −3 9
Solution:
2 −3 5
0 4 1 4 1 0
1 0 4 =2 − (−3) +5
−3 9 3 9 3 −3
3 −3 9
= 2 (12) + 3 (−3) + 5 (−3)
= 0.
There exists another method of calculating 3 × 3 determinants. From equation (2) above we
have
det A = a11 (a22 a33 − a23 a32 ) − a12 (a21 a33 − a23 a31 ) + a13 (a21 a32 − a22 a31 )
= a11 a22 a33 + a12 a23 a31 + a13 a21 a32 − a11 a23 a32 − a12 a21 a33 − a13 a22 a31 . . . . . (3)
We write A and adjoin its first two columns to it:
a11 a12 a13 a11 a12
a21 a22 a23 a21 a22
a31 a32 a33 a31 a32
We then calculate the six products, put minus signs before the products with arrows pointing
upwards, and add. This gives the sum in equation (3).
Example:
3 5 2
Calculate 4 2 3 .
−1 2 4
Solution:
3 5 2 3 5
Writing 4 2 3 4 2 and multiplying as indicated, we obtain
−1 2 4 −1 2
|A| = 3 (2) (4) + 5 (3) (−1) + 2 (4) (2) − (−1) (2) (2) − (2) (3) (3) − (4) (4) (5)
= 24 − 15 + 16 + 4 − 18 − 80
= −69.
Note: This method will not work for n × n determinants if n > 3.
n × n Determinants
a11 a12 a13
a22 a23
Let A = a21 a22 a23 . Then M11 = is the matrix obtained by deleting the
a32 a33
a31 a32 a33
a21 a23
first row and first column of A; M12 = is the matrix obtained by deleting the
a31 a33
a21 a22
first row and second column of A; M13 = is the matrix obtained by deleting the
a31 a32
first row and third column of A. Let A11 = det M11 , A12 = − det M12 and A13 = det M13 .
Then equation (2) above becomes
det A = a11 A11 + a12 A12 + a13 A13 .
Definition (Minor ): Let A be an n × n matrix and let Mij be the (n − 1) × (n − 1) matrix
obtained from A by deleting the ith row and j th column of A. Then Mij is called the ij th
minor of A.
Examples:
2 −1 4
1. Let A = 0 1 5 . Find M13 and M32 .
6 3 −4
Solution:
0 1
Deleting the first row and third column of A, we obtain M13 = , and deleting
6 3
2 4
the third row and second column of A, we obtain M32 = .
0 5
1 −3 5 6
2 4 0 3
2. Let A =
1 5 9 2 . Find M24 and M32 .
4 0 2 7
Solution:
1 −3 5
Deleting the second row and fourth column of A, we obtain M24 = 1 5 9 , and
4 0 2
1 5 6
deleting the third row and second column of A, we obtain M32 = 2 0 3 .
4 2 7
Definition (Cofactor ): Let A be an n × n matrix. The ij th cofactor of A, denoted by Aij
is given by
Aij = (−1)i+j |Mij | .
i.e. the ij th cofactor of A is obtained by taking the determinant of the ij th minor and
multiplying it by (−1)i+j .
Note: (
1 if i + j is even
(−1)i+j = .
−1 if i + j is odd
Examples:
1. In Example 1 above we have
A13 = (−1)1+3 |M24 |
0 1
= = −6
6 3
and
A32 = (−1)3+2 |M32 |
2 4
=− = −10.
0 5
2. In Example 2 above we have
A24 = (−1)2+4 |M24 |
1 −3 5
= 1 5 9 = −192
4 0 2
and
A32 = (−1)3+2 |M32 |
1 5 6
=− 2 0 3 = −8.
4 2 7
Definition (n × n Determinant):
a11 a12 · · · a1n
a21 a22 · · · a2n
Consider the general n × n matrix A = .. .. .. .. . Then the determinant of A
. . . .
an1 an2 · · · ann
is given by
det A = a11 A11 + a12 A12 + · · · + a1n A1n
n
X
= a1k A1k . . . . . . . . (4)
k=1
3 2 4 8
10
Solution:
3 3 5 3 3 5
det A = 0 + 0 − 3 2 2 −2 − 3 2 2 −2
2 10 2 4 1 0
= −3 [3 (24) − 3 (8) + 5 (16)] − 3 [5 (−6) − (−2) (−9) + 0]
= −3 (128) − 3 (−48)
= −240.
Exercise:
Evaluate each of the following determinants:
1 3 1 1
2 5 2 2
(a) ; Ans: 1
1 3 8 9
1 3 2 2
2 −2 −9 −3
5 4 −1 0
(b) ; Ans: 383
2 3 2 8
−3 1 6 0
2 3 9 3
5 4 −1 4
(c) ; Ans: −268.
1 1 6 3
2 3 2 8
Definition (Triangular Matrix ): A square matrix is called upper triangular if all its
components below the diagonal are zero. It is lower triangular if all its components above
11
the diagonal are zero. A matrix is called diagonal if all its elements not on the diagonal are
zero. In other words, A = [aij ] is upper triangular if aij = 0 for i > j, lower triangular if
aij = 0 for i < j, and diagonal if aij = 0 for i 6= j.
Note: A diagonal matrix is both upper and lower triangular.
Examples:
−2 3 0 1
2 1 7 0 0 2 4
1. The matrices A = 0 2 −5 and B =
0 0 1 3 are upper triangular;
0 0 1
0 0 0 −2
5 0 0
0 0
C= 2 3 0 and D = are lower triangular; while the identity matrix
1 0
−1 2 4
2 0 0
I, and E = 0 −7 0 are diagonal.
0 0 −4
a11 0 0 0
a21 a22 0 0
2. Compute the determinant of the lower triangular matrix A = a31 a32 a33 0 .
Solution:
i.e., the determinant of a triangular matrix equals the product of its diagonal entries.
Examples:
The determinants of the six matrices in Example 1 above are
|A| = 2 (2) (1) = 4,
12
Properties of Determinants
Theorem: Let A and B be n×n matrices. Then det AB = det A det B, i.e. the determinant
of the product is the product of the determinants.
Example:
1 −1 2 1 −2 3
Let A = 3 1 4 and B = 0 −1 4 . Then det A = 16 and det B = −8.
0 −2 5 2 0 −2
1 −1 2 1 −2 3 5 −1 −5
Now, AB = 3 1 4 0 −1 4 = 11 −7 5 and
0 −2 5 2 0 −2 10 2 −18
det AB = −128 = 16 (−8) = det A det B.
Note: The determinant of the sum is not always equal to the sum of the determinants, i.e. if
A and B are n × n matrices, then det (A + B) 6= det A + det B in general. So, the determinat
function is not linear.
Example:
1 2 3 0 4 2
Let A = and B = . Then A + B = . In this case det A = −2,
3 4 −2 2 1 6
det B = 6, and det (A + B) = 22 6= 4 = det A + det B.
Theorem: Let A be an n × n matrix. Then det AT = det A.
Example:
1 −1 2 1 3 0
Let A = 3 1 4 . Then AT = −1 1 −2 . By direct calculation, it can be verified
0 −2 5 2 4 5
T
that det A = det A = 16.
Property 1 :
If any row or column of A is a zero vector, then det A = 0.
Proof :
Suppose the ith row of A contains all zeros, i.e., aij = 0 for j = 1, 2, · · · , n. Then expanding
13
Property 2 :
If the ith row or j th column of A is multiplied by a scalar c, then det A is multiplied by c.
Proof :
a11 a12 · · · a1n a11 a12 ··· a1n
a21 a22 · · · a2n a21 a22 ··· a2n
. .. .. .. .. .. .. ..
.
. . . . . . . .
Let A = . If B = , then expanding in the
ai1 ai2 · · · ain cai1 cai2 · · · cain
. .. .. .. . .. .. ..
.. . . . .. . . .
an1 an2 · · · ann an1 an2 · · · ann
ith row of B, we have
14
Property 3 :
a11 a12 · · · a1j · · · a1n a11 a12 · · · b1j · · · a1n
a21 a22 · · · a2j · · · a2n a21 a22 · · · b2j · · · a2n
Let A = .. .. .. .. .. .. , B = .. .. .. .. .. .. , and
. . . . . . . . . . . .
an1 an2 · · · anj · · · ann an1 an2 · · · bnj · · · ann
a11 a12 · · · a1j + b1j · · · a1n
a21 a22 · · · a2j + b2j · · · a2n
C = .. .. .. .. .. .. . Then det C = det A + det B. In other words,
. . . . . .
an1 an2 · · · anj + bnj · · · ann
suppose A, B, and C are identical except for the j th column and that the j th column of C is
the sum of the j th columns of A and B. Then det C = det A + det B. The same statement
is true for rows.
Proof :
Expand det C in the j th column to obtain
det C = (a1j + b1j ) A1j + (a2j + b2j ) A2j + · · · + (anj + bnj ) Anj
= (a1j A1j + a2j A2j + · · · + anj Anj ) + (b1j A1j + b2j A2j + · · · + bnj Anj )
= det A + det B.
Example:
1 −1 2 1 −6 2 1 (−1 − 6) 2 1 −7 2
Let A = 3 1 4 , B = 3 2 4 , and C = 3 (1 + 2) 4 = 3 3 4 .
0 −2 5 0 4 5 0 (−2 + 4) 5 0 2 5
Then, det A = 16, det B = 108, and det C = 124 = det A + det B.
Property 4 :
Interchanging any two rows (or columns) of A has the effect of multiplying det A by −1.
Proof :
We prove the statement for rows and assume first that two adjacent rows are interchanged,
i.e., we assume first that the ith and (i + 1)st rows are interchanged.
a11 a12 · · · a1n a11 a12 · · · a1n
a21 a22 · · · a2n a21 a22 · · · a2n
. .. .. .. . .. .. ..
. .
. . . . . . . .
Let A = ai1 ai2 · · · ain and B = ai+1, 1 ai+1, 2 · · · ai+1, n .
ai+1,1 ai+1,2 · · · ai+1,n ai1 ai2 · · · ain
. .. .. .. . .. .. ..
.. . . . .. . . .
an1 an2 · · · ann an1 an2 · · · ann
Then expanding det A in its ith row and det B in its (i + 1)st row, we obtain
det A = ai1 Ai1 + ai2 Ai2 + · · · + ain Ain
and
15
so that, from the expansions of det A and det B above, det B = − det A.
Now, suppose that i < j and that the ith and j th rows are to be interchanged. We can
do this by interchanging adjacent rows several times. It will take j − i interchanges to
move row j into the ith row. Then row i will be in the (i + 1)st row and it will take an
additional j − i − 1 interchanges to move row i into the j th row. Finally, the total number
of interchanges of adjacent rows is (j − i) + (j − i − 1) = 2 (j − i) − 1, which is odd. Thus,
det A is multiplied by −1 an odd number of times, which is what we needed to show, i.e.,
det B = (−1)2(j−i)−1 det A = − det A.
Example:
1 −1 2 0 −2 5
Let A = 3 1 4 . By interchanging the first and third rows, we obtain B = 3 1 4 .
0 −2 5 1 −1 2
−1 1 2
By interchanging the first and and second columns of A, we obtain C = 1 3 4 . By
−2 0 5
direct calculation we find that det A = 16, and det B = det C = −16.
Property 5 :
If A has two equal rows (or columns), then det A = 0.
Proof :
Suppose the ith and j th rows of A are equal. By interchanging these rows we obtain a matrix
B with the property that det B = − det A (from Property 4 ). But since row i = row j,
interchanging them gives the same matrix. Thus, A = B and det A = det B = − det A. So,
2 det A = 0 which is the case only if det A = 0.
Example:
1 −1 2 5 2 2
The matrix A = 5 7 3 has two equal rows while matrix B = 3 −1 −1 has
1 −1 2 −2 4 4
two equal columns. By direct calculation we can verify that det A = det B = 0.
Property 6 :
If one row (column) of A is a scalar multiple of another row (column), then det A = 0.
16
Proof :
Let (aj1 , aj2 , · · · , ajn ) = c (ai1 , ai2 , · · · , ain ). Then from Property 2,
from Property 5.
Example:
2 −3 5
It can be verified that 1 7 2 = 0.
−4 6 −10
From Properties 5 and 6 above we have the following theorem:
Theorem: Let A be an n × n matrix. Then det A = 0 if and only if the rows or columns of
A are linearly independent.
Property 7 :
If a scalar multiple of one row (column) of A is added to another row (column), then the
determinant of A is unchanged.
17
Proof :
Let B be the matrix obtained by adding c times the ith row of A to the j th row of A. Then
Example:
1 −1 2
Let A = 3 1 4 . Multiply the first row by −3 and adding the result to the second row
0 −2 5
1 −1 2
to obtain a new matrix B = 0 4 −2 . Now, multiply the second row of B by 12 and
0 −2 5
1 −1 2
add the result to the third row of B to obtain C = 0 4 −2 . By direct calculation it
0 0 4
can be shown that det A = det B = det C = 16.
18
1 3 5 2 1 3 5 2
−2R1 + R3
0 −1 3 4 0 −1 3 4
|A| = −→ =
2 1 9 6 0 −5 −1 2
−3R1 + R4
3 2 4 8 0 −7 −11 2
1 3 5 2 1 3 5 2
5R2 − R3
0 −1 3 4 R3 − 12 R4 0 −1 3 4
−→ = (−1) (−1) = (−2)
0 0 16 18 −→ 0 0 16 18
7R2 − R4
0 0 32 26 0 0 0 5
= (−2) (1) (−1) (16) (5) = 160
(since the final determinant is that of an upper triangular matrix).
−2 1 0 4
3 −1 5 2
2. Calculate |A| = .
−2 7 3 1
3 −7 2 5
Solution:
−2 1 0 4 3R1 + 2R2 −2 1 0 4
3 −1 5 2 R1 − R3 0 1 10 16
|A| = = 12 (−1) (−1) = 1
2
(0) = 0.
−2 7 3 1 −→ 0 −6 −3 3
3 −7 2 5 R2 − R4 0 6 3 −3
Alternatively,
−2 1 0 4 −2 0 0 0
C1 + 2C2
3 −1 5 2 1 3 1 5 8
|A| = −→ = 2
−2 7 3 1 −2 12 3 −3
2C1 + C4
3 −7 2 5 3 −11 2 11
−2 0 0 0
5C2 − C3
3 1 0 0
−→ = 21 (−1) = − 21 (0) = 0.
−2 12 57 −99
−8C2 + C4
3 −11 −57 99
1 −2 3 −5 7
2 0 −1 −5 6
3. Calculate |A| = 4 7 3 −9 4 .
3 1 −2 −2 3
−5 −1 3 7 −9
Solution:
1 −2 3 −5 7 1 −2 3 −5 7
2 0 −1 −5 6 2 0 −1 −5 6
R2 + R5
|A| = 4 7 3 −9 4 = 4 7 3 −9 4 = 0,
−→
3 1 −2 −2 3 3 1 −2 −2 3
−5 −1 3 7 −9 −3 −1 2 2 −3
19
MATRIX INVERSION
For an n × n matrix A, the n × n matrix B such that AB = BA = In is called the inverse
of A and is denoted by B = A−1 .
Note: Matrix inversion is defined for square matrices only; the condition AA−1 = A−1 A
rules out inversion of nonsquare matrices.
Not all square matrices are invertible. An invertible matrix is said to be nonsingular while
a square matrix with no inverse is called a singular matrix.
Theorem: Let A be an n × n matrix. Then A is invertible if and only if det A 6= 0.
Theorem: If A is invertible, then det A 6= 0 and det A−1 = det1 A .
Proof : Suppose A is invertible. Then from the preceeding theorem, det A 6= 0. Applying a
previous theorem,
1 = det I = det AA−1 = det A det A−1
20
so that
1
det A−1 = .
det A
Proof :
Let C = [cij ] = A (adjA). Then
a11 a12 · · · a1n A11 A21 · · · An1
a21 a22 · · · a2n A12 A22 · · · An2
C = .. .. .. .. .. .. .. .. . . . . . . . . (5)
. . . . . . . .
an1 an2 · · · ann A1n A2n · · · Ann
21
which is the expansion of det A in the ith row of A. On the other hand, if i 6= j, then the
sum in (6) equals zero. Thus,
(
det A if i = j
cij = .
0 if i 6= j
Examples:
Determine the inverse of each of the following matrices:
−1 2
(a) A =
2 −4
3 1
(b) B =
2 4
2 4 3
(c) C = 0 1 −1
3 5 7
3 1 0
(d ) D = −2 −4 3
5 4 −2
Solution:
(a) det A = (−1) (−4) − (2) (2) = 0. So, A−1 does not exist.
(b) det B = 3 (4) − (2) (1) = 10 6= 0. So, B −1 exists. In this case,
1 4 −1 2/5 −1/10
B =−1
= −1 .
10 −2 3 /5 3/10
22
and
C11 C21 C31 12 −13 −7
adjC = C12 C22 C32 = −3 5 2 .
C13 C23 C33 −3 2 2
So,
12 −13 −7 4 −13/3 −7/3
1 .
C −1 = −3 5 2 = −1 5/3 2/3
3
−3 2 2 −1 2/3 2/3
R2 + R3 1 0 0 | −2 11/3 −1/3
−→ 0 1 0 | 1 −2/3 1/3 = [I | A−1 ].
R1 + 2R2 − R3 0 0 1 | 1 −5/3 1/3
−2 11/3 −1/3
Since A has been reduced to I, A is nonsingular, and A−1 = 1 −2/3 1/3 .
1 −5/3 1/3
23
−1 2 −3 −2 11/3 −1/3 1 0 0
As a check, AA−1 = 0 1 −1 1 −2/3 1/3 = 0 1 0 = I.
3 −1 7 1 −5/3 1/3 0 0 1
−1 2 −1
2. Use Gauss-Jordan elimination to show that the inverse of A = 1 −1 1 does
2 −4 2
not exist.
Solution:
−R1
−1 2 −1 | 1 0 0 1 −2 1 | −1 0 0
R1 + R2
[A | I] = 1 −1 1 | 0 1 0 0 1 0 | 1 1 0
−→
2 −4 2 | 0 0 1 0 0 0 | 2 0 1
2R1 + R3
1 0 1 | 1 2 0
R1 + 2R2 0 1 0 | 1 1 0 .
−→
0 0 0 | 2 0 1
The process has not reduced A to I. So, A−1 does not exist.
24