Download as pdf or txt
Download as pdf or txt
You are on page 1of 57

Math299 Engineering maths

Matrices, Simultaneous Equations

Dr. Rachel N. Bearon, rbearon@liv.ac.uk

University of Liverpool
MATH299 General Information 1

I Alternate Wednesday periods will be a tutorial (starting on


8th October)
I Please raise your hand if you wish to speak. Talking in a large
class is very disruptive, and I may ask you to leave the lecture
or report you to your tutor without further warning if this is
a problem.
I Please make every effort to arrive on time as late arrivals are
also disruptive.
I The course textbook is Mathematical Methods for Physics
and Engineering by K. Riley et al.
MATH299 General Information 2

I Homework will be set every two weeks to be submitted to the


Engineering Department Student Support Office.
I Lecture notes, homework & solutions will be available on
VITAL
1.1 MATRICES; Introduction

Matrix is a different name for an array which obeys certain


algebraic rules. An m by n matrix is a matrix with m rows and n
columns. For example,
 
1 2 3
5 6 7
is a 2 × 3 matrix.
A general 2 × 3 matrix can be written
 
a11 a12 a13
= [aij ], i = 1, 2, j = 1, 2, 3.
a21 a22 a23

aij are called the elements of the matrix.


Examples include row and column vectors:

a = 2 −1 0 4 ,
 
−4
b= .
−2
Some matrices have special properties, e.g.
 
3 1 2
A = 1 −2 3
2 3 0

is a symmetric matrix.
1.2.1 Rules of matrix algebra; Equality
Given
   
5 3 0 b11 3 0
A = −2 1 a23  , B = b21 1 4 ,
−1 a32 2 −1 0 2

if we require A = B then clearly

a23 = 4, a32 = 0, b11 = 5, b21 = −2.

On the other hand, given


 
2 0  
2 0
A = a21 1 , B= ,
4 b22
−1 3

there is no way to require A = B since A and B have different


numbers of rows.
1.2.2 Rules of matrix algebra; Multiplication by a scalar

Given  
0 1
−1 2
A=
1

3
−4 0
we have  
0 5
 −5 10
5A = 
 5
.
15
−20 0
Given 
B = 12 −21 ,
we have 
B = 3 4 −7 .
1.2.3 Rules of matrix algebra; Sum of matrices

Given that  
  3 0
2 1
A= , B = −1 2 ,
0 −1
4 1
A ± B are not defined, since A and B must have the same number
of rows and columns, so that we can add (or subtract) the two
matrices.
Example: Given
   
4 2 1 −2 0 5
A= , B=
0 −1 3 3 7 −6
 
2 2 6
A+B = .
3 6 −3
Associative law of addition:

(A + B) + C = A + (B + C )
Also for constants k, l,

k(A + B) = kA + kB,
(k + l)A = kA + lA.
Attendance

A: Maths is a really useful tool in engineering and I’m confident I’ll


do well
B: I find maths really hard but want to be a great engineer
C: I hate maths & think this module is a waste of time
D: I love socialising with my friends & can’t think of a better place
to chat than in a maths lecture
1.2.4 Rules of matrix algebra; Transpose

Given  
3 0
A = −1 2 ,
4 1
the transpose of A is defined by
 
T 3 −1 4
A = ,
0 2 1

i.e. rows and columns are interchanged. Hence in this example a


3 × 2 matrix becomes a 2 × 3 matrix after taking the transpose.
Question: can we have A = AT ?
Answer: Yes. We call these matrices symmetric, for example,
   
1 2 T 1 2
A= , A = = A.
2 −1 2 −1

Clearly this is only possible for square matrices.


Rules:

(A + B)T = AT + B T , (AB)T = B T AT , (AT )T = A.


1.2.5 Rules of matrix algebra; Multiplication

We can multiply matrices if and only if the number of columns of


the first matrix is the same as the number of rows of the second
matrix.
Multiplying an m × n matrix A by an n × p matrix B, we obtain
the m × p matrix AB.
The entry in the i th row and the j th column of AB is the dot
product of the i th row of A with the j th column of B.

   
1 −2 3
C= , D= ,
0 1 1
      
1 −2 3 3−2 1
CD = = = .
0 1 1 0+1 1
 
  3 1 2
3 0 1
A= , B = 1 −2 3
2 1 −1
2 3 0
 
9+2 3+3 6
AB =
6+1−2 2−2−3 4+3
 
11 6 6
= .
5 −3 7

Note that here the product of a 2 × 3 matrix with a 3 × 3 matrix is


a 2 × 3 matrix as expected.
Practical example: The costs (in thousands of pounds) for making
two computers (PC1086 & PC1186) are given by:

PC1086 PC1186
1.2
" 1.6 # Raw Materials
A= 0.3 0.4 Labour
0.5 0.6 Misc

The production figures (in multiples of 10,000 units) are given by:

Spr Sum Aut Win


B= 3 8 6 9 PC1086
6 2 4 3 PC1186

Find a matrix to show the costs of each component per quarter.


PC1086 PC1186
" 1.2 1.6 # Spr Sum Aut Win
A= 0.3 0.4 B= 3 8 6 9 PC1086
6 2 4 3 PC1186
0.5 0.6

Spr Sum Aut Win


"13.2 12.8 13.6 15.6# Raw Materials
C = AB = 3.3 3.2 3.4 3.9 Labour
5.1 5.2 5.4 6.3 Misc
1.2.5 Rules of matrix algebra; Multiplication continued

Given
     
2 0 2 1 0 −1 
a = 0 ,
 B = 3 1  , C = 0 2 3  , d= 3 0 4 .
1 0 1 2 0 1

(a) Find those products which are defined.


(b) Find a2 , B 2 , C 2 , if they are defined.
C a, CB, C 2 ,ad, da, dB, dC , are defined. Undefined: the rest.
Graphical representation of calculating matrices
    
1 0 −1 2 1
Ca =  0 2 3   0 = 3
 
2 0 1 1 5
    
1 0 −1 0 2 0 1
CB = 0 2 3  3 1  = 6 5 
2 0 1 0 1 0 5
    
1 0 −1 1 0 −1 −1 0 −2
C 2 = 0 2 3  0 2 3  =  6 4 9  .
2 0 1 2 0 1 4 0 −1
   
2  6 0 8
ad = 0 3 0 4 = 0 0 0 ,
1 3 0 4
 
 2
da = 3 0 4 0 = 10,
1
 
 1 0 −1 
dC = 3 0 4 0 2 3  = 11 0 1 ,
2 0 1
By now it must be clear that matrix multiplication does not
commute, i.e. for two given suitable matrices AB is not necessarily
equal to BA.
Also note that pre- or post-multiplied is a suitable terminology.
If AB = 0 it does not necessarily follow that A = 0 or B = 0 or
BA = 0. For example, given
   
2 1 3 −1
A= , B= ,
−4 −2 −6 2
    
2 1 3 −1 0 0
AB = = ,
−4 −2 −6 2 0 0

but     
3 −1 2 1 10 5
BA = = .
−6 2 −4 −2 −20 −10
Finally:
Distributive law of addition:

A(B + C ) = AB + AC .

Associative law of multiplication:

A(BC ) = (AB)C .
Matrix transformations - computer graphics
http://www.songho.ca/opengl/gl transform.html
1.2.6 Special matrices

Transpose (revisited)
Two important properties:

(A + B)T = AT + B T ,
(AB)T = B T AT .

Example: Given
   
1 0 3
A= , b= ,
2 −1 4

verify that (Ab)T = bT AT .


    
1 0 3 3
Ab = =
2 −1 4 2
⇒ (Ab)T

= 3 2 .
 
1 2
bT = 3 4 , T

A =
0 −1
 
 1 2
⇒ bT AT

= 3 4 = 3 2 .
0 −1
Symmetric matrices (revisited)

We are more or less familiar with square matrices now, that is


matrices with the same number of rows and columns. A square
matrix A is said to be symmetric if A = AT . For example,
 
  0 2 −3
1 2
A= , B= 2 0 0 
2 −1
−3 0 1

are examples of 2 × 2 and 3 × 3 symmetric matrices. Observe the


reflection of elements in the leading diagonal.
A square matrix A for which A = −AT is said to be
skew-symmetric.
For example,
 
  0 3 −1
0 1
A= , B = −3 0 2
−1 0
1 −2 0

are examples of 2 × 2 and 3 × 3 skew-symmetric matrices.


A square matrix A can always be written as a sum of one
symmetric and one skew-symmetric matrix.
Example: show that AAT is symmetric.
Example: show that AAT is symmetric.
Solution: Set C = AAT . We need to show that C = C T .
Example: show that AAT is symmetric.
Solution: Set C = AAT . We need to show that C = C T .

C T = (AAT )T = (AT )T AT = AAT = C .


Example: The product of two symmetric matrices A and B is
symmetric iff (if and only if) AB = BA.
Example: The product of two symmetric matrices A and B is
symmetric iff (if and only if) AB = BA.
Solution: A = AT and B = B T since A, B are symmetric.
Example: The product of two symmetric matrices A and B is
symmetric iff (if and only if) AB = BA.
Solution: A = AT and B = B T since A, B are symmetric.
Set C = AB.
Then C T = (AB)T = B T AT = BA.
Example: The product of two symmetric matrices A and B is
symmetric iff (if and only if) AB = BA.
Solution: A = AT and B = B T since A, B are symmetric.
Set C = AB.
Then C T = (AB)T = B T AT = BA.
So AB symmetric means C = C T which is equivalent to AB = BA.
Diagonal matrices

A square matrix with zeroes off the leading diagonal is called a


diagonal matrix. For example,
 
  0 0 0
−1 0
A= , B = 0 2 0
0 1
0 0 0

are 2 × 2 and 3 × 3 diagonal matrices. Clearly diagonal matrices


are symmetric.
Identity matrix

This is the n × n matrix In with 1s along the main diagonal and 0s


elsewhere. For example,
 
  1 0 0
1 0
I2 = , I3 = 0 1 0 
0 1
0 0 1

If A is an arbitrary m × n matrix and B is an arbitrary n × p


matrix, then
AIn = A and In B = B.
Powers of matrices

A2 = AA,
A3 = AA2 = A2 A,
and so on. Note that computing powers is an easy task for
diagonal matrices, e.g.
 
2 0
A =
0 1
    
2 2 0 2 0 4 0
⇒A = =
0 1 0 1 0 1
 2 
2 0
=
0 12
    
3 2 4 0 2 0 8 0
A = A A= =
0 1 0 1 0 1
 3 
2 0
= , etc.
0 13
1.3 Systems of linear equations

Given

2x + y = 3
−x + 2y = −1

we can write this system as


    
2 1 x 3
= .
−1 2 y −1

This system is called linear, since the unknowns x and y only


appear to the first power. You can solve this system using the
methods you already know, or by using matrix methods, which are
much more powerful.
Example: Solve

4y + 3z = 13
x − 2y + z = 3
3x + 5y = 11.

Solution: Rewrite the system in matrix form:


    
0 4 3 x 13
1 −2 1 y  =  3  .
3 5 0 z 11

Or more concisely, as the augmented matrix:


 
0 4 3 13
 1 −2 1 3 
3 5 0 11
To solve the system, i.e. find x, y &z we will use the so-called
“elementary row operations”.
First swap the rows (equivalent to swapping the equations–no
effect on the result):

 
1 −2 1 3
 3 5 0 11 
0 4 3 13

Now add multiples of one equation to another (no effect on the


result):

 
R1 1 −2 1 3
R2 − 3R1  0 11 −3 2 
R3 0 4 3 13
 
R1 1 −2 1 3
R2  0 11 −3 2 
11R3 − 4R2 0 0 45 135

This matrix is now said to be in echelon form–note the structure


of zeroes. It is optional to reduce the matrix above to
 
R1 1 −2 1 3
R2 /11  0 1 −3/11 2/11 
R3 /45 0 0 1 3
What this tells us is that:

z = 3
3 2 3 2
y− z = ⇒ y − .3 =
11 11 11 11
2 9
⇒y = + =1
11 11
x − 2y + z = 3 ⇒ x − 2.1 + 3 = 3 ⇒ x = 2.

This is just a specific example, solved in a specific way. Your final


matrix (echelon form) might be different, but you can still find the
correct set of solutions for x, y and z. Also note that this method
is known as Gaussian elimination.
Applications for solving linear systems
Last time we solved:
4y + 3z = 13
x − 2y + z = 3
3x + 5y = 11.
By writing as augmented matrix:
 
0 4 3 13
 1 −2 1 3 
3 5 0 11

performing row operations:


 
1 −2 1 3
 0 1 −3/11 2/11 
0 0 1 3
and backwards subtitution to obtain
z = 3, y = 1, x = 2.
Matlab Application
Example: Solve the linear equations:

x − y + 2z = 2
3x − y + 3z = 5
x +y −z = 1

using row operations.


Solution:
 
1 −1 2 2
 3 −1 3 5 
1 1 −1 1
Example: Solve the linear equations:

x − y + 2z = 2
3x − y + 3z = 5
x +y −z = 1

using row operations.


Solution:
 
1 −1 2 2
 3 −1 3 5 
1 1 −1 1
 
R1 1 −1 2 2
R2 − 3R1  0 2 −3 −1 
R3 − R1 0 2 −3 −1
Example: Solve the linear equations:

x − y + 2z = 2
3x − y + 3z = 5
x +y −z = 1

using row operations.


Solution:
 
1 −1 2 2
 3 −1 3 5 
1 1 −1 1
 
R1 1 −1 2 2
R2 − 3R1  0 2 −3 −1 
R3 − R1 0 2 −3 −1
 
R1 1 −1 2 2
R2  0 2 −3 −1 
R3 − R2 0 0 0 0
1 3
R2 ⇒ 2y − 3z = −1 ⇒ y = − + z
2 2
3 1
R1 ⇒ x − y + 2z = 2 ⇒ x = − z.
2 2
Hence the solution set is
   3 1 
x 2 − 2z
y  = − 1 + 3 z  .
2 2
z z

Alternative representation:
   3   1
x 2 −2
y  = − 1  + λ  3  .
2 2
z 0 1
Example: Solve the linear system:

x + 2y − 4z = 2
4x − y + 2z = 1
4x + y − 2z = 2

using row operations.


Solution:

 
1 2 −4 2
 4 −1 2 1 
4 1 −2 2
Example: Solve the linear system:

x + 2y − 4z = 2
4x − y + 2z = 1
4x + y − 2z = 2

using row operations.


Solution:

 
1 2 −4 2
 4 −1 2 1 
4 1 −2 2
 
R1 1 2 −4 2
R2 − 4R1  0 −9 18 −7 
R3 − 4R1 0 −7 14 −6
Example: Solve the linear system:
x + 2y − 4z = 2
4x − y + 2z = 1
4x + y − 2z = 2
using row operations.
Solution:

 
1 2 −4 2
 4 −1 2 1 
4 1 −2 2
 
R1 1 2 −4 2
R2 − 4R1  0 −9 18 −7 
R3 − 4R1 0 −7 14 −6
 
R1 1 2 −4 2
R2  0 −9 18 −7 
9R3 − 7R2 0 0 0 −5
R3 is clearly inconsistent. The system has no solutions.
An example of 3 planes with no intersection
Let’s make the previous example more interesting.
Example: Consider the linear system:

x + 2y − az = 2
ax − y + 2z = 1
4x + y − 2z = 2

Find the value(s) of a for which the system has no solutions.


Solution: We know from the previous example that a = 4 is one
possible value. Are there any others?
 
1 2 −a 2
 a −1 2 1 
4 1 −2 2
 
R1 1 2 −a 2
R2 − aR1  0 −1 − 2a 2 + a2 1 − 2a 
R3 − 4R1 0 −7 −2 + 4a −6

First suppose a = −1/2


 
R1 1 2 1/2 2
R3  0 −7 −4 −6 
R2 0 0 2 + 1/4 2

Unique solution
Now suppose a 6= −1/2
 
R1 1 2 −4 2
R2  0 −(1 + 2a) 2 + a2 1 − 2a 
(1 + 2a)R3 − 7R2 0 0 a2 − 16 2a − 13

When a 6= ±4, a2 − 16 6= 0 and there is a unique solution which


can be found through back-substitution, i.e.

(a2 − 16)z = 2a − 13 =⇒ z = ...


−(1 + 2a)y + (2 + a2 )z = 1 − 2a =⇒ y = ...etc.

When a = ±4, a2 − 16 = 0 but 2a − 13 6= 0.


So the system has no solutions when a = ±4.

You might also like