Matrix Algebra: 9.1 Sums of Matrices
Matrix Algebra: 9.1 Sums of Matrices
Lecture 9
Matrix Algebra
75
Matrix Algebra
Theorem 9.4: Let A, B, C be matrices of the same size and let α, β be scalars. Then
76
Lecture 9
Rm
Rp TB Rn TA
b b
x b TB (x) TA (TB(x))
(TA ◦ TB )(x)
Now Be1 is
Be1 = b1 b2 · · · bp e1 = b1 .
Definition 9.5: For A ∈ Rm×n and B ∈ Rn×p , with B = b1 b2 · · · bp , we define the
product AB by the formula
AB = Ab1 Ab2 · · · Abp .
The product AB is defined only when the number of columns of A equals the number of
rows of B. The following diagram is useful for remembering this:
(m × n) · (n × p) → m × p
From our definition of AB, the standard matrix of the composite mapping TA ◦ TB is
C = AB.
77
Matrix Algebra
−4 2 4 −4
1 2 −2
AB = −1 −5 −3 3
1 1 −3
−4 −4 −3 −1
2
=
7
2 0
=
7 9
2 0 4
=
7 9 10
2 0 4 4
=
7 9 10 2
On the other hand, BA is not defined! B has 4 columns and A has 2 rows.
−4 4 3 −1 −1 0
A = 3 −3 −1 , B = −3 0 −2
−2 −1 1 −2 1 −2
−4 4 3 −1 −1 0
AB = 3 −3 −1 −3 0 −2
−2 −1 1 −2 1 −2
−14
= 8
3
−14 7
= 8 −4
3 3
−14 7 −14
= 8 −4 8
3 3 0
78
Lecture 9
An important matrix that arises frequently is the identity matrix In ∈ Rn×n of size
n:
1 0 0 ··· 0
0 1 0 · · · 0
In = .. .. .. ..
. . . · · · .
0 0 0 ··· 1
You should verify that for any A ∈ Rn×n it holds that AIn = In A = A. Below are some
basic algebraic properties of matrix multiplication.
Ak = |AAA
{z· · · A}
k times
79
Matrix Algebra
Definition 9.10: Given a matrix A ∈ Rm×n , the transpose of A is the matrix AT whose
ith column is the ith row of A.
80
Lecture 9
Next compute BT AT :
−2 −1 0 −2 3
BT AT = 1 −2 0 1 −1
2 0 −1 0 −3
3 −5
= −4
5 = (AB)T
−4 9
Theorem 9.12: Let A and B be matrices of appropriate sizes. The following hold:
(1) (AT )T = A
(2) (A + B)T = AT + BT
(3) (αA)T = αAT
(4) (AB)T = BT AT
Example 9.13. Let T : R2 → R2 be the linear mapping that first contracts vectors by a
factor of k = 3 and then rotates by an angle θ. What is the standard matrix A of T?
Solution. Let e1 = (1, 0) and e2 = (0, 1) denote the standard
unit vectors in R2 . From
Lecture 8, the standard matrix of T is A = T(e1 ) T(e2 ) . Recall that the standard matrix
of a rotation by θ is
cos(θ) − sin(θ)
sin(θ) cos(θ)
Contracting e1 by a factor of k = 3 results in ( 13 , 0) and then rotation by θ results in
1
cos(θ)
3
1 = T(e1 ).
3
sin(θ)
81
Matrix Algebra
Therefore, "1 #
3
cos(θ) − 13 sin(θ)
A = T(e1 ) T(e2 ) =
1 1
3
sin(θ) 3
cos(θ)
1
On the other hand, the standard matrix corresponding to a contraction by a factor k = 3
is
"1 #
3
0
1
0 3
82
Lecture 10
Lecture 10
Invertible Matrices
If A is invertible then can it have more than one inverse? Suppose that there exists C1 , C2
such that ACi = Ci A = In . Then
Thus, if A is invertible, it can have only one inverse. This motivates the following definition.
83
Invertible Matrices
Compute CA:
−14 −3 −6 1 −3 0 1 0 0
CA = −5 −1 −2 −1 2 −2 = 0 1 0
2 0 1 −2 6 1 0 0 1
Theorem 10.4: Let A ∈ Rn×n and suppose that A is invertible. Then for any b ∈ Rn
the matrix equation Ax = b has a unique solution given by A−1 b.
Proof: Let b ∈ Rn be arbitrary. Then multiplying the equation Ax = b by A−1 from the
left we obtain that
A−1 Ax = A−1 b
⇒ In x = A−1 b
⇒ x = A−1 b.
Ax = A(A−1 b) = AA−1 b = In b = b
and thus x = A−1 b is a solution. If x̃ is another solution of the equation, that is, Ax̃ = b,
then multiplying both sides by A−1 we obtain that x̃ = A−1 b. Thus, x = x̃.
Example 10.5. Use the result of Example 10.3. to solve the linear system Ax = b if
1 −3 0 1
A = −1
2 −2 , b = −3 .
−2 6 1 −1
84
Lecture 10
Verify:
1 −3 0 1 1
−1 2 −2 0 = −3
−2 6 1 1 −1
The following theorem summarizes the relationship between the matrix inverse and ma-
trix multiplication and matrix transpose.
(A−1 )−1 = A.
85
Invertible Matrices
In summary, to determine if A−1 exists and to simultaneously compute it, we compute the
RREF of the augmented matrix
A In ,
that is, A augmented with the n × n identity matrix. If the RREF of A is In , that is
A I n ∼ I n c1 c2 · · · cn
then
A−1 = c1 c2 · · · cn .
If the RREF of A is not In then A is not invertible.
1 3
Example 10.7. Find the inverse of A = if it exists.
−1 −2
Solution. Form the augmented matrix A I2 and row reduce:
1 3 1 0
A I2 =
−1 −2 0 1
Verify:
−1 1 3 −2 −3 1 0
AA = = .
−1 −2 1 1 0 1
1 0 3
Example 10.8. Find the inverse of A = 1 1 0 if it exists.
−2 0 −7
86
Lecture 10
Solution. Form the augmented matrix A I3 and row reduce:
1 0 3 1 0 0 1 0 3 1 0 0
−R1 +R2 , 2R1 +R2
1 1 0 0 1 0 −−−−−−−−−−→ 0 1 −3 −1 1 0
−2 0 −7 0 0 1 0 0 −1 2 0 1
−R3 :
1 0 3 1 0 0 1 0 3 1 0 0
−R3
0 1 −3 −1 1 0 − −→ 0 1 −3 −1 1 0
0 0 −1 2 0 1 0 0 1 −2 0 −1
3R3 + R2 and −3R3 + R1 :
1 0 3 1 0 0 1 0 0 7 0 3
3R3 +R2 , −3R3 +R1
0 1 −3 −1 1 0 − −−−−−−−−−−→ 0 1 0 −7 1 −3
0 0 1 −2 0 −1 0 0 1 −2 0 −1
Therefore, rref(A) = I3 , and therefore A is invertible. The inverse is
7 0 3
A−1 = −7 1 −3
−2 0 −1
Verify:
1 0 3 7 0 3 1 0 0
AA−1 = 1 1 0 −7 1 −3 = 0 1 0
−2 0 −7 −2 0 −1 0 0 1
1 0 1
Example 10.9. Find the inverse of A = 1 1 −2 if it exists.
−2 0 −2
Solution. Form the augmented matrix A I3 and row reduce:
1 0 1 1 0 0 1 0 1 1 0 0
−R1 +R2 , 2R1 +R2
1 1 −2 0 1 0 − −−−−−−−−−→ 0 1 −3 −1 1 0
−2 0 −2 0 0 1 0 0 0 2 0 1
We need not go further since the rref(A) is not I3 (rank(A) = 2 ). Therefore, A is not
invertible.
A−1 A = In .
87
Invertible Matrices
Similarly, the standard matrix of (TA ◦ TA−1 ) is also In . Intuitively, the linear mapping TA−1
undoes what TA does, and conversely. Moreover, since Ax = b always has a solution, TA is
onto. And, because the solution to Ax = b is unique, TA is one-to-one.
Proof: This is a summary of all the statements we have proved about matrices and matrix
mappings specialized to the case of square matrices A ∈ Rn×n . Note that for non-square
matrices, one-to-one does not imply ontoness, and conversely.
Example 10.11. Without doing any arithmetic, write down the inverse of the dilation
matrix " #
3 0
A= .
0 5
Example 10.12. Without doing any arithmetic, write down the inverse of the rotation
matrix " #
cos(θ) − sin(θ)
A= .
sin(θ) cos(θ)
88
Lecture 11
Lecture 11
Determinants
a11 x1 + a12 x2 = b1
a21 x1 + a22 x2 = b2 .
89
Determinants
Let
a22 a23 a21 a23 a21 a22
A11 = , A12 = , and A13 = .
a32 a33 a31 a33 a31 a32
Then we can write
D = a11 det(A11 ) − a12 det(A12 ) + a13 det(A13 ).
a22 a23
The matrix A11 = is obtained from A by deleting the 1st row and the 1st column:
a32 a33
a11 a12 a13
a 22 a23
A = a21 a22 a23 −→ A11 =
.
a32 a33
a31 a32 a33
90
Lecture 11
a21 a23
Similarly, the matrix A12 = is obtained from A by deleting the 1st row and the
a31 a33
2nd column:
a11 a12 a13
a21 a 23
A = a21 a22 a23 −→ A12 = .
a31 a33
a31 a32 a33
a21 a22
Finally, the matrix A13 = is obtained from A by deleting the 1st row and the 3rd
a31 a32
column:
a11 a12 a13
a21 a22
A = a21 a22 a23 −→ .
a31 a32
a31 a32 a33
Notice also that the sign in front of the coefficients a11 , a12 , and a13 , alternate. This motivates
the following definition.
Definition 11.3: Let A be a 3 × 3 matrix. Let Ajk be the 2 × 2 matrix obtained from
A by deleting the jth row and kth column. Define the cofactor of ajk to be the number
Cjk = (−1)j+k det Ajk . Define the determinant of A to be
This definition of the determinant is called the expansion of the determinant along the
first row. In the cofactor Cjk = (−1)j+k det Ajk , the expression (−1)j+k will evaluate to
either 1 or −1, depending on whether j + k is even or odd. For example, the cofactor of a12
is
C12 = (−1)1+2 det A12 = − det A12
and the cofactor of a13 is
C13 = (−1)1+3 det A13 = det A13 .
We can also compute the cofactor of the other entries of A in the obvious way. For example,
the cofactor of a23 is
C23 = (−1)2+3 det A23 = − det A23 .
A helpful way to remember the sign (−1)j+k of a cofactor is to use the matrix
+ − +
− + − .
+ − +
This works not just for 3 × 3 matrices but for any square n × n matrix.
91
Determinants
= 72 + 14 − 9
= 77
We can compute the determinant of a matrix A by expanding along any row or column.
For example, the expansion of the determinant for the matrix
a11 a12 a13
A = a21 a22 a23
a31 a32 a33
The punchline is that any way you choose to expand (row or column) you will get the same
answer. If a particular row or column contains zeros, say entry ajk , then the computation of
the determinant is simplified if you expand along either row j or column k because ajk Cjk = 0
and we need not compute Cjk .
Solution. In Example 11.4, we computed det(A) = 77 by expanding along the 1st row.
92
Lecture 11
det A = (1) det A31 − (0) det A32 + (6) det A33
−2 3 4 −2
= +6
3 5 2 3
= −19 + 96
= 77
The next theorem tells us that we can compute the determinant by expanding along any
row or column.
Corollary 11.8: If A has a row or column containing all zeros then det A = 0.
Proof. If the jth row contains all zeros then aj1 = aj2 = · · · = ajn = 0:
93
Determinants
Corollary 11.9: For any square matrix A it holds that det A = det AT .
Sketch of the proof. Expanding along the jth row of A is equivalent to expanding along
the jth column of AT .
1 3 0 −2
1 2 −2 −1
A=
0
0 2 1
−1 −3 1 0
Solution. The third row contains two zeros, so expand along this row:
1 3 0 −2
1 2 −2 −1
A=
0
0 2 1
−1 −3 1 0
94
Lecture 11
Theorem 11.13: The determinant of a triangular matrix is the product of its diagonal
entries.
95
Determinants
96
Lecture 12
Lecture 12
Theorem 12.1: Suppose that A ∈ Rn×n and let B be the matrix obtained by interchang-
ing two rows of A. Then det B = − det A.
a11 a12 a21 a22
Proof. Consider the 2 × 2 case. Let A = and let B = . Then
a21 a22 a11 a12
det B = a12 a21 − a11 a22 = −(a11 a22 − a12 a21 ) = − det A.
The general case is proved by induction.
97
Properties of the Determinant
Corollary 12.2: If A ∈ Rn×n has two rows (or two columns) that are equal then
det(A) = 0.
Proof. Suppose that A has rows j and k that are equal. Let B be the matrix obtained by
interchanging rows j and k. Then by the previous theorem det B = − det A. But clearly
B = A, and therefore det B = det A. Therefore, det(A) = − det(A) and thus det A = 0.
Now we consider how the determinant behaves under elementary row operations of Type
2.
Theorem 12.3: Let A ∈ Rn×n and let B be the matrix obtained by multiplying a row of
A by β. Then det B = β det A.
Proof. Suppose that B is obtained from A by multiplying the jth row by β. The rows of A
and B different from j are equal, and therefore
In particular, the (j, k) cofactors of A and B are equal. The jth row of B is βaj . Then,
expanding det B along the jth row:
= β(aj · cTj )
= β det A.
Theorem 12.4: Let A ∈ Rn×n and let B be the matrix obtained from A by adding β
times the kth row to the jth row. Then det B = det A.
Proof. For any matrix A and any row vector r = [r1 r2 · · · rn ] the expression
is the determinant of the matrix obtained from A by replacing the jth row with the row r.
Therefore, if k 6= j then
ak · cTj = 0
98
Lecture 12
since then rows k and j are equal. The jth row of B is bj = aj + βak . Therefore, expanding
det B along the jth row:
= det A.
Example 12.5. Suppose that A is a 4 × 4 matrix and suppose that det A = 11. If B is
obtained from A by interchanging rows 2 and 4, what is det B?
Solution. Interchanging (or swapping) rows changes the sign of the determinant. Therefore,
det B = −11.
Example 12.6. Suppose that A is a 4 × 4 matrix and suppose that det A = 11. Let
a1 , a2 , a3 , a4 denote the rows of A. If B is obtained from A by replacing row a3 by 3a1 + a3 ,
what is det B?
Solution. This is a Type 3 elementary row operation, which preserves the value of the de-
terminant. Therefore,
det B = 11.
Example 12.7. Suppose that A is a 4 × 4 matrix and suppose that det A = 11. Let
a1 , a2 , a3 , a4 denote the rows of A. If B is obtained from A by replacing row a3 by 3a1 + 7a3 ,
what is det B?
Solution. This is not quite a Type 3 elementary row operation because a3 is multiplied by
7. The third row of B is b3 = 3a1 + 7a3 . Therefore, expanding det B along the third row
= 7(a3 · cT3 )
= 7 det A
= 77
99
Properties of the Determinant
Example 12.8. Suppose that A is a 4 × 4 matrix and suppose that det A = 11. Let
a1 , a2 , a3 , a4 denote the rows of A. If B is obtained from A by replacing row a3 by 4a1 + 5a2 ,
what is det B?
Solution. Again, this is not a Type 3 elementary row operation. The third row of B is
b3 = 4a1 + 5a2 . Therefore, expanding det B along the third row
=0+0
=0
Proof. Beginning with the matrix A, perform elementary row operations and generate a
sequence of matrices A1 , A2 , . . . , Ap such that Ap is in row echelon form and thus triangular:
A ∼ A1 ∼ A2 ∼ · · · ∼ Ap .
Thus, matrix Ai is obtained from Ai−1 by performing one of the elementary row operations.
From Theorems 12.1, 12.3, 12.4, if det Ai−1 6= 0 then det Ai 6= 0. In particular, det A = 0 if
and only if det Ap = 0. Now, Ap is triangular and therefore its determinant is the product
of its diagonal entries. If all the diagonal entries are non-zero then det A = det Ap 6= 0. In
this case, A is invertible because there are r = n leading entries in Ap . If a diagonal entry
of Ap is zero then det A = det Ap = 0. In this case, A is not invertible because there are
r < n leading entries in Ap . Therefore, A is invertible if and only if det A 6= 0.
Theorem 12.10: Let A ∈ Rn×n and let B = βA, that is, B is obtained by multiplying
every entry of A by β. Then det B = β n det A.
100
Lecture 12
= β 2 det A.
= β 3 det A.
det(3A) = 34 det A
= 81 · 11
= 891
The following theorem characterizes how the determinant behaves under matrix multi-
plication.
101
Properties of the Determinant
Therefore
det(A) det(A−1 ) = 1
or equivalently
1
det A−1 = .
det A
102
Lecture 13
Lecture 13
where Cjk = (−1)j+k det Ajk is called the (j, k)-Cofactor of A and
aj = aj1 aj2 · · · ajn
is the jth row of A. If cj = Cj1 Cj2 · · · Cjn then
Cj1
C
j2
det A = aj1 aj2 · · · ajn .. = aj · cTj .
.
Cjn
Suppose that B is the matrix obtained from A by replacing row aj with a distinct row ak .
To compute det B expand along its jth row bj = ak :
det B = ak · cTj = 0.
The Cofactor Method is an alternative method to find the inverse of an invertible matrix.
Recall that for any matrix A ∈ Rn×n , if we expand along the jth row then
det A = aj · cTj .
103
Applications of the Determinant
Then,
a1
a2
T
A(Cof(A)) = .. cT1 cT2 · · · cTn
.
an
a1 cT1 a1 cT2 · · · a1 cTn
a cT a cT · · · a cT
2 1 2 2 2 n
=
.. .. .. ..
. . . .
T T T
an c1 an c2 · · · an cn
det A 0 ··· 0
0 det A · · · 0
=
.. .. .. ..
. . . .
0 0 · · · det A
A(Cof(A))T = det(A)In .
1
A−1 = (Cof(A))T
det A
Although this is an explicit and elegant formula for A−1, it is computationally intensive,
even for 3 × 3 matrices. However, for the 2 × 2 case it provides a useful formula to compute
104
Lecture 13
a b d −c
the matrix inverse. Indeed, if A = we have Cof(A) = and therefore
c d −b a
−1 1 d −b
A = .
ad − bc −c a
When does an integer matrix have an integer inverse? We can answer this question
using the Cofactor Method. Let us first be clear about what we mean by an integer matrix.
Suppose that A ∈ Rn×n is an invertible integer matrix. Then det(A) is a non-zero integer
and (Cof(A))T is an integer matrix. If A−1 is also an integer matrix then det(A−1 ) is also
an integer. Now det(A) det(A−1) = 1 thus it must be the case that det(A) = ±1. Suppose
on the other hand that det(A) = ±1. Then by the Cofactor method
1
A−1 = (Cof(A))T = ±(Cof(A))T
det(A)
and therefore A−1 is also an integer matrix. We have proved the following.
Theorem 13.2: An invertible integer matrix A ∈ Rn×n has an integer inverse A−1 if and
only if det A = ±1.
We can use the previous theorem to generate integer matrices with an integer inverse
as follows. Begin with an upper triangular matrix M0 having integer entries and whose
diagonal entries are either 1 or −1. By construction, det(M0 ) = ±1. Perform any sequence
of elementary row operations of Type 1 and Type 3. This generates a sequence of matrices
M1 , . . . , Mp whose entries are integers. Moreover,
M0 ∼ M1 ∼ · · · ∼ Mp .
Therefore,
±1 = det(M) = det(M1 ) = · · · = det(Mp ).
105
Applications of the Determinant
1
x1 = (b1 C11 + b2 C21 + · · · + bn Cn1 ).
det A
The expression b1 C11 + b2 C21 + · · · + bn Cn1 is the expansion of the determinant along the
first column of the matrix obtained from A by replacing the first column with b:
b1 a12 · · · a1n
b2 a22 · · · a2n
det .. .. .. . = b1 C11 + b2 C21 + · · · + bn Cn1
. . . ..
bn an2 · · · ann
Similarly,
1
x2 = (b1 C12 + b2 C22 + · · · + bn Cn2 )
det A
and (b1 C12 + b2 C22 + · · · + bn Cn2 ) is the expansion of the determinant along the second
column of the matrix obtained from A by replacing the second column with b. In summary:
Although this is an explicit and elegant formula for x, it is computationally intensive, and
used mainly for theoretical purposes.
106