4038CEM Engineering Mathematics I
4010CEM Mathematics for Physics and Engineering
Week 2 – Linear Algebra
HELM Workbooks 7 & 8
Eng. Mathematics Chapter –
Adv. Eng. Mathematics Chapter 7
Dr. Paul Griffiths
paul.griffiths@coventry.ac.uk
Introduction to matrices
A matrix contains an array of numbers
1 2 3
A= .
4 5 6
This matrix has 2 rows and 3 columns. We would say it is a "2 by 3"
matrix (2 × 3). Below is an example of a "3 by 2" matrix (3 × 2)
1 2
B = 3 4 .
5 6
A generalised m × n matrix has m rows and n columns.
Matrices can used in a variety of different ways and they form the
basis of the numerical computing software MATLAB (matrix
laboratory).
A general matrix
A generalised 3 × 3 matrix has the form
a11 a12 a13
A = a21 a22 a23 .
a31 a32 a33
Here aij denotes the element in row i and column j.
Taking B from the previous slide
1 2
B = 3 4 ,
5 6
we have that b11 = 1, b12 = 2, b21 = 3, b22 = 4, b31 = 5 and b32 = 6.
Addition and subtraction
In order to add or subtract matrices we need to ensure that they are
the same order. For example, if
1 2
A= .
3 4
and
5 6
B= .
7 8
Then
1 2 5 6 1+5 2+6 6 8
C =A+B= + = = .
3 4 7 8 3+7 8+4 10 12
Because A and B have the same order (2 × 2) we can do the
operation.
We find that C is also a 2 by 2 matrix and that cij = aij + bij , for
i = 1, 2 and j = 1, 2.
Examples I
(1) Given that
1 2 6 8 11 2 10 0 1 1
A= , B= , C= , D= .
3 4 3 9 30 4 5 3 14 5
Determine
• The order of A.
• The order of C.
• b11 .
• d23 .
• A + B.
• C − D.
• A + C.
Multiplication with a scalar
Take the following matrices
1 2 1 20 7
A= , B= .
3 4 3 2 2
Then
2 4 1 2
A+A= = 2A = 2 × .
6 8 3 4
This example shows that multiplying a matrix by a scalar is
equivalent to multiplying every element of that matrix by the
scalar.
10 200 70
10B = .
30 20 20
The transpose
If
a11 a12 a13 1 2 3
A = a21 a22 a23 = 4 5 6 .
a31 a32 a33 7 8 9
Then we define the transpose of AT like so
a11 a21 a31 1 4 7
AT = a12 a22 a32 = 2 5 8 .
a13 a23 a33 3 6 9
Transpose = "switch rows and columns".
The transpose is incredibly useful as we’ll see a little later down the
line.
Examples II
(1) Given that
0 1
11 2 10
A= , B = 3 15 .
30 4 5
5 6
Determine
• 10A.
• 12 B.
• AT .
• BT .
(2) Show that for generalised 2 by 2 matrices A, B and C that
• A + B = B + A.
• A + (B + C) = (A + B) + C.
• AT + BT = (A + B)T .
Matrix multiplication I
Given that
5
A= 1 2 , and B = .
7
Then we have that
5
C = AB = 1 2 = (1 × 5) + (2 × 7) = 19 .
7
Here we have multiplied a 1 by 2 matrix (row vector) with a 2 by 1
matrix (column vector) and the result is a 1 by 1 matrix (scalar).
In general if we multiply a m × n matrix with a p × q matrix we will
return a matrix of order m × q. However, n must be equal to p in
order for us to be able to do the calculation!
Matrix multiplication II
Given that
1 2 5 6
A= , and B= .
3 4 7 8
Then we have that
(1 × 5) + (2 × 7) (1 × 6) + (2 × 8) 19 22
C = AB = = .
(3 × 5) + (4 × 7) (3 × 6) + (4 × 8) 43 50
The element in the ith row and j th column is determined by
multiplying the ith row of A by the j th column of B.
Matrix multiplication III
In general, if
a11 a12 a13 b11 b12 b13
A = a21 a22 a23 , and B = b21 b22 b23 .
a31 a32 a33 b31 b32 b33
Then
C = AB
" #
a11 b11 + a12 b21 + a13 b31 a11 b12 + a12 b22 + a13 b32 a11 b13 + a12 b23 + a13 b33
= a21 b11 + a22 b21 + a23 b31 a21 b12 + a22 b22 + a23 b32 a21 b13 + a22 b23 + a23 b33 .
a31 b11 + a32 b21 + a33 b31 a31 b12 + a32 b22 + a33 b32 a31 b13 + a32 b23 + a33 b33
Matrix multiplication will come naturally to you very quickly!
Examples III
(1) Given that
2 3 2 2 3 6
A= , b= , c= 3 4 , D=
−1 5 1 −1 5 7
3 7 4
E = 4 2 , f = 1 2 3 , g = 5 .
1 3 6
Evaluate
• Ab.
• cA.
• cb.
• DE.
• f g.
• DA.
(2) Show that for generalised 2 by 2 matrices A and B that
AB 6= BA.
The zero matrix and identity matrix
We have that
1 2 0 0 0 0
= A0 = = 0.
3 4 0 0 0 0
We call the matrix 0 the (2 by 2) zero matrix. Note that
A0 = 0A = 0.
Also, we have that
1 2 1 0 1 2
= AI = = A.
3 4 0 1 3 4
We call the matrix I the (2 by 2) identity matrix. Note that
AI = I A = A.
The inverse matrix
Given A how do we go about finding A−1 such that
AA−1 = I = A−1 A?
Given that
a b d −b
A= , and B = .
c d −c a
Then we notice that
ad − bc 0
AB = = BA.
0 ad − bc
Therefore
1 1 0 1
AB = = BA.
ad − bc 0 1 ad − bc
The inverse matrix
The work we did on the previous slide show why the inverse of a 2
by 2 matrix
a b
A= ,
c d
is
−1 1 d −b 1 d −b
A = = .
ad − bc −c a det(A) −c a
For a generalised 2 by 2 matrix A we define the determinant as
det(A) = ad − bc. Clearly if the determinant is zero then no matrix
inverse exists!
Solution of simultaneous equations I
Suppose we want to solve the equations
x + 2y = 2,
3x + 3y = −3.
We can use matrix analysis to solve these equations – notice that if
1 2 x 2
A= , x= , and b = .
3 3 y −3
Then Ax = b describes, exactly, the simultaneous equations above!
Also notice that
A−1 Ax = I x = x = A−1 b.
If we can find the inverse of the matrix A then we can solve the
system of equations.
Solution of simultaneous equations II
Given that
1 2
A= .
3 3
Then A−1 is given by
−1 1 3 −2 1 3 −2 1 3 −2
A = = =− .
det(A) −3 1 (3 − 6) −3 1 3 −3 1
Therefore
x 1 3 −2 2 1 12 −4
x= =− =− = .
y 3 −3 1 −3 3 −9 3
So x = −4 and y = 3.
Solution of simultaneous equations III
We can, however, use another matrix method to solve these
equations. If we write
1 2 2
 = .
3 3 −3
Then we can use row operations to solve for the variables x and y.
Here we have our original matrix A on the left and our column
matrix b on the right.
Operation 1: R2 → R2 − 3R1
1 2 2
 = .
0 −3 −9
Solution of simultaneous equations IV
Operation 2: R2 → R2 /(−3)
1 2 2
 = .
0 1 3
Operation 3: R1 → R1 − 2R2
1 0 −4
 = .
0 1 3
We now have the identity matrix on the left and our solution on the
right!
If we are able to reduce our ‘matrix’ to the identity using row
operations (add or subtract rows from one another or multiply a
row by a scalar) then our solutions to the linear equations will be
given by the right-hand side of our augmented matrix.
Examples IV
(1) Given that
2 3 2 5 3 4
A= , B= , C= .
−1 5 1 −3 −6 −2
Determine
• A−1 .
• B−1 .
• C −1 .
• A−1 C −1 .
• (AC)−1 .
(2) Solving the following set of linear equations using (i)
rearrangement, (ii) the inverse matrix method & (iii) reduction to
row echelon form:
3x + 2y = 36,
5x + 4y = 64.
Which method do you find easiest/quickest?