10.1 The Gaussian Elimination Algorithm

   

 
Java Number Cruncher: The Java Programmer's Guide to Numerical Computing
By Ronald  Mak

Table of Contents
Chapter  10.   Solving Systems of Linear Equations

10.1 The Gaussian Elimination Algorithm

Let's start with the following example of a system of four linear equations in four unknowns x 1 , x 2 , x 3 , and x 4 :

graphics/10equ01.gif


The correct solution is x 1 = 1, x 2 = -2, x 3 = 3, and x 4 = -1.

The first set of operations is called forward elimination. The goal is to systematically remove one unknown at a time from the system. To keep things simpler, we'll do all the arithmetic with three significant digits.

  • Eliminate x 1 from the second, third, and fourth equations . Designate the first equation as the pivot equation and its leading coefficient, 3, the pivot element. To eliminate x 1 from the second equation, multiply the pivot equation by the multiplier graphics/10inl01.gif (the ratio of the coefficients of x 1 ) and subtract the result from the second equation. To eliminate x 1 from the third equation, multiply the pivot equation by the multiplier graphics/10inl02.gif and subtract the result from the third equation. To eliminate x 1 from the fourth equation, multiply the pivot equation by the multiplier graphics/10inl03.gif and subtract the result from the fourth equation. After these operations, the system becomes

    graphics/10equ02.gif


    Note that the pivot element was the common divisor for each pivot equation multiplier, and that the pivot equation (after the multiplication) is subtracted from each of the equations below it.

  • Eliminate x 2 from the third and fourth equations . Now the second equation is the pivot equation, and -3.67 is the pivot element. To eliminate x 2 from the third equation, multiply the pivot equation by the multiplier graphics/10inl04.gif and subtract the result from the third equation. To eliminate x 2 from the fourth equation, multiply the pivot equation by the multiplier graphics/10inl05.gif and subtract the result from the fourth equation. After these operations, the system becomes

    graphics/10equ03.gif


  • Eliminate x 3 from the fourth equation . The third equation is the pivot equation, and 4.25 becomes the pivot element. Multiply the pivot equation by the multiplier graphics/10inl06.gif and subtract the result from the fourth equation. After this operation, the system becomes

    graphics/10equ04.gif


    The system is now in upper triangular form.

Once the system is in upper triangular form, it is easy to solve for each unknown, starting with x 4 at the bottom equation, and moving up one equation at a time for each of the other unknowns. This process is called back substitution:

graphics/10equ05.gif


We see that there are some roundoff errors.

This algorithm, forward elimination followed by back substitution, is known as Gaussian elimination.


   
Top
 


Java Number Cruncher. The Java Programmer's Guide to Numerical Computing
Java Number Cruncher: The Java Programmers Guide to Numerical Computing
ISBN: 0130460419
EAN: 2147483647
Year: 2001
Pages: 141
Authors: Ronald Mak

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net