Matrices: Learning Outcomes
Matrices: Learning Outcomes
Matrices
7.1 Introduction to Matrices 2
7.3 Determinants 30
Learning outcomes
In this Workbook you will learn about matrices. In the first instance you will learn about the
algebra of matrices: how they can be added, subtracted and multiplied. You will learn
about a characteristic quantity associated with square matrices - the determinant. Using
knowledge of determinants you will learn how to find the inverse of a matrix. Also, a
second method for finding a matrix inverse will be outlined - the Gaussian elimination
method.
Matrices 7.1
Introduction
When we wish to solve large systems of simultaneous linear equations, which arise for example in the
problem of finding the forces on members of a large framed structure, we can isolate the coefficients
of the variables as a block of numbers called a matrix. There are many other applications matrices.
In this Section we develop the terminology and basic properties of a matrix.
2 HELM (2008):
Workbook 7: Matrices
®
1. Applications of matrices
The solution of simultaneous linear equations is a task frequently occurring in engineering. In electrical
engineering the analysis of circuits provides a ready example.
However the simultaneous equations arise, we need to study two things:
(a) how we can conveniently represent large systems of linear equations
(b) how we might find the solution of such equations.
We shall discover that knowledge of the theory of matrices is an essential mathematical tool in this
area.
3x1 + 2x2 − x3 = 3
x1 − x2 + x3 = 4
2x1 + 3x2 + 4x3 = 5
We can isolate three facets of this system: the coefficients of x1 , x2 , x3 ; the unknowns x1 , x2 , x3 ;
and the numbers on the right-hand sides.
Notice that in the system
3x + 2y − z = 3
x−y+z = 4
2x + 3y + 4z = 5
the only difference from the first system is the names given to the unknowns. It can be checked that
the first system has the solution x1 = 2, x2 = −1, x3 = 1. The second system therefore has the
solution x = 2, y = −1, z = 1.
We can isolate the three facets of the first system by using arrays of numbers and of unknowns:
3 2 −1 x1 3
1 −1 1 x2 = 4
2 3 4 x3 5
Even more conveniently we represent the arrays with letters (usually capital letters)
AX = B
Here, to be explicit, we write
3 2 −1 x1 3
A = 1 −1 1 X = x2 B= 4
2 3 4 x3 5
Here A is called the matrix of coefficients, X is called the matrix of unknowns and B is called
the matrix of constants.
If we now append to A the column of right-hand sides we obtain the augmented matrix for the
system:
HELM (2008): 3
Section 7.1: Introduction to Matrices
3 2 −1 3
1 −1 1 4
2 3 4 5
The order of the entries, or elements, is crucial. For example, all the entries in the second row relate
to the second equation, the entries in column 1 are the coefficients of the unknown x1 , and those in
the last column are the constants on the right-hand sides of the equations.
In particular, the entry in row 2 column 3 is the coefficient of x3 in equation 2.
Representing networks
Shortest-distance problems are important in communications study. Figure 1 illustrates schematically
a system of four towns connected by a set of roads.
a b
c d
Figure 1
The system can be represented by the matrix
a b c d
a 0 1 0 0
b 1
0 1 1
c 0 1 0 1
d 0 1 1 0
The row refers to the town from which the road starts and the column refers to the town where the
road ends. An entry of 1 indicates that two towns are directly connected by a road (for example b
and d) and an entry of zero indicates that there is no direct road (for example a and c). Of course,
if there is a road from b to d (say) it is also a road from d to b.
In this Section we shall develop some basic ideas about matrices.
2. Definitions
An array of numbers, rectangular in shape, is called a matrix. The first matrix below has 3 rows
and 2 columns and is said to be a ‘3 by 2’ matrix (written 3 × 2). The second matrix is a ‘2 by 4’
matrix (written 2 × 4).
1 4
−2 3 1 2 3 4
5 6 7 9
2 1
The general 3 × 3 matrix can be written
a11 a12 a13
A = a21 a22 a23
a31 a32 a33
4 HELM (2008):
Workbook 7: Matrices
®
a11 = 0, a12 = −1, a13 = −3, ... a22 = 6, ... a32 = 7, a33 = 123
Key Point 1
The General Matrix
A general m × n matrix A has m rows and n columns.
The entries in the matrix A are called the elements of A.
In matrix A the element in row i and column j is denoted by aij .
A matrix with only one column is called a column vector (or column matrix).
x1 3
For example, x2 and 4 are both 3 × 1 column vectors.
x3 5
A matrix with only one row is called a row vector (or row matrix). For example [2, −3, 8, 9] is a
1 × 4 row vector. Often the entries in a row vector are separated by commas for clarity.
Square matrices
When the number of rows is the same as the number of columns, i.e. m = n, the matrix is said to
be square and of order n (or m).
• In an n × n square matrix A, the leading diagonal (or principal diagonal) is the ‘north-west
to south-east’ collection of elements a11 , a22 , . . . , ann . The sum of the elements in the leading
diagonal of A is called the trace of the matrix, denoted by tr(A).
a11 a12 . . . a1n
a21 a22 . . . a2n
A = .. tr(A) = a11 + a22 + · · · + ann
.. .. ..
. . . .
an1 an2 . . . ann
• A square matrix in which all the elements below the leading diagonal are zero is called an
upper triangular matrix, often denoted by U .
HELM (2008): 5
Section 7.1: Introduction to Matrices
u11 u12 ... ... u1n
0 u22 ... ... u2n
U = uij = 0 when i > j
.. ..
0 0 ... . .
0 0 ... 0 unn
• A square matrix in which all the elements above the leading diagonal are zero is called a lower
triangular matrix, often denoted by L.
l11 0 0 ... 0
l21 l22 0 . . . 0
L = .. .. lij = 0 when i < j
. . ... ... 0
.
ln1 ln2 .. . . . lnn
• A square matrix where all the non-zero elements are along the leading diagonal is called a
diagonal matrix, often denoted by D.
d11 0 0 ... 0
0 d22 0 . . . 0
D= 0
dij = 0 when i 6= j
0 ... ... 0
0 0 0 . . . dnn
6 HELM (2008):
Workbook 7: Matrices
®
Task
Classify the following matrices (and, where possible, find the trace):
1 2 3 4
1 2 1 2 3 4 5 6 7 8
A= 3 4
B= 5 6 7 8 C=
9 10 11 12
5 6 −1 −3 −2 −4
13 14 15 16
Your solution
Answer
A is 3 × 2, B is 3 × 4, C is 4 × 4 and square.
The trace is not defined for A or B. However, tr(C) = 34.
Task
Classify the following matrices:
1 1 1 1 0 0 1 1 1 1 0 0
A= 1 1 1 B= 1 1 0 C= 0 1 1 D= 0 1 0
1 1 1 1 1 1 0 0 1 0 0 1
Your solution
Answer
A is 3 × 3 and square, B is 3 × 3 lower triangular, C is 3 × 3 upper triangular and D is 3 × 3
diagonal.
Equality of matrices
As we noted earlier, the terms in a matrix are called the elements of the matrix.
1 2
The elements of the matrix A = are 1, 2, −1, −4
−1 −4
We say two matrices A, B are equal to each other only if A and B have the same number of rows
and the same number of columns and if each element of A is equal to the corresponding element of
B. When this is the case we write A = B. For example if the following two matrices are equal:
1 α 1 2
A= B=
−1 −β −1 −4
then we can conclude that α = 2 and β = 4.
HELM (2008): 7
Section 7.1: Introduction to Matrices
The unit matrix
The unit matrix or the identity matrix, denoted by In (or, often, simply I), is the diagonal matrix
of order n in which all diagonal elements are 1.
1 0 0
1 0
Hence, for example, I2 = and I3 = 0 1 0 .
0 1
0 0 1
Example 1
1 2 3
Find the transpose of the matrix B = 4 5 6
7 8 9
Solution
Interchanging rows with columns we find
1 4 7
T
B = 2 5
8
3 6 9
Both matrices are 3 × 3 but B and B T are clearly different.
When the transpose of a matrix is equal to the original matrix i.e. AT = A, then we say that the
matrix A is symmetric. (This is because it has symmetry about the leading diagonal.)
In Example 1 B is not symmetric.
8 HELM (2008):
Workbook 7: Matrices
®
Example 2
1 −2 3
Show that the matrix C = −2 4 −5 is symmetric.
3 −5 6
Solution
Taking the transpose of C:
1 −2 3
C T = −2 4 −5 .
3 −5 6
Clearly C T = C and so C is a symmetric matrix. Notice how the leading diagonal acts as a “mirror”;
for example c12 = −2 and c21 = −2. In general cij = cji for a symmetric matrix.
Task
Find the transpose of each of the following matrices. Which are symmetric?
1 2 1 1 1 1
A= , B= C=
3 4 −1 1 1 0
1 2
1 0
D= 4 5 E=
0 1
7 8
Your solution
Answer
T 1 3 T 1 −1 T 1 1
A = , B = C = = C, symmetric
2 4 1 1 1 0
1 4 7 1 0
DT = T
E = = E, symmetric
2 5 8 0 1
HELM (2008): 9
Section 7.1: Introduction to Matrices
3. Addition and subtraction of matrices
Under what circumstances can we add two matrices i.e. define A + B for given matrices A, B?
Consider
1 2 5 6 9
A= and B=
3 4 7 8 10
There is no sensible way to define A + B in this case since A and B are different sizes.
However, if we consider
matrices
of the same
size
then addition can be defined in a very natural
1 2 5 6
way. Consider A = and B = . The ‘natural’ way to add A and B is to add
3 4 7 8
corresponding elements together:
1+5 2+6 6 8
A+B = =
3+7 4+8 10 12
In general if A and B are both m × n matrices, with elements aij and bij respectively, then their
sum is a matrix C, also m × n, such that the elements of C are
cij = aij + bij i = 1, 2, . . . , m j = 1, 2, . . . , n
In the above example
c11 = a11 + b11 = 1 + 5 = 6 c21 = a21 + b21 = 3 + 7 = 10 and so on.
Subtraction of matrices follows along similar lines:
1−5 2−6 −4 −4
D =A−B = =
3−7 4−8 −4 −4
10 HELM (2008):
Workbook 7: Matrices
®
Task
For the following matrices find, where possible, A + B, A − B, B − A, 2A.
1 2 1 1
1. A = B=
3 4 1 1
1 2 3 1 1 1
2. A = 4 5 6 B = −1 −1 −1
7 8 9 1 1 1
1 2 3 1 2
3. A = 4 5 6 B= 3 4
7 8 9 5 6
Your solution
Answer
2 3 0 1 0 −1 2 4
1. A + B = A−B = B−A= 2A =
4 5 2 3 −2 −3 6 8
2 3 4 0 1 2 0 −1 −2
2. A + B = 3 4 5 A−B = 5 6 7 B − A = −5 −6 −7
8 9 10 6 7 8 −6 −7 −8
2 4 6
2A = 8 10 12
14 16 18
2 4 6
3. None of A + B, A − B, B − A, are defined. 2A = 8 10 12
14 16 18
HELM (2008): 11
Section 7.1: Introduction to Matrices
5. Some simple matrix properties
Using the definition of matrix addition described above we can easily verify the following properties
of matrix addition:
Key Point 2
These Key Point results follow from the fact that aij + bij = bij + aij etc.
We can also show that the transpose of a matrix satisfies the following simple properties:
Key Point 3
Properties of Transposed Matrices
(A + B)T = AT + B T
(A − B)T = AT − B T
(AT )T = A
Example 3
T T 1 2 3
Show that (A ) = A for the matrix A =
4 5 6
Solution
1 4
T T T 1 2 3
A = 2 5 so that (A ) =
=A
4 5 6
3 6
12 HELM (2008):
Workbook 7: Matrices
®
Task
1 2 1 −1
For the matrices A = , B= verify that
3 4 −1 1
(i) 3(A + B) = 3A + 3B (ii) (A − B)T = AT − B T .
Your solution
Answer
2 1 6 3 3 6
(i) A + B = ; 3(A + B) = ; 3A = ;
2 5 6 15 9 12
3 −3 6 3
3B = ; 3A + 3B = .
−3 3 6 15
0 3 T 0 4 T 1 3
(ii) A − B = ; (A − B) = ; A = ;
4 3 3 3 2 4
T 1 −1 T T 0 4
B = ; A −B = .
−1 1 3 3
HELM (2008): 13
Section 7.1: Introduction to Matrices
Exercises
1. Find the coefficient matrix A of the system:
2x1 + 3x2 − x3 = 1
4x1 + 4x2 = 0
2x1 − x2 − x3 = 0
1 2 3
If B = 4 5 6 determine (3AT − B)T .
0 0 1
−1 4
1 2 3
2. If A = and B = 0 1 verify that 3(AT − B) = (3A − 3B T )T .
4 5 6
2 7
Answers
2 3 −1 2 4 2 6 12 6
1. A = 4 4 0 , AT = 3 4 −1 , 3AT = 9 12 −3
2 −1 −1 −1 0 −1 −3 0 −3
5 10 3 5 5 −3
3AT − B = 5 7 −9 (3AT − B)T = 10 7 0
−3 0 −4 3 −9 −4
1 4 2 0 6 0
2. AT = 2 5 , AT − B = 2 4 , 3(AT − B) = 6 12
3 6 1 −1 3 −3
T −1 0 2 T 3 6 9 −3 0 6 6 6 3
B = , 3A − 3B = − =
4 1 7 12 15 18 12 3 21 0 12 −3
14 HELM (2008):
Workbook 7: Matrices
®
Introduction
When we wish to multiply matrices together we have to ensure that the operation is possible - and
this is not always so. Also, unlike number arithmetic and algebra, even when the product exists the
order of multiplication may have an effect on the result. In this Section we pick our way through the
minefield of matrix multiplication.
HELM (2008): 15
Section 7.2: Matrix Multiplication
1. Multiplying row matrices and column matrices together
Let A be a 1 × 2 row matrix and B be a 2 × 1 column matrix:
c
A= a b B=
d
The product of these two matrices is written AB and is the 1 × 1 matrix defined by:
c
AB = a b × = [ac + bd]
d
Note that corresponding elements are multiplied together and the results are then added together.
For example
6
2 −3 × = [12 − 15] = [−3]
5
This matrix product is easily generalised to other row and column matrices. For example if C is a
1 × 4 row matrix and D is a 4 × 1 column matrix:
3
3
C = 2 −4 3 2 B= −2
5
then we define the product of C with D as
3
3
CD = 2 − 4 3 2 × −2
= [6 − 12 − 6 + 10] = [−2]
5
The only requirement is that the number of elements of the row matrix is the same as the number
of elements of the column matrix.
A B = C
The rule for calculating the elements of C is described in the following Key Point:
16 HELM (2008):
Workbook 7: Matrices
®
Key Point 4
Matrix Product
AB = C
The element in the ith row and j th column of C is obtained
by multiplying the ith row of A with the j th column of B.
We illustrate this construction for the abstract matrices A and B given above:
w x
a b a b
y z
a b w x aw + by ax + bz
× = = cw + dy cx + dz
c d y z
w
x
c d c d
y z
For example
2 4
2 −1 2 −1
6 1
2 −1 2 4 −2 7
× =
= −6 10
3 −2 6 1
2 4
3 −2 3 −2
6 1
Task
1 2 1 −1
Find the product AB where A = B=
3 4 −2 1
First write down row 1 of A, column 2 of B and form the first element in product AB:
Your solution
Answer
−1
[1, 2] and ; their product is 1 × (−1) + 2 × 1 = 1.
1
Your solution
Answer
1
[3, 4] and . Their product is 3 × 1 + 4 × (−2) = −5
−2
HELM (2008): 17
Section 7.2: Matrix Multiplication
Finally find the two other elements of C = AB and hence write down the matrix C:
Your solution
Answer
Row 1 column 1 is 1 × 1 + 2 × (−2) = −3. Row 2 column 2 is 3 × (−1) + 4 × 1 = 1
−3 1
C=
−5 1
Clearly, matrix multiplication is tricky and not at all ‘natural’. However, it is a very important
mathematical procedure with many engineering applications so must be mastered.
Task
1 2 1 −1
For matrices A = and B = form the products of
3 4 −2 1
row 1 of B and column 1 of A row 1 of B and column 2 of A
row 2 of B and column 1 of A row 2 of B and column 2 of A
Answer
row 1, column 1 is 1 × 1 + (−1) × 3 = −2 row 1, column 2 is 1 × 2 + (−1) × 4 = −2
row 2, column 1 is −2 × 1 + 1 × 3 = 1 row 2, column 2 is −2 × 2 + 1 × 4 = 0
−2 −2
BA is
1 0
It is clear that AB and BA are not in general the same. In fact it is the exception that AB = BA.
In the special case in which AB = BA we say that the matrices A and B commute.
18 HELM (2008):
Workbook 7: Matrices
®
Task
Calculate AB and BA where
a b 0 0
A= and B =
c d 0 0
Your solution
Answer
0 0
AB = BA =
0 0
Task
Carry out the multiplication AB where
1 1 1 −1
A= , B=
1 1 −1 1
Your solution
Answer
0 0
AB =
0 0
Here we have a zero product yet neither A nor B is the zero matrix! Thus the statement AB = 0
does not allow us to conclude that either A = 0 or B = 0.
HELM (2008): 19
Section 7.2: Matrix Multiplication
Task
a b 1 0
Find the product AB where A = and B =
c d 0 1
Your solution
Answer
a b
AB = =A
c d
1 0
The matrix is called the identity matrix or unit matrix of order 2, and is usually denoted
0 1
by the symbol I. (Strictly we should write I2 , to indicate the size.) I plays the same role in matrix
multiplication as the number 1 does in number multiplication.
Hence
just as a × 1 = 1 × a = a for any number a, so AI = IA = A for any matrix A.
20 HELM (2008):
Workbook 7: Matrices
®
Task 1 2 −1 2 −1 3
Calculate AB = 3
4 0 1 −2 1
1 5 −2 0 3 −2
Your solution
Answer
2
Row 2 of A is (3, 4, 0) column 1 of B is 1
0
The combination required is 3 × 2 + 4 × 1 + (0) × (0) = 10.
Now complete the multiplication to find all the elements of the matrix AB:
Your solution
Answer
In full detail, the elements of AB are:
1 × 2 + 2 × 1 + (−1) × 0 1 × (−1) + 2 × (−2) + (−1) × 3 1 × 3 + 2 × 1 + (−1) × (−2)
3×2+4×1+0×0 3 × (−1) + 4 × (−2) + 0 × 3 3 × 3 + 4 × 1 + 0 × (−2)
1 × 2 + 5 × 1 + (−2) × 0 1 × (−1) + 5 × (−2) + (−2) × 3 1 × 3 + 5 × 1 + (−2) × (−2)
4 −8 7
i.e. AB = 10 −11 13
7 −17 12
1 0 0
The 3 × 3 unit matrix is: I = 0 1 0 and as in the 2 × 2 case this has the property that
0 0 1
AI = IA = A
0 0 0
The 3 × 3 zero matrix is 0 0 0
0 0 0
HELM (2008): 21
Section 7.2: Matrix Multiplication
5. Multiplying non-square matrices together
So far, we have just looked at multiplying 2 × 2 matrices and 3 × 3 matrices. However, products
between non-square matrices may be possible.
Key Point 5
Example 4
2 5
1 2 2
Find the product AB if A = and B = 6 1
2 3 4
4 3
Solution
Since A is a 2 × 3 and B is a 3 × 2 matrix the product AB can be found and results in a 2 × 2
matrix.
2 5
1 2 2
6 1 2 2 1
2 5 4 3
1 2 2
= 22 13
AB = × 6 1 =
2 3 4 38 25
4 3
2 5
2 3 4 6 2 3 4 1
4 3
22 HELM (2008):
Workbook 7: Matrices
®
Task
1 −2 2 4 1
Obtain the product AB if A = and B =
2 −3 6 1 0
Your solution
Answer
AB is a 2 × 3 matrix.
2 4 1
1 −2 1 −2
6
1 −2 1 0
1 −2 2 4 1
AB = × =
2 −3 6 1 0
2
4
1
2 −3 2 −3 2 −3
6 1 0
−10 2 1
=
−14 5 2
HELM (2008): 23
Section 7.2: Matrix Multiplication
Task 1 4
1 3 5 1 2
Given A = , B= , C= 2 5
2 4 6 3 4
3 6
State which of the products AB, BA, AC, CA, BC, CB, (AB)C, A(CB) is defined and state
the size (n × m) of the product when defined.
Your solution
AB
BA
AC
CA
BC
CB
(AB)C
A(CB)
Answer
A B B A
not possible possible; result 2 × 3
2×3 2×2 2×2 2×3
A C C A
possible; result 2 × 2 possible; result 3 × 3
2×3 3×2 3×2 2×3
B C C B
not possible possible; result 3 × 2
2×2 3×2 3×2 2×2
A (C B)
(AB)C not possible, AB not defined. possible; result 2 × 2
2×3 3×2
We now list together some properties of matrix multiplication and compare them with corresponding
properties for multiplication of numbers.
Key Point 6
Matrix algebra Number algebra
A(B + C) = AB + AC a(b + c) = ab + ac
AB 6= BA in general ab = ba
A(BC) = (AB)C a(bc) = (ab)c
AI = IA = A 1.a = a.1 = a
A0 = 0A = 0 0.a = a.0 = 0
AB may not be possible ab is always possible
AB = 0 does not imply A = 0 or B = 0 ab = 0 → a = 0 or b = 0
24 HELM (2008):
Workbook 7: Matrices
®
Example 5
Petrol is delivered to terminals T1 and T2 . They distribute the fuel to 3 storage
depots (S1 , S2 , S3 ). The network diagram below shows what fraction of the fuel
goes from each terminal to the three storage depots. In turn the 3 depots supply
fuel to 4 petrol stations (P1 , P2 , P3 , P4 ) as shown in Figure 2:
T1 T2
0.4 0.3
0.4
0.5 0.2 0.2
S1 S2 S3
0.1 0.6
0.6 0.2
0.2
0.5 0.4
0.2 0.2
P1 P2 P3 P4
Figure 2
Show how this situation may be described using matrices.
Solution
Denote the amount of fuel, in litres, flowing from T1 by t1 and from T2 by t2 and the quantity being
received at Si by si for i = 1, 2, 3. This situation is described in the following diagram:
T1 T2
0.4 0.3
0.4
0.5 0.2 0.2
S1 S2 S3
HELM (2008): 25
Section 7.2: Matrix Multiplication
Solution (contd.)
In turn the 3 depots supply fuel to 4 petrol stations as shown in the next diagram:
S1 S2 S3
0.1 0.6
0.6 0.2
0.2
0.5 0.4
0.2 0.2
P1 P2 P3 P4
If the petrol stations receive p1 , p2 , p3 , p4 litres respectively then from the diagram we have:
p1 = 0.6s1 + 0.2s2 p1 0.6 0.2 0
p2 = 0.2s1 + 0.5s2 p2 0.2 0.5 0 s1
or, in matrix form: p3 = 0.2 0.2 0.4 s2
p3 = 0.2s1 + 0.2s2 + 0.4s3
s3
p4 = 0.1s2 + 0.6s3 p4 0 0.1 0.6
Combining the equations, substituting expressions for s1 , s2 , s3 in the equations for p1 , p2 , p3 , p4
we get:
p1 = 0.6s1 + 0.2s2
= 0.6(0.4t1 + 0.5t2 ) + 0.2(0.4t1 + 0.2t1 )
= 0.32t1 + 0.34t2
p1 0.6 0.2 0
p2 0.2 s1
= 0.5 0 s2
p3 0.2 0.2 0.4
s3
p4 0 0.1 0.6
0.6 0.2 0
0.2 0.4 0.5
0.5 0 t
0.4 0.2 1
=
0.2 0.2 0.4 t2
0.2 0.3
0 0.1 0.6
0.32 0.34 0.32t1 + 0.34t2
0.28 0.20
t1 = 0.28t1 + 0.20t2
=
0.24 0.26 t2 0.24t1 + 0.26t2
0.16 0.20 0.16t1 + 0.20t2
26 HELM (2008):
Workbook 7: Matrices
®
Engineering Example 1
Communication network
Problem in words
Figure 3 represents a communication network. Vertices a, b, f and g represent offices. Vertices c, d
and e represent switching centres. The numbers marked along the edges represent the number of
connections between any two vertices. Calculate the number of routes from a and b to f and g
c
3 2
a 2 1 f
6
4 d
3
1
1 1
b g
3 e 2
The nature of matrix multiplication means that the number of routes is obtained by multiplying the
matrix representing the number of connections from ab to cde by the matrix representing the number
of connections from cde to f g.
Mathematical analysis
The matrix representing the number of routes from ab to cde is:
c d e
!
a 3 4 1
b 2 1 3
The matrix representing the number of routes from cde to f g is:
f g
c 2 1
d
6 3
e 1 2
HELM (2008): 27
Section 7.2: Matrix Multiplication
The product of these two matrices gives the total number of routes.
2 1
3 4 1 6 3 = 3 × 2 + 4 × 6 + 1 × 1 3 × 1 + 4 × 3 + 1 × 2 31 17
=
2 1 3 2×2+1×6+3×1 2×1+1×3+3×2 13 11
1 2
Interpretation
We can interpret the resulting (product) matrix by labelling the columns and rows.
f g
!
a 31 17
b 13 11
Hence there are 31 routes from a to f , 17 from a to g, 13 from b to f and 11 from b to g.
28 HELM (2008):
Workbook 7: Matrices
®
Exercises
1 2 5 6 0 −1
1. If A = B= C= find
3 4 7 8 2 −3
(a) AB, (b) AC, (c) (A + B)C, (d) AC + BC(e) 2A − 3C
cos θ sin θ
2. If a rotation through an angle θ is represented by the matrix A = and a
− sin θ cos θ
cos φ sin φ
second rotation through an angle φ is represented by the matrix B = show
− sin φ cos φ
that both AB and BA represent a rotation through an angle θ + φ.
1 2 3 2 4
2 1
3. If A = −1 −1 −1 , B = −1 2 , C = , find AB and BC.
1 2
2 2 2 5 6
1 2 3 0
1 2 −1
4. If A = , B= 5 0 0 , C = 1 ,
0 −1 2
1 2 −1 −2
verify A(BC) = (AB)C.
2 3 −1
5. If A = 0 1 2 then show that AAT is symmetric.
4 5 6
0 1
11 0 0 1 2
6. If A = B= verify that (AB)T = 11 3 = B T AT
2 1 1 1 3
22 7
Answers
19 22 4 −7 16 −30
1. (a) AB = (b) AC = (c) (A + B)C =
43 50 8 −15 24 −46
16 −30 2 7
(d) AC + BC = (e)
24 −46 0 17
cos θ cos φ − sin θ sin φ cos θ sin φ + sin θ cos φ
2. AB =
− sin θ cos φ − cos θ sin φ − sin θ sin φ + cos θ cos φ
cos(θ + φ) sin(θ + φ)
=
− sin(θ + φ) cos(θ + φ)
which clearly represents a rotation through angle θ + φ. BA gives the same result.
15 26 8 10
3. AB = −6 −12 , BC = 0 3
12 24 16 17
−8
4. A(BC) = (AB)C =
8
HELM (2008): 29
Section 7.2: Matrix Multiplication
Determinants 7.3
Introduction
Among other uses, determinants allow us to determine whether a system of linear equations has a
unique solution or not. The evaluation of a determinant is a key skill in engineering mathematics and
this Section concentrates on the evaluation of small size determinants. For evaluating larger sizes we
can often use some properties of determinants to help simplify the task.
30 HELM (2008):
Workbook 7: Matrices
®
Task
Find the determinants of the matrices
1 2 4 −1 0 0 1 0
A= , B= , C= D= ,
3 4 −2 −3 0 0 2 3
2 0 −1 0 1 2
E= , F = , G= .
0 4 0 −3 −2 −4
Your solution
Answer
| A |= 1 × 4 − 2 × 3 = −2 | B |= 4 × (−3) − (−1) × (−2) = −12 − 2 = −14
| C |= 0 | D |= 3 | E |= 8 | F |= 3 | G |= −4 + 4 = 0
4 1 1
1 1
1 2 3 to leave
2 3
= 3 − 2 = 1.
3 1 2
HELM (2008): 31
Section 7.3: Determinants
Task
What is the minor of the element a22 = 2?
Your solution
Answer
4 1
3 2 =8−3=5
Next we introduce the idea of a cofactor. This is a minor with a sign attached. The appropriate
sign comes from the pattern of signs appropriate to a 3 × 3 array:
+ − +
− + −
+ − +
(i.e. positive signs on the leading diagonal and the signs ‘alternate’ everywhere else.)
Each element has a cofactor associated with it. The cofactor of element a11 is denoted by A11 , that
of a23 by A23 and so on.
To obtain the cofactor of an element of a 3 × 3 matrix we simply multiply the minor of that element
by the corresponding sign from the 3 × 3 array of signs.
Hence the cofactor corresponding to a23 is
4 1
A23 = − = −1
3 1
1 1
and the cofactor corresponding to a31 is A31 = + = 1.
2 3
Task
What is the cofactor of the element a22 ?
Your solution
Answer
The sign in the position of a22 in the array of signs is +
Hence, since the minor of this element is +5 the cofactor is A22 = +5.
Cofactors are important as it can be shown that the value of the determinant of a 3 × 3 matrix can
be found from the formula
∆ = a11 A11 + a12 A12 + a13 A13 .
32 HELM (2008):
Workbook 7: Matrices
®
In words “the determinant of a 3 × 3 matrix is obtained by multiplying each element of the first row
by its corresponding cofactor and then adding the three together”. (In fact this rule can be extended
to apply to any row or any column and to any order square matrix.)
Key Point 7
In words:
The determinant of a square matrix is obtained by multiplying each element
of row i by its corresponding cofactor and then adding these products together.
4 1 1
In the case of ∆ = 1 2 3 we have a11 = 4, a12 = 1, a13 = 1,
3 1 2
2 3
A11 = + =4−3=1
1 2
1 3
A12 = − = −(2 − 9) = 7
3 2
1 2
A13 = + = 1 − 6 = −5
3 1
Hence ∆ = 4 × 1 + 1 × 7 + 1 × −5 = 6.
Alternatively, choosing to expand along the second row:
HELM (2008): 33
Section 7.3: Determinants
Task 1 −1 3
Use expansion along the first row to find ∆ = 0 2 6
−2 1 5
Your solution
Answer
a11 = 1, a12 = −1, a13 = 3
2 6
A11 = + = 10 − 6 = 4
1 5
0 6
A12 = − = −(0 + 12) = −12
−2 5
0 2
A13 = + = 2 + 2 = 4.
−2 1
3. Properties of determinants
Often, especially with determinants of large order, we can simplify the evaluation rules. In this Section
we quote some useful properties of determinants in general.
1. If two rows (or two columns) of a determinant are interchanged then the value of the determi-
nant is multiplied by (−1).
4 3 3 4
= 8 − 3 = 5 but (interchanging columns)
For example 2 1 = 3 − 8 = −5 and
1 2
1 2
(interchanging rows) = 3 − 8 = −5.
4 3
2. The determinant of a matrix A and the determinant of its transpose AT are equal.
1 2 1 3
3 4 2 4 = 4 − 6 = −2
=
34 HELM (2008):
Workbook 7: Matrices
®
3. If two rows (or two columns) of a matrix A are equal then it has zero determinant.
1 2 3
= 1× 2 3 + 2 × − 1 3 +3× 1 2
1 2 3
5 6 4 6 4 5
4 5 6
= −3 + 2 × (6) + 3 × (−3) = 0.
4. If the elements of one row (or one column) of a determinant are multiplied by k, then the
resulting determinant is k times the given determinant:
1 2 3 1 2 3
4 8 6 = 2 2 4 3 .
7 8 9 7 8 9
Note that if one row (or column) of a determinant is a multiple of another row (or column)
then the value of the determinant is zero. (This follows from properties 3 and 4.)
For example:
2 4 −1
2 1
4 1
4
2
4
2 1
= 2 ×
−8 2 + 4 × −
−4 2 − 1 ×
−4 −8
−4 −8 2
This is predictable as the 3rd row is (−2) times the first row.
5. If we add (or subtract) a multiple of one row (or column) to another, the value of the deter-
minant is unchanged.
1 2
Given , add (2 × row 1) to (row 2) gives
4 5
1 2 1 2
= = 9 − 12 = −3 = 1 2
4+2×1 5+2×2 6 9 4 5
6. The determinant of a lower triangular matrix, an upper triangular matrix or a diagonal matrix
is the product of the elements on the leading diagonal.
As an example, it is easily confirmed that each of the following determinants has the same
value 1 × 4 × 6 = 24.
1 2 3 1 0 0 1 0 0
0 4 5 , 2 4 0 , 0 4 0
0 0 6 3 5 6 0 0 6
HELM (2008): 35
Section 7.3: Determinants
Task
This task is in four parts. Consider
1 4 8 2
2 −1 1 −3
∆ =
0 2 4 2
0 3 6 3
Answer
1 2 0 0
4 −1 2 3
∆ = , by transposing the matrix.
8 1 4 6
2 −3 2 3
(b) Now expand along the top row to express ∆ as the sum of two products, each of a number and
a 3 × 3 determinant:
Your solution
Answer
−1 2 3 4 2 3
∆ = 1 × 1 4 6 −2× 8 4 6
−3 2 3 2 2 3
(c) Use the statement after property 4 to show that the second of the 3 × 3 determinants is zero:
Your solution
Answer
In the second 3 × 3 determinant, row 2 = 2×row 1 hence the determinant has value zero.
(d) Use the statement after property 4 to evaluate the first determinant:
Your solution
Answer
3
In the first 3 × 3 determinant column 3 = 2
× column 2. Hence this determinant is also zero.
Therefore ∆ = 0.
36 HELM (2008):
Workbook 7: Matrices
®
Exercises
1. Use Laplace expansion along the 1st row to determine
3 1 −4
6 9 −2
−1 2 1
Show that the same value is obtained if you choose any other row or column for your expansion.
Answers
9 −2 6 −2 6 9
1. 3
− 1
− 4
= 3(9 + 4) − 1(6 − 2) − 4(12 + 9) = −49
2 1 −1 1 −1 2
HELM (2008): 37
Section 7.3: Determinants
Introduction
1
In number arithmetic every number a (6= 0) has a reciprocal b written as a−1 or such that
a
ba = ab = 1. Some, but not all, square matrices have inverses. If a square matrix A has an inverse,
A−1 , then
AA−1 = A−1 A = I.
We develop a rule for finding the inverse of a 2 × 2 matrix (where it exists) and we look at two
methods of finding the inverse of a 3 × 3 matrix (where it exists).
Non-square matrices do not possess inverses so this Section only refers to square matrices.
#
• be familiar with the algebra of matrices
Prerequisites • be able to calculate a determinant
Before starting this Section you should . . .
• know what a cofactor is
"
' !
$
• state the condition for the existence of an
inverse matrix
38 HELM (2008):
Workbook 7: Matrices
®
Example 6
0 − 12
−1 1
Show that the inverse matrix of A = is B =
−2 0 1 − 12
Solution
All we need do is to check that AB = BA = I.
−1 1 1 0 −1 1 −1 1 0 −1 1 2 0 1 0
AB = ×2 =2 × =2 =
−2 0 2 −1 −2 0 2 −1 0 2 0 1
The reader should check that BA = I also.
Task
1 0 a b
Consider A = , and let B = be a possible inverse of A.
2 0 c d
Your solution
AB = BA =
HELM (2008): 39
Section 7.4: The Inverse of a Matrix
Answer
a b a + 2b 0
AB = , BA =
2a 2b c + 2d 0
1 0
(b) Equate the elements of AB to those of I = and solve the resulting equations:
0 1
Your solution
Answer
a = 1, b = 0, 2a = 0, 2b = 1. Hence a = 1, b = 0, a = 0, b = 21 . This is not possible!
Hence, we have a contradiction. The matrix A therefore has no inverse and is said to be a singular
matrix. A matrix which has an inverse is said to be non-singular.
• If a matrix has an inverse then that inverse is unique.
Suppose B and C are both inverses of A. Then, by definition of the inverse,
AB = BA = I and AC = CA = I
Consider the two ways of forming the product CAB
1. CAB = C(AB) = CI = C
2. CAB = (CA)B = IB = B.
AX = B
−1 −1
pre-multiplying by A : A (AX) = A−1 B,
using associativity: A−1 A)X = A−1 B
using A−1 A = I : IX = A−1 B,
using property of I : X = A−1 B which is the solution we seek.
40 HELM (2008):
Workbook 7: Matrices
®
Task
Form the matrix products AB and BA where
a b d −b
A= and B =
c d −c a
Your solution
AB = BA =
Answer
ad − bc 0 1 0
AB = = (ad − bc) = (ad − bc)I
0 ad − bc 0 1
ad − bc 0
BA = = (ad − bc)I
0 ad − bc
1 d −b
You will see that had we chosen C = instead of B then both products AC
ad − bc −c a
and CA will be equal to I. This requires ad − bc 6= 0. Hence this matrix C is the inverse
of A.
1 0
However, note, that if ad − bc = 0 then A has no inverse. (Note that for the matrix A = ,
2 0
which occurred in the last task, ad − bc = 1 × 0 − 0 × 2 = 0 confirming, as we found, that A has
no inverse.)
Key Point 8
HELM (2008): 41
Section 7.4: The Inverse of a Matrix
Task
Which of the following matrices has an inverse?
1 0 1 1 1 −1 1 0
A= , B= , C= , D=
2 3 −1 1 −2 2 0 1
Your solution
Answer
|A| = 1 × 3 − 0 × 2 = 3; |B| = 1 + 1 = 2; |C| = 2 − 2 = 0; |D| = 1 − 0 = 1.
Therefore, A, B and D each has an inverse. C does not because it has a zero determinant.
Task
Find the inverses of the matrices A, B and D in the previous Task.
A−1 = B −1 = C −1 =
Answer
3 0 1 −1 1 0
A−1 = 13 , B −1
= 1
, D −1
= =D
−2 1 2 1 1 0 1
cos θ sin θ
It can be shown that the matrix A = represents an anti-clockwise rotation
− sin θ cos θ
through an angle θ in an xy-plane about the origin. The matrix B represents a rotation clockwise
through an angle θ. It is given therefore by
cos(−θ) sin(−θ) cos θ − sin θ
B= =
− sin(−θ) cos(−θ) sin θ cos θ
42 HELM (2008):
Workbook 7: Matrices
®
Task
Form the products AB and BA for these ‘rotation matrices’. Confirm that B is
the inverse matrix of A.
Your solution
AB =
BA =
Answer
cos θ sin θ cos θ − sin θ
AB =
− sin θ cos θ sin θ cos θ
cos2 θ + sin2 θ
− cos θ sin θ + sin θ cos θ 1 0
= = =I
− sin θ cos θ + cos θ sin θ sin2 θ + cos2 θ 0 1
Similarly, BA = I
Effectively: a rotation through an angle θ followed by a rotation through angle −θ is equivalent to
zero rotation.
HELM (2008): 43
Section 7.4: The Inverse of a Matrix
3. The inverse of a 3×3 matrix - Gauss elimination method
It is true, in general, that if the determinant of a matrix is zero then that matrix has no inverse. If
the determinant is non-zero then the matrix has a (unique) inverse. In this Section and the next we
look at two ways of finding the inverse of a 3 × 3 matrix; larger matrices can be inverted by the same
methods - the process is more tedious and takes longer. The 2 × 2 case could be handled similarly
but as we have seen we have a simple formula to use.
The method we now describe for finding the inverse of a matrix has many similarities to a technique
used to obtain solutions of simultaneous equations. This method involves operating on the rows of
a matrix in order to reduce it to a unit matrix.
The row operations we shall use are
Note that in (ii) and (iii) the multiple could be negative or fractional, or both.
The Gauss elimination method is outlined in the following Key Point:
Key Point 9
Matrix Inverse − Gauss Elimination Method
We use the result, quoted without proof, that:
if a sequence of row operations applied to a square matrix A reduces
it to the identity matrix I of the same size then the same sequence of
operations applied to I reduces it to A−1 .
Three points to note:
• If it is impossible to reduce A to I then A−1 does not exist. This will become evident by the
appearance of a row of zeros.
• There is no unique procedure for reducing A to I and it is experience which leads to selection
of the optimum route.
44 HELM (2008):
Workbook 7: Matrices
®
Phase 1
1 ∗ ∗
We now proceed by changing the columns of A left to right to reduce A to the form 0 1 ∗
0 0 1
where ∗ can be any number. This form is called upper triangular.
First we subtract row 1 from row 2 and twice row 1 from row 3. ‘Row’ refers to both matrices.
1 3 3 1 0 0 1 3 3 1 0 0
1 4 3 0 1 0 R2 − R1 ⇒ 0 1 0 −1 1 0
2 7 7 0 0 1 R3 − 2R1 0 1 1 −2 0 1
Now we subtract row 2 from row 3
1 3 3 1 0 0 1 3 3 1 0 0
0 1 0 −1 1 0 ⇒ 0 1 0 −1 1 0
0 1 1 −2 0 1 R3 − R2 0 0 1 −1 −1 1
Phase 2
This consists of continuing the row operations to reduce the elements above the leading diagonal to
zero.
We proceed right to left. We subtract 3 times row 3 from row 1 (the elements in row 2 column 3 is
already zero.)
1 3 3 1 0 0 1 3 0 4 3 −3
0 1 0 −1 1 0 ⇒ 0 1 0 −1 1 0
0 0 1 1 1 1 R1 − 3R3 0 0 1 −1 −1 1
Finally we subtract 3 times row 2 from row 1.
1 3 0 4 3 −3 1 0 0 7 0 −3
0 1 0 −1 1 0 ⇒ 0 1 0 −1 1 0
0 0 1 −1 −1 1 R1 − 3R2 0 0 1 −1 −1 1
7 0 −3
Then we have A−1 = −1 1 0
−1 −1 1
(This can be verified by showing that AA−1 = I or A−1 A = I.)
HELM (2008): 45
Section 7.4: The Inverse of a Matrix
Task 0 1 1 1 0 0
Consider A = 2 3 −1 , I = 0 1 0 .
−1 2 1 0 0 1
Use the Gauss elimination method to obtain A−1 .
First interchange rows 1 and 2, then carry out the operation (row 3) + 21 (row 1):
Your solution
Answer
0 1 1 1 0 0 R1 ↔ R2 2 3 −1 0 1 0
2 3 −1 0 1 0 ⇒ 0 1 1 1 0 0
−1 2 1 0 0 1 −1 2 1 0 0 1
2 3 −1 0 1 0 2 3 −1 0 1 0
0 1 1 1 0 0 ⇒ 0 1 1 1 0 0
−1 2 1 0 0 1 R3 + 12 R1 7
0 2 1
2
0 21 1
Now carry out the operation (row 3) − 72 (row 2) followed by (row 1) − 31 (row 3)
and (row 2) + 13 (row 3):
Your solution
46 HELM (2008):
Workbook 7: Matrices
®
Answer
2 3 −1 0 1 0 2 3 −1 0 1 0
0 1 1 1 0 0 ⇒ 0 1 1 1 0 0
7 1
0 2 2
0 12 1 R3 − 72 R2 0 0 −3 − 27 21 1
7 5 1
+6 +6 −3
R1 − 13 R3
2 3 −1 0 1 0 2 3 0 1
1 0 0 R2 + 1 R3 1 1
⇒ −6
0 1 1 0 1 0
3 6 3
0 0 −3 − 72 12 1 0 0 −3
− 27 1
2
1
Next, subtract 3 times row 2 from row 1, then, divide row 1 by 2 and row 3 by (−3).
Finally identify A−1 :
Your solution
Answer
7 5
− 13 10 2
− 43
6 6 6 6
2 3 0 R1 − 3R2 2 0 0
1 1 1
1 1 1
− ⇒ 0 1 −6
0 1 0 0
6 6 3 6 3
0 0 −3 0 0 −3
− 72 1
2
1 − 72 1
2
1
10 2
− 43 5 1
− 23
6 6 6 6
2 0 0 R1 ÷ 2 1 0 0
1 1 1
1 1 1
−
−6
⇒ 0 1 0
0 1 0
6 6 3 6 3
0 0 −3 R3 ÷ (−3) 0 0 1
− 72 1
2
1 7
6
− 61 − 13
5 1
− 23
6 6
1
1 5 1 −4
1 1
Hence A−1 −6
= 6 3
= −1
6 1 2
7 −1 −2
7
6
− 61 − 13
HELM (2008): 47
Section 7.4: The Inverse of a Matrix
4. The inverse of a 3×3 matrix - determinant method
This method which employs determinants, is of importance from a theoretical perspective. The
numerical computations involved are too heavy for matrices of higher order than 3 × 3 and in such
cases the Gauss elimination approach is prefered.
To obtain A−1 using the determinant approach the steps in the following keypoint are followed:
Key Point 10
Matrix Inverse − the Determinant Method
Given a square matrix A:
• Find |A|. If |A| = 0 then A−1 does not exist. If |A| 6= 0 we can proceed to find the inverse
matrix, as follows.
Task 0 1 1
Find the inverse of A = 2 3 −1 . This will require five stages.
−1 2 1
Answer
|A| = 0 × 5 + 1 × (−1) + 1 × 7 = 6
48 HELM (2008):
Workbook 7: Matrices
®
Your solution
Answer
3 −1 2 −1 2 3
2 1 −1 1 −1 2
1 1
0 1 0 1
5 1 7
−1 1 −1 2 = −1 1 1
2 1
−4 −2 −2
1 1 0 1 0 1
3 −1 2 −1 2 3
Answer
5 −1 7
1 1 −1
−4 2 −2
Your solution
HELM (2008): 49
Section 7.4: The Inverse of a Matrix
Answer
5 1 −4
Transposing, adj(A) = −1 1 2
7 −1 −2
Answer
5 1 −4
1 1
A−1 = adj(A) = −1 1 2 as before using Gauss elimination.
det(A) 6
7 −1 −2
Exercises
1. Find the inverses of the following matrices
1 2 −1 0 1 1
(a) (b) (c)
3 4 0 4 −1 1
2. Use the determinant method and also the Gauss elimination method to find the inverse of the
following matrices
2 1 0 1 1 1
(a) A = 1 0 0 (b) B = 0 1 1
4 1 2 0 0 1
Answers
−1
" #
1
4 −2
0 1
1 −1
1. (a) − (b) 1 (c)
2 −3 1 0 2 1 1
4
T
0 −2 1 0 −2 0
−1 1 1
2. (a) A = − −2 4 2 = − −2 4 0
2 2
0 0 −1 1 2 −1
T
1 0 0 1 −1 0
(b) B −1 = −1 1 0 = 0 1 −1
0 −1 1 0 0 1
50 HELM (2008):
Workbook 7: Matrices