Gauss Elimination Method Algorithm and Flowchart

3 Min Read

Gauss Elimination method can be adopted to find the solution of linear simultaneous equations arising in engineering problems. In the method, equations are solved by elimination procedure of the unknowns successively.

The method overall reduces the system of linear simultaneous equations to an upper triangular matrix. Then backward substitution is used to derive the unknowns. This is the key concept in writing an algorithm or program, or drawing a flowchart for Gauss Elimination.

Partial pivoting or complete pivoting can be adopted in Gauss Elimination method. So, this method is considered superior to the Gauss Jordan method.

In the Gauss Elimination method algorithm and flowchart given below, the elimination process is carried out until only one unknown remains in the last equation. It is straightforward to program, and partial pivoting can be used to control rounding errors.

Gauss Elimination Algorithm:

  1. Start
  2. Declare the variables and read the order of the matrix n.
  3. Take the coefficients of the linear equation as:
    Do for k=1 to n
    Do for j=1 to n+1
    Read a[k][j]
    End for j
    End for k
  4. Do for k=1 to n-1
    Do for i=k+1 to n
    Do for j=k+1 to n+1
    a[i][j] = a[i][j] – a[i][k] /a[k][k] * a[k][j]
    End for j
    End for i
    End for k
  5. Compute x[n] = a[n][n+1]/a[n][n]
  6. Do for k=n-1 to 1
    sum = 0
    Do for j=k+1 to n
    sum = sum + a[k][j] * x[j]
    End for j
    x[k] = 1/a[k][k] * (a[k][n+1] – sum)
    End for k
  7. Display the result x[k]
  8. Stop

Gauss Elimination Flowchart:

Here is a basic layout of Gauss Elimination flowchart which includes input, forward elimination, back substitution and output.

The one given below shows pivoting and elimination procedure.


Here is an attachment showing how the forward elimination and back substitution take place.


Also see,
Gauss Elimination C Program
Gauss Elimination MATLAB Program

While solving linear simultaneous equations, analytical methods often fail when the problems are complicated. These algorithm and flowchart can be referred to write source code for Gauss Elimination Method in any high level programming language.

It is complete, and though it is somewhat long for coding, it is clearly differentiated for the elimination phase and the back substitution phase. If you have any questions, discuss them in comments.

Share This Article
8 Comments
  • Write and check the correctness of the program in Fortran 90, that solves an nonlinear
    equation of the form: f(x)=2x
    3
    -9.06843×2
    -72.3753x+114.834=0 using the searching method
    to find the interval in which exist at least one (in fact there are three) roots of above equation
    and next apply the bisection method to narrow the find interval with accuracy ±0.0005.
    The source code should be sent as a file named: surname-neq.f90 till May 31, 2022, 6 p.m.
    Assumptions for the program:
    1. The initial interval should be assumed as and increment h=0.3
    2. The final length in bisection method should be smaller or equal to 0.001 (which is
    equivalent to assumed accuracy ±0.0005 if the approximate value of the root will be placed in
    the middle of final interval.).
    Repeat the calculations with assumed accuracy ±0.00005
    3. The data introduced in points 1 and 2 above should be introduced to the program from
    keyboard..
    4. The function f(x), appearing in the equation, should be defined by the function f as follows:
    function f(x)
    f=2*x**3-9.06843*x**2-72.3753*x+114.834
    end
    5. The result of first step (searching for interval or intervals) and both second one (narrowing
    the interval or intervals) should be printed on the screen and storing in the file result.txt on the
    computer disk

  • Programming can be made easier with flowcharts. Specially suda code can be directly converted to flowcharts. By the way you have used correct shape and the program is very clear

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version