Mathematics for Computations
LESSON 3
INVERSE MATRICES
Prepared by: Wan Nurul Huda Faculty of Business Finance and
2020@MAHSA University Information Technology
LEARNING OBJECTIVE
• Verify thet multiplying a matrix by its inverse results in 1
• Use Matrix multiplication to find the inverse of a matrix
• Find an inverse by augmenting with an identify matrix.
INTRODUCTION
Definition of Inverse
•
The inverse is Defined as AA-1 = A-1A = I
1 2 ? ? 1 0 ? ? 1 2 1 0
3 4 ? ? = 0 0 ? ? 3 4 = 0 0
We will find out how to calculate the inverse for 2x2 matrix
But first why is it important ?
Because it will allow us to solve equations of the form
We will only consider 2x2
a11 a12 x1 b1 Matrix systems
a . =
That means simultaneous
21 a 22 x 2 b2
equations
Why will it help us solve equations?
Because if we can express a system of equations in the
form
Ax = b
Then we can multiply both sides by the inverse matrix
−1 −1
A Ax = A b
And we can then know the values of X because −1
A A= I
x=A b −1
Recap Multiplication
2
4 − 3 2 = 8+ 3+ 12 23
=
− 6
− 1
0 1 -6
6
-12+0+ 6
21
6 3 2 12+ 9
=
2+ 6 = 8
1 2
5 7 3 10+ 21 31
6 1 24+10
4 2 4+8 34
5 4 = = 12
The multiplicative inverse of a matrix
• This can only be done with SQUARE matrices
• By hand we will only do this for a 2x2 matrix
• Inverses of larger square matrices can be calculated but
can be quite time expensive for large matrices, computers
are generally used
4 8 0.75 − 2
Ex A = then A-1 = as AxA-1 = I
1 3 − 0.25 1
4 8 0.75 − 2 3 − 2 − 8 + 8 1 0
= =
1 3 − 0.25 1 0.75 − 0.75 − 2 + 3 0 1
Finding the Inverse of a 2x2 matrix
Step-1 First find what is called the Determinant a b
c d
This is calculated as ad-bc
d b
Step-2 Then swap the elements in the leading diagonal c a
Step-3 Then negate the other elements d − b
− c a
Step-4 Then multiply the Matrix by 1/determinant
1 d − b
ad − cb − c a
Example Find Inverse of A
Step 1 – Calc Determinant
4 8 Determinant (ad-cb) = 4x3-8x1 = 4
A =
1 3
3 8
step2
Step 2 – Swap Elements on leading diagonal 1 4
3 −8
step3
Step 3 – negate the other elements −1 4
1 3 −8
step4
Step 4 – multiply by 1/determinant 4 −1 4
check
−1 0.75 − 2 −1
=
4 8 0.75 − 2
A = 1 3 − 0.25 1
AA
−
0.25 1 3 − 2 − 8 + 8 1 0
= 0.75 − 0.75 = 0 1
−2+3
Find the inverses and check them
2 6 −11 5 − 6 1.25 − 1.5
A = A = =
1 5 4 − 1 2 − 0.25 0.5
− 5 20 1 2 − 20 0.2 − 2
−1
B = B = =
−1 2 10 1 − 5 0.1 − 0.5
2 2 1 − 1 − 2 0.5 1
C = −1
C = =
0 − 1 −2 0 2 0 − 1
EXERCISE: Find the inverses and check them
2 4
A =
1 3
5 10
B =
−1 2
3 2
C =
2 1
8 2
D =
−1 0
2 − 8
E =
−1 4
−1 0
F =
0 − 1
Applications of matrices
• Because matrices are clever storage systems for numbers
there are a large and diverse number of ways we can apply
them.
• Matrices are used in to solve equations on computers
- solving equations
• They are used in computer games and multi-media devices
to move and change objects in space
- transformation geometry
• We only consider solving equations on Maths1 with using
2x2 matrices
Solving simultaneous equations
• We can use our 2x2 matrices to express 2 simultaneous
equations (2 equations about the same 2 variables)
• First we must put them in the correct format
• for the variables x & y the format should be
ax + by = m
cx + dy = n {where a,b,c,d,m & n are constants}
Example
Peter and Jane spend RM240 altogether and Peter spends 3 times as
much as Jane.
let p: what Peter spends and j: what Jane spends
then p + j = 240 (right format a and b = 1 m = 240)
p=3j (wrong format)
rewrite p-3j = 0 (right format c = 1 d = -3 n = 0)
Solving simultaneous equations
We can use our 2x2 matrices to express these
simultaneous equations
x+ y = 240 Becomes in matrix form
x − 3y =0
1 1 x1 240
=
1 − 3 x 2 0
constants
constants from the from the
left hand side UNKNOWNS
X ~ x1
right hand
(the coefficients Y ~ x2 side
of p and j)
EXAMPLE: Format is Ax=B
To solve this using the matrix we must get rid of it by using its inverse!
1 1 x1 240
= −1
1 − 3 x 2 0 First find the inverse 1 1 1 − 3 − 1 0.75 0.25
= =
1 − 3 − 4 − 1 1 0.25 − 0.25
now use it on both sides of the equation
0.75 0.25 1 1 x1 0.75 0.25 240
=
0.25 − 0.25 1 − 3 2
x 0.25 − 0. 25 0
1 0 x1 0.75 0.25 240
=
0 1 2
x 0.25 − 0.25 0
x1 180
=
x 2 60
So Answer is p = 180 j = 60
Linear Equations
Example
3 x1 − x2 + x3 = 2
2 x1 + x2 = 1
x1 + 2 x2 − x3 = 3
The equations can be expressed as
3 − 1 1 x1 2
2 1 0 x = 1
2
1 2 − 1 x3 3
Linear Equations
When A-1 is computed the equation becomes
0.5 − 0.5 0.5 2 2
X = A−1 B = − 1.0 2.0 − 1.0 1 = − 3
− 1.5 3.5 − 2.5 3 7
Therefore
x1 = 2,
x2 = −3,
x3 = −7
Linear Equations
The values for the unknowns should be checked by substitution back into the initial
equations
x1 = 2, 3 x1 − x2 + x3 = 2
x2 = −3, 2 x1 + x2 = 1
x3 = −7 x1 + 2 x2 − x3 = 3
3 (2) − (−3) + (−7) = 2
2 (2) + (−3) = 1
(2) + 2 (−3) − (−7) = 3
A Real Life Example: Bus and Train
• A group took a trip on a bus, at $3 per child and $3.20
per adult for a total of $118.40.
• They took the train back at $3.50 per child and $3.60
per adult for a total of $135.20.
• How many children, and how many adults?
First, let us set up the matrices (be careful to get the rows and
columns correct!):
This is just like the example above:
XA = B
So to solve it we need the inverse of "A":
Now we have the inverse we can solve using:
X = BA-1
There were 16 children and 22 adults!
Summary of method
1. Format the simultaneous equations for variable x & y
ax + by = m
cx + dy = n
2. Rewrite them in matrix form a b x m
=
c d y n
3. Find the inverse of the 2x2 matrix a b −1 1 d − b
=
c d ad − bc − c a
4. Solve for the variables x,y by multiplying the right hand
side of the equation by the inverse
x 1 d − b m
=
y ad − bc − c a n
EXERCISE: Your Turn solve the following
3x +4y = 5
A) 5x = 7-6y
x+7y = 1.24
B) 3y -x = 0.76
8x = 3y -1
C) x+y =-7
Mathematics for Computations
Prepared by: Wan Nurul Huda Faculty of Business Finance and
2020@MAHSA University Information Technology