Vous êtes sur la page 1sur 39

# Matrices

## Solving a System of Linear Equations

using Matrices
How do we use Inverse Matrices?
• Say that you are given Matrix A and B, and want to find
Matrix X where:
AX = B
• It would be nice to divide both sides by A (to get X=B/A),
but remember we cannot divide matrices.

## • But what if we multiply both sides by A-1 ?

A-1AX = A-1B
And we know that A-1A = , so:
X = A-1B
• We can remove (for the same reason we could remove
"1" from 1x = ab for numbers):
X = A-1B
• And we have our answer (assuming we can calculate A-1)
Solving a System of Linear Equations (2x2)
Solving a system of 2 linear equations is straightforward. For example:
𝑥 + 2 𝑦 = 5 …….(1)
3 𝑥 -4𝑦 = 10 …..(2)
Solution:
Multiplying equation (1) by 2, we get
2 𝑥 + 4𝑦 = 10 … … (1)
3 𝑥 -4𝑦 = 10 …….(2)
Adding equations (1) and (2), we get
20
5𝑥 = 20 𝑥 = = 4
5
Substituting 𝑥 = 4 into equation (1) or (2), we get
2*4 + 4𝑦 = 10 … … (1)
8 + 4𝑦 = 10
Subtracting 8 from both sides of the equation,
8+4𝑦 − 8 = 10-8
4
4𝑦 = 2 𝑦= = 2
2

Ans: 𝒙 = 4 𝒚=2
Solving a System of Linear Equations
But suppose we have a system of 3 or 4 (or more!) linear
equations. For example:
x+2y+2z = 5
3x +z = -6
2x+y-z = -1
x+4y = 2

## Methods for solving a system of 3 or more linear

equations:
–Inverse
–Gauss Jordan elimination
–Cramer’s rule
Solving a System of Linear Equations
• All these solutions involve calculating the
determinant and inverse.
• However, the methods for calculating the
determinant and inverse for 3x3 matrices or
higher is different from that for 2x2 matrices
DO NOT CONFUSE THE TWO!!
Solving a 3x3 System
of Linear Equations
using Inverse
Solving a 3x3 System of Linear
Equations using Inverse
SUMMARY
• Step 1: Express the equations in the matrix form AX = B
• Step 2: Find the matrix of minors
• Step 3: Find the Cofactor matrix C
• Step 4: Find Adjoint A. This is the transpose matrix CT
• Step 5: Find the determinant of matrix A
1
• Step 6: Find A-1 = 𝐴𝑑𝑗 𝐴
|𝐴|
• Step 7: X = A-1B
Solving a 3x3 System of Linear
Equations using Inverse
x+2y+2z = 5
3x-2y+z = -6
2x+y-z = -1

## Step 1: Express the equations in the matrix form

AX = B
1 2 2 𝑥 5
3 −2 1 𝑦 = −6
2 1 −1 𝑧 −1

A X B
Solving a 3x3 System of Linear Equations using Inverse
1 2 2
3 −2 1
2 1 −1
• Step 2: Find the matrix of minors
−2 1 3 1 3 −2
1 −1 2 −1 2 1
2 2 1 2 1 2
1 −1 2 −1 2 1
2 2 1 2 1 2
−2 1 3 1 3 −2

1 −5 7
= −4 −5 −3
6 −5 −8
Solving a 3x3 System of Linear Equations using Inverse

## • Step 3: Find the Cofactor matrix C by simply

changing the sign of alternate cells in the
matrix of minors
+ − + 1 −5 7
− + − −4 −5 −3
+ − + 6 −5 −8

1 5 7
= 4 −5 3
6 5 −8
Solving a 3x3 System of Linear
Equations using Inverse
• An adjoint matrix is the matrix formed by taking the
transpose of the cofactor matrix. The adjoint of matrix
A is often written adj A.
• Step 4: Find Adjoint A. This is the transpose matrix CT
1 5 7
• C = 4 −5 3
6 5 −8
• To transpose, simply swap all the elements over the
diagonal (the diagonal remains the same)
1 4 6
• Adj A = CT = 5 −5 5
7 3 −8
Solving a 3x3 System of Linear
Equations using Inverse
• Step 5: Find the determinant of matrix A
1 2 2
𝐴 = 3 −2 1
2 1 −1
−2 1 3 1 3 −2
= 1. − 2. + 2.
1 −1 2 −1 2 1
This is easy because we have already calculated the
matrix of minors in step 2.
So: multiply the top row elements by their matching
"minor" determinants
= 1*1 – 2(-5) +2*7 = 1+10+14
• 𝐴 = 25
Solving a 3x3 System of Linear
Equations using Inverse
1
• Step 6: Find A-1 = 𝐴𝑑𝑗𝐴
|𝐴|

1 4 6
1
• A-1 = 5 −5 5
25
7 3 −8
• Step 7: X = A-1B Solving a 3x3 System of Linear
Equations using Inverse
1 4 6 5
1
• X= 5 −5 5 −6
25
7 3 −8 −1

1 5 − 24 − 6 1 −25 −1
• = 25 + 30 − 5 = 50 = 2
25 25
35 − 18 + 8 25 1
𝑥 −1
X= 𝑦 = 2
𝑧 1

## • x=−1 y=2 z=1

Solving a 3x3 System of
Linear Equations using
Gauss Jordan elimination
• The problem with the Inverse method is that,
when there are a number of variables and the
number of equations is large, it is extremely
time-consuming to calculate A-1 using
determinants.
• The Gauss Jordan method provides a much
more efficient way of solving a large system of
equations.
• In practice, we would go about solving a
system of equations by eliminating the
variables one at a time until just one remains.
• Then the other variables would be determined
by back-substitution.
• Gauss Jordan elimination is a formal
procedure for doing this.
Solving a 3x3 System of Linear Equations
using Gauss Jordan Elimination

SUMMARY
• Step 1: Express the equations in the matrix
form AX = B
• Step 2: Write the Augmented matrix A│B
• Step 3: Perform row manipulations so as to
convert the matrix into a reduced echelon form
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
3𝑥 − 4𝑦 + 5𝑧 = −1
−3𝑥 + 2𝑦 + 𝑧 = 1
6𝑥 + 8𝑦 − 𝑧 = 35
Step 1: Express the equations in the matrix form
AX = B
3 −4 5 𝑥 −1
−3 2 1 𝑦 = 1
6 8 −1 𝑧 35
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 2: Write the Augmented matrix A│B
The Augmented matrix is a matrix that combines
the coefficient matrix and the matrix containing
the values on the RHS of the equations.

3 −4 5 −1
−3 2 1 1
6 8 −1 35
Solving a 3x3 System of Linear Equations using Gauss
Jordan elimination

## Step 3: We perform row manipulations on our

matrix to convert it into reduced row echelon
form (RREF)
The following row operations are allowed:
• Switch 2 rows
• Multiply/divide a row by a constant
Solving a 3x3 System of Linear Equations using Gauss Jordan
A rectangular matrix is in reduced row echelon form if it
has the following 4 properties:
1. All nonzero rows are above any rows of all zeros
2. The first nonzero number (leading entry) in any row is
a1
3. Each leading entry of a row is in a column to the right
of the leading entry of the row above it
4. Each leading 1 is the only nonzero entry in its column
– ie., all entries in a column above and below the

## • These matrices are in reduced row echelon form:

1 0 3 0 1 0 0
0 1 0 0 0 1 0
0 0 0 1 0 0 1
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to convert
our matrix into RREF.
• The first step is to make the 1st nonzero number
in the 1st row a 1, and all other numbers in the 1st
column to 0’s.
• We then move to the second row, and make the
1st nonzero number in the 2nd row to be a 1, and
all other numbers in the 2nd column to be 0s.
• Do the same for the 3rd row, and so on.
• Note: Swap rows if necessary, to satisfy the RREF
properties
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to
convert our matrix into RREF.
3 −4 5 −1 Row 1 R
1

−3 2 1 1 Row 2 R
2

6 8 −1 35 Row 3 R
3

R1 + R2 R2
𝟑 −𝟒 𝟓 −𝟏
𝟎 −𝟐 𝟔 𝟎
𝟔 𝟖 −𝟏 𝟑𝟓
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to convert our
matrix into a reduced row echelon form. (Contd.)
𝟑 −𝟒 𝟓 −𝟏
𝟎 −𝟐 𝟔 𝟎
𝟔 𝟖 −𝟏 𝟑𝟓

2R1 − R3 R3
3 −4 5 −1
0 −2 6 0
0 −16 11 −37
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to convert our
matrix into a reduced row echelon form. (Contd.)
3 −4 5 −1
0 −2 6 0
0 −16 11 −37

Dividing R1 by 3
1 −4/3 5/3 −1/3
0 −2 6 0
0 −16 11 −37
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to convert our
matrix into a reduced row echelon form. (Contd.)
1 −4/3 5/3 −1/3
0 −2 6 0
0 −16 11 −37

Dividing R2 by -2
1 −4/3 5/3 −1/3
0 1 −3 0
0 −16 11 −37
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to convert our
matrix into a reduced row echelon form. (Contd.)
1 −4/3 5/3 −1/3
0 1 −3 0
0 −16 11 −37
𝟒
R1 + R2 R1
𝟑

R3 + 16R2 R3

1 0 −7/3 −1/3
0 1 −3 0
0 0 −37 −37
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to convert
our matrix into a reduced row echelon form.
(Contd.)
1 0 −7/3 −1/3
0 1 −3 0
0 0 −37 −37

Dividing R3 by -37
1 0 −7/3 −1/3
0 1 −3 0
0 0 1 1
Solving a 3x3 System of Linear Equations
using Gauss Jordan elimination
Step 3: Perform row manipulations so as to convert our
matrix into a reduced row echelon form. (Contd.)
1 0 −7/3 −1/3
0 1 −3 0
0 0 1 1
3R3 + R2 R2
𝟕
R + R1 R1
𝟑 3
1 0 0 2
0 1 0 3
0 0 1 1
We can now read our solution from the matrix:
𝒙 = 𝟐; 𝒚 = 𝟑; 𝒛 = 𝟏
Solving a 3x3 System of
Linear Equations using
Cramer’s Rule
Solving a 3x3 System of Linear
Equations using Cramer’s Rule
SUMMARY
• Step 1: Express the equations in the matrix form
AX = B
• Step 2: Calculate the determinant of A
• Step 3: Calculate the determinant of 𝐴𝑥 , 𝐴𝑦 and 𝐴𝑧
• Step 4: Calculate the value of 𝑥, 𝑦 and 𝑧
Solving a 3x3 System of Linear
Equations using Cramer’s Rule
x+ 2z = 9
2y + z = 8
4x - 3y = -2

## Step 1: Express the equations in the matrix form

AX = B
1 0 2 𝑥 9
0 2 1 𝑦 = 8
4 −3 0 𝑧 −2
Solving a 3x3 System of Linear
Equations using Cramer’s Rule
Step 2: Calculate the determinant of A
1 0 2
𝐴 = 0 2 1 = -13 (Work it out!)
4 −3 0

## Step 3: Calculate the determinant 𝐴𝑥. We replace

our 𝑥 column by the values in our B matrix.
9 0 2
𝐴𝑥 = 8 2 1 = -13 (Work it out!)
−2 −3 0
Solving a 3x3 System of Linear
Equations using Cramer’s Rule
Step 3: Calculate the determinant 𝐴y We replace
our y column by the values in our B matrix.
1 9 2
𝐴𝑦 = 0 8 1 = -26 (Work it out!)
4 −2 0

## Calculate the determinant 𝐴z We replace our z

column by the values in our B matrix.
1 0 9
𝐴𝑥 = 0 2 8 = -52 (Work it out!)
4 −3 −2
Solving a 3x3 System of Linear
Equations using Cramer’s Rule
𝐴𝑥 −13
Step 4: Calculate x = = = 1
𝐴 −13

𝐴𝑦 −26
Calculate y = = = 2
𝐴 −13

𝐴𝑧 −52
Calculate z = = = 4
𝐴 −13
• An automobile company uses 3 types of steel –
S1, S2 and S3 for producing 3 types of cars Car A,
Car B and Car C.
• Car A requires 2 tons of S1, 1 ton of S2 and 3 tons
of S3.
• Car B requires 3 tons of S1, 1 ton of S2 and 2 tons
of S3
• Car C requires 4 tons of S1, 2 ton of S2 and 1 ton
of S3
• Determine the number of cars of each type that
can be produced using 29 tons of S1, 13 tons of
S2 and 16 tons of S3.
Car A Car B Car C TOTAL
S1 2 3 4 29
S2 1 1 2 13
S2 3 2 1 16

## • Let the number of cars of type A produced be x

• Let the number of cars of type B produced be y
• Let the number of cars of type C produced be z
• 2𝑥 + 3𝑦 + 4𝑧 = 29
• 𝑥 + 𝑦 + 2𝑧 = 13
• 3𝑥 + 2𝑦 + 𝑧 = 16
• Ans: 2 Car A, 3 Car B, 4 Car C