You are on page 1of 17

UNIVERSITY OF NEW SOUTH WALES

SCHOOL OF MATHEMATICS
MATH 1131
MATHEMATICS 1A ALGEBRA.
Section 5: - Matrices.
In our last topic we used matrices to solve systems of linear equations. A matrix was simply
a block of numbers, which, in that context, represented the co-efficients of the unknowns
in some system of equations. In this topic, we are going to look at the basic properties of
matrices, regarded simply as blocks of numbers.
Definition: An m n matrix A is simply a block of numbers written with m rows and
n columns. If m = n we say that A is a square matrix. The set of all m n matrices is
denoted by Mmn . In most of our work, the numbers in question will be real, but later we
will also deal with matrices whose entries are complex numbers.

A=

a11
a21
a31
..
.

a12
a22
a32
..
.

..
.

a1n
a2n
a3n
..
.

am1

am2

amn

We will use the notation aij , to denote the general element in the matrix A, (similarly bij
for the general element in the matrix B and so on).
We will also use the notation (A)ij to denote the general element aij in the matrix A.
For example

1 2 3 4

A = 9 2 21 0
5 4 3 2
is a 3 4 matrix and a23 = 21 .
In Mmn there is a special matrix called the zero matrix which has all its entries equal
to 0. It is generally denoted by 0.
For example

0 0 0 0

0=
0 0 0 0
0 0 0 0
is the zero matrix in M34 .
In Mnn , the set of all square matrices of size n, there is another special matrix called the
identity matrix. It consists of 1s down the main diagonal, i.e. aii = 1 and zeros everywhere
else. It is generally written as In and sometimes simply as I, where the context tells us the
size.
1

For example
I2 =

1 0
0 1

is the identity matrix in M22 and

1 0 0

I3 = 0 1 0
0 0 1
is the identity matrix in M33 .
Definition: We say that two matrices A and B are equal if they have the same size (i.e. the
same number of rows and columns) and aij = bij for each i, j. In other words, their entries
in identical positions are the same.
Addition and Subtraction of Matrices:
We can only add or subtract matrices which have the same size, and we do this by simply adding or subtracting the entries in the same position.
More formally, if A = (aij ) and B = (bij ) are matrices of the same size, then we define
C = A + B, by C = (cij ) where cij = aij + bij . Similarly with subtraction.

1
2
3
5
3
9

Ex: Find A + B, and A B if A = 9 2 5 and B = 2 4 6


.
1 3 5
8 4 2

4 1 2
1
2

Ex: If A = 4 7 3 and B = 9 2
then
1 2 8
1 3

Note that matrix addition is commutative and associative, so


A + B = B + A and (A + B) + C = A + (B + C) whenever the addition is defined.
As with vectors, (a vector is really just an n 1 matrix anyway), we can multiply a matrix
by a scalar in the obvious way. If A is a matrix and a scalar, then B = A is a matrix
with entries bij = aij .

1
2
3

For example, if A = 9 2 5 then 3A =


1 3 5

Note that for all matrices A, we have


A + 0 = 0 + A = A and 0A = 0.
Matrix Multiplication:
Before giving you the formal definition of matrix multiplication, let us see if we can guess
what a sensible definition might be, by looking at the following simple example.
Suppose we have 3 houses H1 , H2 and H3 which order a certain number of bottles of milk,
cream and a certain number of newspapers. The milk costs $ 2 , the cream $ 3 and the
newspaper $ 1. This information can be represented using matrices as follows:

H
1

H2

H3

M C N
$

1 2 3 2

2 2 1 3
5 4 3
1

To work out the total cost to each house, we would do the following. The cost to the first
house will be 1 2 + 2 3 + 3 1 = 11 and so on for the other houses, for the second house
it is 2 2 + 2 3 + 1 1 = 11 and for the third 5 2 + 4 3 + 3 1 = 25
This example suggests how we might define multiplication of an m n matrix by an n 1
matrix (i.e. a vector with n entries).

1
2
3
1

Ex: Multiply A = 9 2 5 by v = 2 .
1 3 5
3

The formal definition is:


Definition: If A = (aij ) is an m n matrix and x is an n 1 matrix with entries xi
then we define the product of A and x to be the matrix b, an m 1 matrix whose entries
are given by
bi = ai1 x1 + ai2 x2 + + ain xn =

n
X

aik xk for 1 i m.

k=1

Now to multiply two general matrices together, we can think of each column of the second
matrix as a vector and simply apply the above ideas. Notice that for this to make sense we
need the number of columns of the first matrix to equal to number of rows of the second.
In other words we can multiply an n m matrix by an m p matrix and answer will be an
n p matrix.

1
2
3
2 3

9
Ex. Multiply the matrices A and B where A = 9 2 5 and B = 5
.
1 3 5
2 4

2
3

Ex: Let A = 2 5 and B =


3 5
AB is defined but BA is not.

1 2
9 2

The formal definition of this procedure is:


Definition: Suppose A = (aij ) is an m n matrix and B = (bij ) is an n p matrix,
then we define the product C = AB to be the m p matrix whose entries, cij are given by
cij = ai1 b1j + ai2 b2j + + ain bnj =

n
X

aik bkj

k=1

for 1 i m and 1 j p.
Ex: Find AB and BA if A =

2 3
2 5

and B =

9 2
1 3

As you see from the above example, in general AB does not equal BA. This is extremely
important fact to keep in mind. In general, matrix multiplication is NOT commutative.
Note that we write An for A
A
A} .
|
{z
n times

Ex: Prove by induction that for any positive integer n,


1
0

Ex: Find AI and IA if A =

2 3
2 5

!n

n nn1
0
n

and I =

1 0
0 1

From the above example, you surmise that:


Theorem: If A is any n n matrix, and I the identity matrix of size n, then AI = IA = A.
Also I n = I for any positive integer n.
Hence the identity matrix I behaves in the set of matrices just as the number 1 does in
ordinary arithmetic.
Here is a list of some of the basic properties of matrix multiplication. Take careful note
of exactly what you are allowed to do with matrices.
Theorem: If A, B and C are matrices for which the necessary sums and products are
defined and is a scalar, then
(i) A(B) = AB
(ii) (AB)C = A(BC). (This is known as the associative law).
(iii) (A + B)C = AC + BC and C(A + B) = CA + CB. Note that these are NOT
6

in general equal to each other. (This is known as the distributive law).


Proof: We will here only prove (ii) and the first part of (iii), since (i) is fairly trivial.
Suppose A is an m n matrix, B an n p matrix and C a matrix with p rows.
To prove the result we have to show that the entries in A(BC) equal those in the matrix
(AB)C. Thus,
!
(A(BC))ij =

n
X

air (BC)rj =

r=1

p
n X
X

n
X

air

r=1

air brs csj =

r=1 s=1

p X
n
X

p
X

brs csj

s=1

air brs csj .

s=1 r=1

At this stage, we have swapped the order of summation. You should check this step carefully.
Continuing,
(A(BC)ij =

p
X

n
X

s=1

r=1

air brs csj =

p
X

(AB)is csj = ((AB)C)ij

s=1

For (iii), we again need to check that the entries of (A + B)C are equal to the entries in
AC + BC. Thus
((A + B)C)ij =

n
X

(A + B)ik ckj

k=1

n
X

(aik + bik )ckj

k=1

n
X

aik ckj +

k=1

n
X

bik ckj

k=1

= (AC)ij + (BC)ij = (AC + BC)ij


Hence (A + B)C = AC + BC.
The Transpose:
One other operation on matrices is the transpose. To
of a matrix, we inter take the transpose

!
1
2
1 9 1

T
change the rows and columns. For example if B = 9 2 then B =
.
2 2 3
1 3
More formally, (AT )ij = aji .
Thus (AT )T = A. (An operation which when composed with itself gives the identity function
is called an involution. Complex conjugation is another example of an involution.)
Note that the transpose of a column vector is a row vector. If we take two (column) vectors,
a, b, (of the same size) then the quantity aT b is a 1 1 matrix whose entry is simply the
dot product or scalar product of a and b, as we saw in an earlier chapter. Note however
7

for two vectors of the same size, n, then abT is an n n matrix matrix.

1
2

T
T
Ex: Find a b and ab for a = 0 and b = 3 .
1
1

The transpose has the following properties which should be carefully noted.
Theorem: If A and B are matrices such that A + B and AB is defined, then
(i) (AT )T = A
(ii) (A + B)T = AT + B T
(iii) (A)T = AT .
(iv) (AB)T = B T AT .
Take particular note of result (iv). Proofs of (i), (ii) and (iii) are trivial.
Proof: (iv) Suppose A is an m n matrix, then B is an n p matrix. Hence
(AB)Tij = (AB)ji =

n
X

ajk bki .

k=1

Also
(B T AT )ij =

n
X
k=1

(B T )ik (AT )kj =

n
X
k=1

Ex: Simplify AT (CBA)T C.

bki ajk =

n
X
k=1

ajk bki = (AB)Tij .

Definition: A real matrix A is said to be symmetric if AT = A.


Note that symmetric matrix must necessarily be square. Symmetric matrices have remarkable properties which are studied in second year (MATH2501).
Ex: Write down an example of a 3 3 symmetric matrix.

Definition: A matrix A is said to be skew-symmetric if AT = A.


You can immediately see that the entries on the main diagonal of a skew-symmetric matrix are zero.

Rotation Matrices:
!

x
Suppose
is the position vector of a point P in 2-dim space, which has distance r
y
from the origin and makes an angle of with the positive x axis.

r cos
This vector can be written as
.
r sin
Now !
rotate P anti-clockwise about the origin through an angle to the new point P 0 =
x0
.
y0

Then

x0
y0
=

r cos( + )
r sin( + )

x cos y sin
x sin + y cos

r cos cos r sin sin


r sin cos + r cos sin

cos
sin

sin
cos

x
y

= Ax.

Note that if we apply the rotation twice, we have


2

A =

cos 2
sin 2

sin 2
cos 2

and so on.

The Inverse of a Matrix:


Given a square matrix A, can we find a matrix B such that AB = I, the identity matrix? In general the answer is NO, and later we shall find a way of telling exactly when such
a matrix exists. For the moment suppose we can find such a B. We call B the inverse of A
and write B = A1 . We should read A1 as A inverse. A matrix A which has an inverse is
called invertible.
For a 2 2 matrix there is a very useful formula (which is worth learning) for the inverse.
a b
c d

!1

1
=
ad bc

d b
c a

This formula will only work if ad bc 6= 0. This quantity is called the determinant of the
matrix. You can check the formula works by simply multiplying.
Ex: Find the inverse of

3 1
2 5

For matrices of higher order, there is no simple formula for the inverse. We will develop an
algorithm for finding the inverse if it exists.
Suppose we have a 3 3 invertible matrix A whose inverse X we seek to find. We know that
10

AX = 0
0
Suppose we

0 0
1 0
.
0 1


write X as x1 x2 x3 where x1 etc are the columns of X. Thus we have

1 0 0



A x1 x2 x3 =
0 1 0 . We can think of this equation as three sets of equations,
0 0 1

1
0
0

namely Ax1 = 0 , Ax2 = 1 and Ax3 = 0 .


0
0
1
To solve each of these equations, we would take A and augment it with each of the three
right hand sides in turn and row reduce. If we completely row reduce to reduced echelon
form, then the solutions would appear on the right hand side of each reduction. To save time
we could do all three reductions in one go, by augmenting the matrix A with the identity
matrix and completely row reducing. This is the algorithm for finding the inverse of A.

1 2 3

Ex: Find the inverse of A = 2 5 3 .


1 0 8

1 6 4

Ex: Does the matrix A = 2 4 1 have an inverse?


1 2 5

11

Properties of Inverses:
Suppose that A, B are invertible matrices of the same size then
(i) (A1 )1 = A.
(ii) (AB)1 = B 1 A1
Note the second result. It is very similar to the rule we had for transposes. Observe also
that it generalises: (ABC)1 = C 1 B 1 A1 assuming that all the matrices have the same
size and invertible.
To see why (ii) is true, we simply note that (AB)(B 1 A1 ) = A(BB 1 )A1 = AIA1 =
AA1 = I. Hence the inverse of AB is B 1 A1 .
Ex: Simplify HG(F HG)1 F G.

We can use inverses to solve equations. For example, solve


2 4
1 7

x=

2
3

Hence, if we are solving Ax = b and A is invertible, we can write x = A1 b.


We can then state the following result.
Theorem: If A is a square matrix then Ax = b has a unique solution if and only if A
12

is invertible.
Determinants:
We have seen that the inverse of the general 2 2 matrix

a b
c d

exists if and only if

ad bc 6= 0.
This quantity is called the determinant of the matrix.
a b
c d

For the matrix A =

, we write its determinant as


a b
det(A) = ad bc or
c d




= ad bc.

There is a similar, but more complicated formula for the determinant of a 3 3 and higher
size matrices. There are various ways to define the determinant, but we take a purely computational approach and develop a method of calculating the determinant for a general matrix.
Definition: Suppose A is a square matrix. We define |Aij |, called the ijth minor of
A, to be the determinant of the matrix obtained by deleting the ith row and jth column of
A.


1
4 5
1 4


For example, if A = 1 2 7 then |A23 | =
2 3
2 3 4




= 11.

We can now define the determinant recursively as follows:


Definition: The determinant of an n n matrix is
|A| = a11 |A11 | a12 |A12 | + a13 |A13 | + (1)n1 a1n |A1n |.
This formula is sometimes referred to as expanding along the top row. Essentially, it says
that we multiply each entry in the top row by the determinant of the matrix obtained by
deleting the row and column that the entry belongs to and then we take an alternating sum
and difference of all these quantities.

13

1
4 5

Ex: Find the determinant of A = 1 2 7 .


2 3 4

For 4 4 matrices (and higher orders), we have to apply this definition iteratively.
There is, however, a more efficient method of finding the determinant which we shall see later.
Properties of the Determinant:
Suppose A and B are n n matrices then
(i) |AB| = |A||B|.
(ii) |A| = |AT |.
(iii) |I| = 1.
(iv) |A1 | =

1
|A|

assuming that |A| 6= 0.

Proof of (iv): AA1 = I so |AA1 | = |I|. Now using (i) and (iii) we see that this is
equal to |A||A1 | = 1 and the result follows.
In the light of property (ii), we can see that we can change the definition of determinant
slightly and expand down the first column instead of the across the first row. This can be
very useful calculationally, for example:

1 4 5


The deteminant 0 2 7

0 3 4






2 7



= 1
= 29, since if we expand down the first col
3 4

umn, the other minors are multiplied by zero.

14

Ex: Suppose |A| = 3, |B| = 2, and A, B are square matrices of the same size.
Simplify |A2 B T (B 1 )2 A1 B|.

Further Properties of the Determinant:


(i) |A| = 0 if and only if A is NOT invertible.
(ii) If A has a row or column of zeros then |A| = 0.
(iii) If A has two rows or columns which are multiples of each other then |A| = 0.
(iv) If a row or column of A is multiplied by a scalar then the determinant of A is
multiplied by . Note that if A is an n n matrix, then |A| = n |A|.
(v) If we swap two rows or two columns of A then the determinant of the resulting
matrix is 1 times |A|.
(vi) If U is in row echelon form, then |U | is simply the product of the diagonal entries.
(vii) If U is the row-echelon form of A, which was achieved using only row swaps and row
subtractions then |A| = |U |, where  = 1 if there was an even number of row swaps and 1
if there was an odd number of row swaps.
For some proofs of these results, see the Algebra Notes.
From these results, we can find an efficient method to calculate the determinant of any
square matrix.
We take the matrix A and reduce it to row echelon form U , making sure that we do NOT
make any row swaps and we do not divide any row by a common factor of entries, then
|A| = |U | and the latter is simply the product of the diagonal entries. If it is necessary (or
convenient) to make a row swap or to divide a row by a common factor, then we can take
that into account using the above rules.

15


1 2 3


Ex: Find 2 5 3

1 0 8





Ex: Find


1 1 0
3
2 2 6 1
.
4 2 1
7
3 5 7 2

16

Determinants and Equations:


We finish this section by putting together a number of ideas. If we are looking at the
solution of Ax = b, where A is a square matrix, then we can see that if A is invertible, we
could multiply both sides by A1 and obtain the unique solution x = A1 b. Thus, we can
conclude:
Theorem: Suppose A is a square matrix. Then Ax = b has a unique solution if A is
invertible which is true if and only if det(A) 6= 0. If A is not invertible, i.e. if det(A) = 0,
then the system may have no solution or infinitely many solutions.
Ex: Without solving, determine whether or not Ax = b has a unique solution if A =

1 1 3
3 1
.
3 1 4

17

You might also like