Matrices Update
Matrices Update
1 An Introduction to Matrices
If a matrix has m rows and n columns, then we call that matrix an m n matrix. So, in the
examples above, A is a 2 2 matrix, B is a 2 3 matrix, and C is a 3 3 matrix. This m n
term is called the order of the matrix, and if m = n, then the matrix is a square matrix. (For
example, A and C are examples of square matrices, but B is not a square matrix).
When we are working with a general matrix, we write something of the form:
11 12
A= .
21 22
Given this, it is clear that we are dealing with a matrix of order 2 2. We could also write
A = (ij )mn , which is way of saying we have a matrix of order m n in which the entry
located in the ith row and the jth column is the entry ij .
Manipulating Matrices
Just like numbers and vectors, there are a number of operations we can perform to pairs of
matrices. Firstly, let us define what we mean when we say two matrices are equal. Like vectors,
two matrices are equal if and only if their components are equal. In other words,
a b e f
= ,
c d g h
if a = e, b = f , c = g and d = h. Observe the crucial fact that two matrices of different orders
can never be equal to each other. [1]
Now, let us consider adding two matrices together. This is achieved by adding the two corre-
sponding elements of each matrix. Written algebraically, if A = (ij )mn and B = (ij )mn ,
then the (i, j)th component of the matrix A + B is ij + ij (or, equivalently, the matrix
A + B = (ij + ij )mn ).
For example:
5 3 2 1 5+2 3+1 7 4
+ = = .
1 4 1 8 1+1 4+8 2 12
1
Subtracting two matrices is performed in exactly the same way, except we subtract the two
components of each matrix. For example:
5 3 2 1 52 31 3 2
= = .
1 4 1 8 11 48 0 4
Notice we can only add / subtract matrices of the same order.
Finally, there is scalar multiplication. A scalar is, basically, an ordinary number, so scalar
multiplication of a matrix is anything of the form A, where is the scalar and A is the matrix.
To perform it, simply multiply each element of A by . Heres a quick example to show you
what I mean:
5 3 (3 5) (3 3) 15 9
3 = = .
1 4 (3 1) (3 4) 3 12
2 Matrix Multiplication
Now that weve looked at matrix addition and subtraction, we shall now look at the more
complicated operation of multiplying matrices together.
The proper algebraic definition of the multiplication of two matrices is as follows:
If A = (ij )lm and B = (ij )mn , then we define AB to be the matrix S = (ij )ln , such that
ij = i1 1j + i2 2j + + im mj .
Let me explain the procedure through a worked example:
1 3 0
2 0 5
Let A = and B = 5 2 1 . Find AB.
1 3 8
6 4 0
Therefore, we can say that finding the value of ij is the same as finding the dot product of the
ith row of A and the jth column of B.
2
Let us use this method to find the solution matrix S:
11 = (2, 0, 5) (1, 5, 6) = (2 1) + (0 5) + (5 6) = 32
12 = (2, 0, 5) (3, 2, 4) = (2 3) + (0 2) + (5 4) = 26
13 = (2, 0, 5) (0, 1, 0) = (2 0) + (0 1) + (5 0) = 0
21 = (1, 3, 8) (1, 5, 6) = (1 1) + (3 5) + (8 6) = 64
22 = (1, 3, 8) (3, 2, 4) = (1 3) + (3 2) + (8 4) = 41
23 = (1, 3, 8) (0, 1, 0) = (1 0) + (3 1) + (8 0) = 3.
With more practice, many of the above steps can be done mentally (in your head), which will
speed the process up a lot. Remember the following important points, for they will be of use to
us later on:
Although the two matrices dont have to be of the same order, matrix multiplication is
only possible if the number of columns in the first matrix is equal to the number of rows
in the second matrix. [1]
The solution matrix will have the same number of rows as the first matrix, and the same
number of columns of the second matrix. [1]
In general, AB 6= BA, from the two previous bullet points. [1]
Let us go through another worked example, so that the general method is clear to all of you
(this example is adapted from one in the book [1]):
Example. Compute
1 2 5 2 5 0
2 1 3 3 1 3 .
0 3 1 6 1 0
3
Solution.
11 = (1, 2, 5) (2, 3, 6) = (1 2) + (2 3) + (5 6)
= 26
12 = (1, 2, 5) (5, 1, 1) = (1 5) + (2 1) + (5 1)
=2
13 = (1, 2, 5) (0, 3, 0) = (1 0) + (2 3) + (5 0)
=6
21 = (2, 1, 3) (2, 3, 6) = (2 2) + (1 3) + (3 6)
= 17
22 = (2, 1, 3) (5, 1, 1) = (2 5) + (1 1) + (3 1)
= 14
23 = (2, 1, 3) (0, 3, 0) = (2 0) + (1 3) + (3 0)
= 3
31 = (0, 3, 1) (2, 3, 6) = (0 2) + (3 3) + (1 6)
=3
32 = (0, 3, 1) (5, 1, 1) = (0 5) + (3 1) + (1 1)
= 2
33 = (0, 3, 1) (0, 3, 0) = (0 0) + (3 3) + (1 0)
= 9.
In this subsection, I would like to introduce you to a couple of matrix types that will be of
considerable worth to us later on.
Diagonal Matrices
We have met square matrices in an earlier section. However, there is a special type of square
matrix, called a diagonal matrix, which is a square matrix where any entry NOT on the main
diagonal (i.e. any ij where i 6= j) is 0. Here are few examples:
1 0 0 0
3 0 0
2 0 0 0 0 0
, 0 1 0 ,
0 5 0 0 8 0
0 0 9
0 0 0 2
4
Identity Matrices
Now, we introduce you to a special type of diagonal matrix, that has a lot of uses when we
work with matrices in general. Called the identity matrix, it is the matrix you multiply another
matrix by to get that matrix as the result (the similar property to the number 1 in the set of
real numbers: notice that 5 = 5 1 = 1 5). The identity matrix is a diagonal matrix where
all the elements on the main diagonal are equal to 1, denoted In , where n is the number of rows
/ columns in the matrix. [1] For example:
1 0 0
1 0
I2 = , I3 = 0 1 0 .
0 1
0 0 1
Zero Matrices
The final special type of matrix well look at is the zero matrix, 0n . This is an n n matrix
where every element is equal to 0. For example:
0 0 0
0 0
02 = , 03 = 0 0
0 .
0 0
0 0 0
Similarly to the number 0 in the real number system, whenever you add a matrix of order n n
to 0n , you get the original matrix as a result. [1] For example:
3 2 0 0 3+0 2+0 3 2
= = .
4 7 0 0 4+0 7+0 4 7
When dealing with square matrices, there is a very special piece of information, called the
determinant. Since finding the determinant of higher order matrices is really difficult, Ill deal
strictly with matrices of order 2 2. Firstly, lets look at the definition:
a b
The determinant of the matrix A = is ad bc.
c d
As always, there are a number of ways of writing the determinant of matrix A. The most
commonly used is det(A), but we can also express it in the following ways:
a b
det(A) = |A| = = ad bc.
c d
Let me now give you a couple of worked examples for calculating the determinant of 2 2 ma-
trices:
2 5
Example. A = . Find det(A).
3 4
Solution.
det(A) = (2 4) (5 3) = 8 15 = 7.
5
2 1
Example. Find
.
4 10
Solution.
2 1
4 10 = (2 10) (1 4) = 20 4 = 16.
If we choose any number, x say, and multiply it by the real number x1 , we get the number 1.
The number x1 is, therefore, the multiplicative identity of the number x. (Beware that 0 doesnt
have a multiplicative identity as one cannot divide by 0). So, with this in mind, does a similar
property hold in matrices? [1]
Well, there are cases where a matrix has no inverse, but in the other cases (i.e. where an inverse
does exist) there is a method for finding it. The proof of this is quite technical and far beyond
the reaches of this website, however the result of the proof is as follows:
a b 1 d b
If A = , then the inverse of A is det(A) .
c d c a
From this, we can clearly see when a matrix A is invertible, and when it isnt. For any 2 2
1 1
matrix, there is a det(A) scalar multiple. This means that if det(A) = ad bc = 0, then det(A)
is not defined, and hence the inverse does not exist for the matrix A. Therefore, if det(A) 6= 0,
then an inverse exists and the statement above shows us how to calculate it. When the inverse
matrix exists for a given matrix A, we often denote that inverse by A1 . [1]
Let me finish off with a couple more examples of determining whether or not a matrix has an
inverse, and it it does, finding that inverse.
4 2
Example. Is the matrix invertible? If it is, invert it.
6 3
Solution.
ad bc = (4 3) (2 6) = 0, so no, the matrix is not invertible.
3 2
Example. Is the matrix invertible? If it is, invert it.
4 2
Solution.
1 1 2 2 1 1
ad bc = (3 2) (2 4) = 2, so A = = 3 .
2 4 3 2 2
References
[1] Hurst E., Gould M. (2009), Bridging the gap to university mathematics, New York: Springer,
London, ISBN 978-1-84800-329-0, p. 73-87.