1 Matrices Lecture Notes
1 Matrices Lecture Notes
Definitions
Let m and n be positive integers.
An m × n matrix is a rectangular array of numbers having m rows and n
columns. Such a matrix is said to have size m × n.
A row matrix (or row) is a 1 × n matrix, and a column matrix (or column) is
an m × 1 matrix.
A square matrix is an n × n matrix.
The (i, j)-entry of a matrix is the entry in row i and column j. For a matrix
A, the (i, j)-entry of A is often written as aij .
1 Equality: two matrices are equal if and only if they have the same
size and the corresponding entries are equal.
2 Zero Matrix: an m × n matrix with all entries equal to zero.
3 Addition: matrices must have the same size; add corresponding
entries.
4 Scalar Multiplication: multiply each entry of the matrix by the
scalar.
5 Negative of a Matrix: for an m × n matrix A, its negative is denoted
−A and −A = (−1)A.
6 Subtraction: for m × n matrices A and B, A − B = A + (−1)B.
Definition
Let A = [aij ] and B = [bij ] be two m × n matrices. Then A + B = C where
C is the m × n matrix C = [cij ] defined by
Example
1 3 0 −2
Let A = ,B = . Then,
2 5 6 1
1 + 0 3 + −2
A+B =
2+6 5+1
1 1
=
8 6
Example
2 0 −1
Let A = 3 1 −2 .
0 4 5
Then
3(2) 3(0) 3(−1)
3A = 3(3) 3(1) 3(−2)
3(0) 3(4) 3(5)
6 0 −3
= 9 3 −6
0 12 15
Problem
Let A and B be m × n matrices. Simplify the expression
Solution
Definitions
A row matrix or column matrix is often called a vector, and such matrices
are referred to as row vectors and column vectors, respectively. If X is a row
vector of size 1 × n, and Y is a column vector of size m × 1, then we write
y1
y2
X = x1 x2 · · · xn and Y = .
.
.
ym
Problem
Express the following system of linear equations in vector form.
Solution
2 4 −3 −6
x1 0 + x2 −1 + x3 5 = 0
1 1 4 1
Problem
Compute the product AX for
1 4 2
A= and X =
5 0 3
Solution
1 4 2 1 4 2 12 14
AX = =2 +3 = + =
5 0 3 5 0 10 0 10
Problem
Compute AY for
2
1 0 2 −1 −1
A = 2 −1 0 1 and Y =
1
3 1 3 1
4
Solution
1 0 2 −1 0
AY = 2 2 + (−1) −1 + 1 0 + 4 1 = 9
3 1 3 1 12
Such a system can be expressed in matrix form using matrix vector multiplication,
a11 a12 · · · a1n x1 b1
a21 a22 · · · a2n x2 b2
.. .. .. .. = ..
. . . . .
am1 am2 ··· amn xn bm
Thus a system of linear equations can be expresses as a matrix equation AX = B,
where A is the coefficient matrix, B is the constant matrix, and X is the matrix of
variables.
Problem
Express the following system of linear equations in matrix form.
Solution
2 4 −3 x1 −6
0 −1 5 x2 = 0
1 1 4 x3 1
x1 A1 + x2 A2 + · · · xn An = B
Proof.
(a) One first checks
x that
(x1 , . . . , xn ) is a solution to the original system if
1
x2
and only if X = .
.
is a solution to AX = B.
.
xn
Proof.
(b) Once (a) is taken care of, it gives a one-to-one correspondence between
the set of solutions to the original system and the set of solutions to
AX = B: x1
x2
(x1 , . . . , xn ) 7→ .
.
.
.
xn
This is (3), and it implies that the two sets have the same cardinality, and
(2) follows.
Solution
Solve the system AX = B where X is a column
vector with four entries. Do so by
putting the augmented matrix A B in reduced row-echelon form.
1
1 0 0 1
1 0 2 −1 1 7
0 1 0 1 − 57
2 −1 0 1 1 → ··· →
3 1 3 1 1 0 0 1 −1 3
7
Since there are infinitely many solutions (x4 is assigned a parameter), choose any
value for x4 . Choosing x4 = 0 (which is the simplest thing to do) gives us
1 1 0 2
1 5 3 1 5 3
B = 1 = 2 − −1 + 0 = A1 − A2 + A3 + 0A4 .
7 7 7 7 7 7
1 3 1 3
i.e., the first column of AB is AB1 , the second column of AB is AB2 , etc.
Note that AB has size m × p.
Solution
AB has columns
−1 1
−1 0 3 0 , AB2 = −1 0 3
AB1 = −2 ,
2 −1 1 2 −1 1
1 0
2
−1 0 3 4
and AB3 =
2 −1 1
0
4 −1 −2
Thus, AB = .
−1 4 0
Matrices: Matrix Arithmetic Multiplication of Matrices Page 24/90
Compatibility for Matrix Multiplication
Definition
Let A and B be matrices, and suppose that A is m × n.
In order for the product AB to exist, the number of rows in B must be
equal to the number of columns in A, implying that B is an n × p
matrix for some p.
When defined, AB is an m × p matrix.
If the product is defined, then A and B are said to be compatible for
(matrix) multiplication.
Solution
In this product, we compute
1 2 0 0 0 0
=
3 4 0 0 0 0
Hence, A0 = 0.
Example
Using the above definition, the (2, 3)-entry of the product
−1 1 2
−1 0 3
0 −2 4
2 −1 1
1 0 0
is computed using the second row of the first matrix, and the third column
of the second matrix, resulting in
2 × 2 + (−1) × 4 + 1 × 0 = 4 − 4 + 0 = 0.
Matrices: Matrix Arithmetic The (i, j)-Entry of a Product Page 28/90
Questions on Matrix Multiplication
Solution
7 −5 4 −6
AB = −3 3 −6 0
−11 7 −2 12
Solution
1 0
GH =
1 0
HG = 1
In this example, GH and HG both exist, but they are not equal. They
aren’t even the same size!
Solution
−1 1
PQ =
−2 −1
1 −1
QP =
6 −3
In this example, PQ and QP both exist and are the same size, but
PQ 6= QP.
Solution
2 4
UV =
6 8
2 4
VU =
6 8
In this particular example, the matrices commute, i.e., UV = VU.
Theorem
Let A, B, and C be matrices of the appropriate sizes, and let r ∈ R be a
scalar. Then the following properties hold.
1 A(B + C ) = AB + AC .
(matrix multiplication distributes over matrix addition).
2 (B + C )A = BA + CA.
(matrix multiplication distributes over matrix addition).
3 A (BC ) = (AB) C . (matrix multiplication is associative).
4 r (AB) = (rA)B = A(rB).
1 AB 5 (AB)C
2 BA 6 (A+B)
3 A+C
4 A(BC) 7 C(A+B)
Problem
Let A and B be m × n matrices, and let C be an n × p matrix. Prove that
if A and B commute with C , then A + B commutes with C .
Proof.
We are given that AC = CA and BC = CB. Consider (A + B)C .
(A + B)C = AC + BC
= CA + CB
= C (A + B)
Proof.
We must show that (AB)C = C (AB) given that AC = CA and BC = CB.
AT = [aij ]T = [aji ]
1 (AT )T = A 3 (A + B)T = AT + B T
2 (rA)T = rAT 4 (AC )T = C T AT
To prove each these properties, you only need to compute the (i, j)-entries
of the matrices on the left-hand side and the right-hand side. And you can
do it!
Matrices: Matrix Arithmetic The Transpose Page 39/90
Problem
T 2 1
1 −1 0
Find the matrix A if A + 3 = 0 5 .
1 2 4
3 8
Solution
T 2 1
1 −1 0
A+3 = 0 5
1 2 4
3 8
1 −1 0 2 0 3
A+3 =
1 2 4 1 5 8
2 0 3 1 −1 0
A = −3
1 5 8 1 2 4
−1 3 3
A =
−2 −1 −4
Definition
The matrix A is called symmetric if and only if AT = A. Note that this
immediately implies that A is a square matrix.
Examples
0 2 5 −1
−1 0 5
2 −3 2 1 −3 0
, 0 2 11 ,
−3 17 5 −3 2 −7
5 11 −3
−1 0 −7 4
are symmetric matrices, and each is symmetric about its main diagonal.
Proof.
Problem
Show that if A is a square matrix, then A − AT is skew-symmetric.
Solution
We must show that (A − AT )T = −(A − AT ). Using the properties of matrix
addition, scalar multiplication, and transposition
(A − AT )T = AT − (AT )T = AT − A = −(A − AT ).
Matrices: Matrix Arithmetic The Transpose Page 43/90
The n × n Identity Matrix
Definition
For each n ≥ 2, the n × n identity matrix, denoted In , is the matrix having ones
on its main diagonal and zeros elsewhere, and is defined for all n ≥ 2.
Example
1 0 0
1 0
I2 = , I3 = 0
1 0
0 1
0 0 1
Definition
Let n ≥ 2. For each j, 1 ≤ j ≤ n, we denote by Ej the j th column of In .
Example
1 0 0
When n = 3, E1 = 0 , E2 = 1 , E3 = 0 .
0 0 1
Matrices: Matrix Arithmetic The Identity and Inverse Page 44/90
Theorem
Let A be an m × n matrix Then AIn = A and Im A = A.
Proof
The (i, j)-entry of AIn is the product
of the i th row of A = [aij ], namely
ai1 ai2 · · · aij · · · ain with the j th column of In , namely Ej . Since Ej
has a one in row j and zeros elsewhere,
ai1 ai2 · · · aij · · · ain Ej = aij
Definition
Let A be an n × n matrix. Then B is an inverse of A if and only if AB = In and
BA = In . Note that since A and In are both n × n, B must also be an n × n
matrix.
Example
1 2 −2 1
Let A = and B = 3 . Then
3 4 2 − 12
1 0
AB =
0 1
and
1 0
BA =
0 1
so B is an inverse of A.
A0n = 0n A = On
Pn
for all n × n matrices A: The (i, j)-entry of On A is equal to k=1 0akj = 0.
Theorem
If A is a square matrix and B and C are inverses of A, then B = C .
Proof.
Since B and C are inverses of A, AB = I = BA and AC = I = CA. Then
C = CI = C (AB) = CAB
and
B = IB = (CA)B = CAB
so B = C .
The preceding theorem tells us that B is the inverse of A, rather than just an
inverse of A.
AA−1 = I = A−1 A
This can easily be verified by computing the products AA−1 and A−1 A.
−1 a b 1 d −b
AA =
c d ad − bc −c a
1 a b d −b
=
ad − bc c d −c a
1 ad − bc 0 1 0
= =
ad − bc 0 −bc + ad 0 1
Problem
Suppose that A is any n × n matrix.
How do we know whether or not A−1 exists?
If A−1 exists, how do we find it?
Solution
The matrix inversion algorithm.
Although the formula for the inverse of a 2 × 2 matrix is quicker and easier to use
than the matrix inversion algorithm, the general formula for the inverse an n × n
matrix, n ≥ 3 (which we will see later), is more complicated and difficult to use
than the matrix inversion algorithm. To find inverses of square matrices that are
not 2 × 2, the matrix inversion algorithm is the most efficient method to use.
Algorithm.
Solution
Using the matrix inversion algorithm
1 0 −1 1 0 0 1 0 −1 1 0 0
−2 1 3 0 1 0 → 0 1 1 2 1 0 →
−1 1 2 0 0 1 0 1 1 1 0 1
1 0 −1 1 0 0
0 1 1 2 1 0
0 0 0 −1 −1 1
Example
The system of linear equations
2x − 7y = 3
5x − 18y = 8
2 If BA = CA, then
(BA)A−1 = (CA)A−1
B(AA−1 ) = C (AA−1 )
BI = CI
B = C
Problem
Find square matrices A, B and C for which AB = AC but B 6= C .
Matrices: Matrix Arithmetic Finding the Inverse of a Matrix Page 63/90
Inverses of Transposes and Products
Example
Suppose A is an invertible matrix. Then
and
(A−1 )T AT = (AA−1 )T = I T = I
This means that (AT )−1 = (A−1 )T .
Example
Suppose A and B are invertible n × n matrices. Then
and
(B −1 A−1 )(AB) = B −1 (A−1 A)B = B −1 IB = B −1 B = I
This means that (AB)−1 = B −1 A−1 .
Matrices: Matrix Arithmetic Properties of the Inverse Page 64/90
Inverses of Transposes and Products
The previous two examples prove the first two parts of the following theorem.
Theorem
1 If A is an invertible matrix, then (AT )−1 = (A−1 )T .
2 If A and B are invertible matrices, then AB is invertible and
(AB)−1 = B −1 A−1
(the third part is proved by iterating the above, or, more formally, by using
the mathematical induction)
Theorem
1 I is invertible, and I −1 = I .
2 If A is invertible, so is A−1 , and (A−1 )−1 = A.
3 If A is invertible, so is Ak , and (Ak )−1 = (A−1 )k .
(Ak means A multiplied by itself k times)
4 If A is invertible and p ∈ R is nonzero, then pA is invertible, and
(pA)−1 = p1 A−1 .
3
− 21
T 2
3I − A = 1
−1 2
3
− 12
−AT = 2
1 − 3I
−1 2
3
− 12
T 2 3 0
−A = 1 −
−1 2
0 3
− 32 − 12
−AT =
−1 − 52
3
2 1
A = 1 5
2 2
If A3 = 4I , then A is invertible.
Solution
If A3 = 4I , then
1 3
A =I
4
so
1 1
( A2 )A = I and A( A2 ) = I
4 4
Theorem
Let A be an n × n matrix, and let X , B be n × 1 vectors. The following
conditions are equivalent.
1 The rank of A is n.
2 A can be transformed to In by elementary row operations.
3 A is invertible.
4 There exists an n × n matrix C with the property that CA = In .
5 The system AX = B has a unique solution X for any choice of B.
6 AX = 0 has only the trivial solution, X = 0.
7 There exists an n × n matrix C with the property that AC = In .
Theorem
If A and B are n × n matrices such that AB = I , then BA = I . Furthermore, A
and B are invertible, with B = A−1 and A = B −1 .
Important Fact
In the second Theorem, it is essential that the matrices be square.
This example illustrates why “an inverse” of a non-square matrix doesn’t make
sense. If A is m × n and B is n × m, where m 6= n, then even if AB = I , it will
never be the case that BA = I .
Definition
An elementary matrix is a matrix obtained from an identity matrix by performing
a single elementary row operation.
The type of an elementary matrix is given by the type of row operation used to
obtain the elementary matrix. Recall the elementary row operations.
4 4
We are interested in the effect that (left) multiplication of A by E , F and G has
on the matrix A. Computing EA, FA, and GA . . .
Theorem
Let A be an m × n matrix, and suppose that B is obtained from A by performing
a single elementary row operation. Then B = EA where E is the elementary
matrix obtained from Im by performing the same elementary operation on Im as
was performed on A.
Solution
Note. The statement of the problem implies that C can be obtained from A by a
sequence of two elementary row operations, represented by elementary matrices E
and F .
4 1 → 1 3 → 1 3
A= E F =C
1 3 4 1 2 −5
0 1 1 0
where E = and F = . Thus we have the sequence
1 0 −2 1
A → EA → F (EA) = C , so C = FEA, i.e.,
1 3 1 0 0 1 4 1
=
2 −5 −2 1 1 0 1 3
Example
Without using the matrix inversion algorithm, find the inverse of the elementary
matrix
1 0 0 0
0 1 0 0
G = −3 0 1 0
0 0 0 1
Hint. What row operation can be applied to G to transform it to I4 ? The row
operation G → I4 is to add three times row one to row three, and thus
1 0 0 0
0 1 0 0
G −1 =
3 0 1 0
0 0 0 1
Check by computing G −1 G .
B = (Ek Ek−1 · · · E2 E1 )A
A→B
Theorem
Suppose A is an m × n matrix and that A → B. Then
1 there exists an invertible m × m matrix U such that B = UA;
2 U can be computed by performing
elementary row operations on A Im
to transform it into B U ;
3 U = Ek Ek−1 · · · E2 E1 , where E1 , E2 , . . . , Ek are elementary matrices
corresponding, in order, to the elementary row operations used to obtain B
from A.
Solution
3 0 1 1 0 1 1 1 1 −1 1 1 1 1 −1
→ →
2 −1 0 0 1 2 −1 0 0 1 0 −3 −2 −2 3
1 1
1 1 1 1 −1 1 0 3 3 0
→ →
0 1 23 23 −1 0 1 2
3
2
3 −1
Starting with A I , we’ve obtained R U .
Therefore R = UA, where 1
0
U = 32
3 −1
and therefore
A−1 = E5 E4 E3 E2 E1
A−1 = E5 E4 E3 E2 E1
−1 −1
(A ) = (E5 E4 E3 E2 E1 )−1
A = E1−1 E2−1 E3−1 E4−1 E5−1
Theorem
Let A be an n × n matrix. Then, A−1 exists if and only if A can be written as the
product of elementary matrices.
Solution
4 1 −→ 1 3 −→ 1 3 −→ 1 3 −→ 1 0
E1 E2 E3 E4
−3 2 −3 2 0 11 0 1 0 1
and
1 1 1 0 1 0 1 −3
E1 = , E2 = , E3 = 1 , E4 =
0 1 3 1 0 11
0 1
i.e.,
1 −1 1 0 1 0 1 3
A=
0 1 −3 1 0 11 0 1
Check your work by computing the product.
One result that we have assumed in all our work involving reduced row-echelon
matrices is the following.
Theorem
If A is an m × n matrix and R and S are reduced row-echelon forms of A, then
R = S.
This theorem ensures that the reduced row-echelon form of a matrix is unique,
and its proof follows from the results about elementary matrices.