Na?ve Gaussian Elimination Method
?2006 Kevin Martin, Autar Kaw, Jamie Trahan
University of South Florida
United States of America
kaw@eng.usf.edu
NOTE: This worksheet demonstrates the use of Maple to illustrate Na?ve Gaussian Elimination, a numerical technique used in solving a system of simultaneous linear equations.
Introduction
One of the most popular numerical techniques for solving simultaneous linear equations is Na?ve Gaussian Elimination method. The approach is designed to solve a set of n equations with n unknowns,
[A][X]=[C], where [A]nxn is a square coefficient matrix, [X]nx1 is the solution vector, and [C]nx1 is the right hand side array.
Na?ve Gauss consists of two steps:
1) Forward Elimination: In this step, the unknown is eliminated in equation starting with the first equation. This way, the equations are "reduced" to one equation and one unknown in each equation.
2) Back Substitution: In this step, starting from the last equation, each of the unknowns is found.
To learn more about Na?ve Gaussian Elimination as well as the pitfalls of the method, click here.
A simulation of Na?ve Gauss Method follows.
Section 1: Input Data
Below are the input parameters to begin the simulation. This is the only section that requires user input. Once the values are entered, Maple will calculate the solution vector [X].
Input Parameters:
n = number of equations
[A] = nxn coefficient matrix
[RHS] = nx1 right hand side array
Digits = number of significant digits used in calculation
Section 2: Na?ve Gauss Elimination
The following sections divide Na?ve Gauss Elimination into two steps:
1) Forward Elimination
2) Back Substitution
To conduct Na?ve Gauss Elimination, Maple will combine the [A] and [RHS] matrices into one augmented matrix, [C], that will facilitate the process of forward elimination.
Warning, the protected names norm and trace have been redefined and unprotected
Step 1: Forward Elimination
Forward elimination of unknowns consists of (n-1) steps. In each step k, the coefficient element of the kth unknown will be zeroed from every subsequent equation that follows the kth row. For example, in step 2 (i.e. k=2), the coefficient of x2 will be zeroed from rows 3..n. With each step that is conducted, a new matrix is generated until the coefficient matrix is transformed to an upper triangular matrix. The following procedure calculates the upper triangular matrix while demonstrating the intermediate coefficient matrices that are produced for each step k.
The new upper triangular coefficient matrix, [A1], is now:
Notice that the final row, n, has only one unknown to be solved for.
The new right hand side array, [RHS1], is:
This is the end of forward elimination steps. The new upper triangular coefficient matrix and right hand side array permit solving for the solution vector using backward substitution.
Step 2: Back Substitution
Back substitution begins with solving the last equation as it has only one unknown. The remaining equations can be solved for using the following formula:
The solution vector [X] is:
Section 3: Exact solution
Using Maple's built-in tools, the exact solution is given below.
References
[1] Autar Kaw, Holistic Numerical Methods Institute, http://numericalmethods.eng.usf.edu/mws, See
How does Gaussian Elimination work?
Effects of Significant Digits on solution of equations.
Conclusion
Maple helped us apply our knowledge of Na?ve Gaussian Elimination method to solve a system of n simultaneous linear equations.
Question 1: Change the number of significant digits used in calculations. See how this value affects the accuracy in the solution vector.
Question 2: The velocity of a rocket is given at three different times:
The velocity data is approximated by a polynomial as
v(t) = a1 t2 + a2 t + a3, 5< t <12
The coefficients a1, a2, a3 for the above expressions were found to be given by
Question 3: Choose a set of equations that has a unique solution but for which Na?ve Gauss Elimination method fails.
Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.