You are on page 1of 33

Essential Mathematics for Economics and Business, 4 th Edition

CHAPTER 9: GAUSSIAN ELIMINATION.

© John Wiley and Sons 2013


www.wiley.com/college/Bradley © John Wiley and Sons 2013
Procedure:
Gaussian elimination is a method for
systematically solving a system of linear equations
by…
…progressively working through the equations using
elementary row operations
…to eliminate variables from equations, one at a
time
…eventually ending up with one equation in one
unknown, two equations in two unknowns etc.
…then solve for all the unknowns by back
substitution

Terminology in bold type explained in following examples



www.wiley.com/college/Bradley © John Wiley and Sons 2013
Example showing the effect of
elimination
x yz 3 Before elimination: 3 equations in 3
2x  y  z  4 unknowns, x, y, z
2 x  2 y  z  12

After elimination:
x+ y-z =3 Each equation
 y  z  2 contains one varible less
than the previous..
2z  4

www.wiley.com/college/Bradley © John Wiley and Sons 2013


To solve by back substitution…
x + y - z = 3 ...(1) Solve the last equation first,
then work backwards,
 y  z  2 ...(2)
to solve the previous equation…
2 z  4 ...(3) ..finally solving equation (1)
…from equation (3) z = 4/2 = 2
-y + (2) = -2
…substitute z = 2 into eq. (2) -y = -2 – (2) = -4
y= 4

…substitute z = 2, y = 4 into eq. (1) x + (4) – (2) = 3


x=1
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Writing a system of equations in matrix
form..
Columns contain the Coefficents of x, y, z and RHS
x y z RHS
   
x yz 3 ...(1)  1 1  1 3  ...(1)
 
2x  y  z  4 ...(2)  2 1  1 4  ...(2)
2 2 1 12  ...(3)
2 x  2 y  z  12 ...(3)  

This is called the


Augmented matrix
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Elementary row operations
..means adding multiples on one equation (row) to
another (row)
In Gaussian elimination, elementary row
operations are used
…to eliminate variables from equations, one at a
time
in order to reduce the system of equations
…to upper triangular form  a1,1 a1, 2 a1,3 a1, 4 
so that they may be solved  
 0 a 2 , 2 a 2 , 3 a2 , 4 
by back substitution
0 0 a3,3 
a3, 4 

www.wiley.com/college/Bradley © John Wiley and Sons 2013
Worked example 9.7

Solve by Gaussian elimination

x yz 3
2x  y  z  4
2 x  2 y  z  12

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked Example 9.7

Write the equations in


x y z RHS
matrix form…   

x yz 3  1 1 1 3 ...(1)
2x  y  z  4  
 2 1 1 4 ...(2)
2 x  2 y  z  12  
 2 2 1 12 ...(3)
Start with column 1.
…use elementary row operations
to generate 0’s beneath the first element: a 1,1

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked Example 9.7

To get the required 0’s x y z RHS


in column 1,
   
add…  1 1  1 3  ...(1)
 
{-2  row (1)} to row (2)  2 1  1 4  ...(2)
 2 2 1 12  ...(3)
{-2  row (1)} to row (3)  

Each of these elementary row operations will give –2 +


2 = 0 in column 1, as required…

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.7: Add {-2  row (1)} to row (2)
x y z RHS
   

 1 1 1 3 ...(1) -2 -2 2 -6 …(1)  -2
 
 2 1 1 4 ...(2) 2 1 -1 4 …(2)
 
2 2 1 12 ...(3) 0 -1 1 -2 adding

 1 1 1 3 ...(1)
  1 Update row 2
 0  1 1  2 ...(2)
 
 2 2 1 12  ...(3)

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.7: Add {-2  row (1)} to row (3)
x y z RHS
   
 1 1  1 3  ...(1) -2 -2 2 -6 …(1)  -2
 
 2 1  1 4  ...(2)
2 2 1 12  ...(3)
  2 2 1 12 …(3)
0 0 3 6 adding
 1 1 1 3  ...(1)
  1
 0  1 1  2  ...(2) Update row 3
0 0 3 6  ...(3)1
 

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.7 ….continued

 1 1 1 3  ...(1)
  1
 0  1 1  2  ...(2)
0 0 3 6  ...(3)1
 

In this particular example,


there is already a ‘0’ beneath a 2,2 in column 2
The augmented matrix is in upper triangular form
So proceed to solve by back substitution…

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.7: Solve by back
substitution
x + y - z = 3 ...(1) Solve the last equation first,
 y  z  2 ...(2) then work backwards,
to solve the previous equation…
3 z  6 ...(3) ..finally solving equation (1)
…from equation (3) z = 6/3 = 2
-y + (2) = -2
…substitute z = 2 into eq. (2) -y = -2 – (2) = -4
y= 4

…substitute z = 2, y = 4 into eq. (1) x + (4) – (2) = 3


x=1
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Worked example 9.8

Solve by Gaussian elimination

2 x  y  z  12
6 x  5 y  3z  6
4 x  y  3z  5

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked Example 9.8

Write the equations in x y z RHS


matrix form…    
2 x  y  z  12  2 1 1 12  ...(1)
 
6 x  5 y  3z  6  6 5  3 6  ...(2)
 4  1 3 5  ...(3)
4 x  y  3z  5  
Start with column 1.
…use elementary row operations
to generate ‘0’s beneath the first element: a 1,1

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8:
Generate 0’s in column 1 beneath a1,1
..to convert this element to
a ‘1’ divide row 1 by 2
2 1 1 12  ...(1)
 
 6 5  3 6  ...(2)
 4  1 3 5  ...(3)
 
..the elimination of elements in column 1 will be
easier if the element in position a1,1 is 1
Then add multiples of row(1) to row(2) and to ròw (3) to
get the required zeros

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8: row(1) divided by 2

2 1 1
12  ...(1)
 2 2 2 2
 6 5 3 6  ...(2)
 
4 1 3 5 ...(3) Update
 
row(1)
1
 1 0.5 0.5 6  ...(1)
 
6 5  3 6  ...(2)
 4 1 3 5  ...(3)
 

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked Example 9.8

To get the required 0’s x y z RHS


in column 1,    

add…  1 0.5 0.5 6  ...(1)1


 
6 5  3 6  ...(2)
{-6  row (1)1} to row (2)  4 1
 3 5  ...(3)
{-4  row (1)1} to row (3)

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8: Add {-6  row (1)} to row (2)

x y z RHS
   
1
 1 0.5 0.5 6  ...(1) -6 -3 -3 -36 …(1)1 -6
 
6 5  3 6  ...(2) 6 5 -3 6 …(2)
 4 1 3 5  ...(3) 0 2 -6 -30 adding

1
 1 0.5 0.5 6  ...(1)
  1
Update row 2
 0 2  6  30  ...(2)
 4 1 3 5  ...(3)
 
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Worked example 9.8: Add {-4  row (1)} to row (3)

x y z RHS
   
1
 1 0.5 0.5 6  ...(1) -4 -2 -2 -24 …(1)1 -4
 
6 5  3 6  ...(2)
 4 1 3 5  ...(3) 4 -1 3 5 …(3)

0 -3 1 -19 adding
1
 1 0.5 0.5 6  ...(1)
 
 0 2  6  30  ...(2)
1 Update row 3
0  3 1  19  ...(3) 1
 
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Worked example 9.8: Generate 0’s in column 2 beneath
a 2,2

1
 1 0. 5 0.5 6  ...(1) ..to convert this element
  1 to ‘1’ divide row(2)1 by 2
 0 2  6  30  ...(2)
0  3 
1  19  ...(3) 1

..so we need to add +3 to -3 in row (3)1 to get the required ‘0’
..This elimination will be easier if the element in position a2,2 is 1
Then add 3  row(2)1 /2 to row (3) to get the required ‘0’.
See next slide

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8: row(2) divided by 2

 1 0.5 0.5 6 
 
0
 2 2  6  30
2 2 2
 0 3 1  19 
 
Update row 2
1
 1 0 . 5 0 .5 6  ...(1) again
  2
 0 1  3  15  ...(2)
0  3 
1  19  ...(3) 1

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8: Add {3  row (2)2} to row (3)

x y z RHS
   
1
 1 0.5 0.5 6  ...(1)
  2
0 1  3  15  ...(2) 0 3 -9 -45 …(2)2  3
0  3 1  19  ...(3) 1 0 -3 1 -19 …(3)1
 
0 0 -8 -64 adding
1
 1 0. 5 0.5 5  ...(1)
  2
0 1  3  15  ...(2) Update row (3)1
0 0  8  64  ...(3)2
 

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8 ….continued
1
 1 0.5 0.5 6  ...(1)
  2
 0 1  3  15  ...(2)
0 
0  8  64  ...(3) 2

The augmented matrix is in upper triangular form


So proceed to solve by back substitution

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8: Solve by back
substitution 1
 1 0.5 0.5 6  ...(1)
  2
 0 1  3  15  ...(2)
0 
0  8  64  ...(3) 2

..from equation (3)2 z = -64/(-8) = 8

..substitute z = 8 into eq. (2)2 y - 3(8) = -15


y = -15 + 3(8) = 9

x + 0.5(9) + 0.5(8) = 6
..substitute z = 8, y = 9 into eq.(1) 1
x = -2.5
Solution: x = -2.5, y = 9, z = 8
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Note: How to use a single row operation to
generate the required 0 in column 2

1
 1 0.5 0.5 6  ...(1)
  1
0 2  6  30  ...(2)
0  3 
1  19  ...(3) 1

We used 2 seperate row operations
First: divided row(2)1 by 2… to rearrange a2,2 = 1
Second: multiplied row(2)2 by 3…
..then added to row(3)1 to obtain the required 0 in row 3
Instead multiply row(2)1 by 3/2 and add to row(3)
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Worked example 9.8: Add {3/2  row (2)} to row (3)
x y z RHS
   
1
 1 0 . 5 0.5 6  ...(1)
  1
 0 2  6  30  ...(2) 0 3 -9 -45 …(2)1  3/2
0  3 1  19  ...(3) 1 0 -3 1 -19 …(3)1
 
0 0 -8 -64 adding
1
 1 0.5 0. 5 6  ...(1)
  2
 0 1  3  15  ...(2)
0  2
Update row (3)1
 0  8  64  ...(3)

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Gaussian elimination: a systematic
method
Write the system of equations in matrix form
Use elementary row operations
{a single row operation to generate each zero}
..to generate zero’s beneath a1,1 in column 1
..to generate zero’s beneath a2,2 in column 2
..etc.
..until the augmented matrix is reduced to upper
triangular from
..finally solve by back substitution

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked Example 9.8 (again!)

To get the required 0’s


x y z RHS
in column 1,    
add…  2 1 1 12  ...(1)
 
 6 5  3 6  ...(2)
{-6/2  row (1)} to row (2)  4  1 3 5  ...(3)
 
{-4/2  row (1)} to row (3)

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8 Add {-6/2  row (1)} to row (2)

x y z RHS
   
2 1 1 12  ...(1) -6 -3 -3 -36 …(1)  -6/2
 
 6 5  3 6  ...(2) 6 5 -3 6 …(2)
 4  1 3 5  ...(3) 0 2 -6 -30 adding
 

 2 1 1 12  ...(1)
  1 Update row (2)
 0 2  6  30  ...(2)
 4 1 3 5  ...(3)
 
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Worked example 9.8: Add {-4/2  row (1)} to row (3)

x y z RHS
   
2 1 1 12  ...(1) -4 -2 -2 -24…(1)  -4/2
 
 6 5  3 6  ...(2)
 4  1 3 5  ...(3) 4 -1 3 5 …(3)
 
0 -3 1 -19 adding
 2 1 1 12  ...(1)
  1
 0 2  6  30  ...(2) Update row 3
 0  3 1  19  ...(3) 1
 
www.wiley.com/college/Bradley © John Wiley and Sons 2013
Worked example 9.8: Add {3/2  row (2)} to row (3)

x y z RHS
   
 2 1 1 12  ...(1)
  1
 0 2  6  30  ...(2) 0 3 -9 -45 …(2)1  3/2
 0  3 1  19  ...(3) 1 0 -3 1 -19 …(3)1
 
0 0 -8 -64 adding
1
 2 1 1 12  ...(1)
  2
 0 1  3  15  ...(2) Update row (3)1
 0 0  8  64  ...(3) 2
 

www.wiley.com/college/Bradley © John Wiley and Sons 2013


Worked example 9.8: Solve by back
substitution
2 1 1 12  ...(1)
  2
 0 1  3  15  ...(2)
 0 0  8  64  ...(3) 2
 
..from equation (3)2 z = -64/(-8) = 8

..substitute z = 8 into eq. (2)2 y - 3(8) = -15


y = -15 + 3(8) = 9
..substitute z = 8, y = 9 into eq.(1) 2 x + (9) + (8) = 12
x = -2.5
Solution: x = -2.5, y = 9, z = 8
www.wiley.com/college/Bradley © John Wiley and Sons 2013

You might also like