## Gauss Elimination

Back to Programming

### Description

This method is used to solve a system of linear equations by choosing a series of valid row operations which transform the given matrix into a simpler form which is known as reduced row echelon form. This method is also known as the row reduction method

To solve the linear equations we have to-

# Translate the system equations into a matrix called an augmented matrix.

# Now we have to use the gauss elimination method to reduce the augmented matrix into a simpler form.

# The solutions to the system will be interpreted.

DERIVATION

Let consider the Gauss elimination method with 3 unknowns (particular case) as written below:

Where,

Let,

Let

We get

Again,

And

Therefore,

### Algorithm

INPUT:

Augmented matrix

OUTPUT:

The values after solving the linear equations

PROCESS:

``````Step 1: [taking the inputs from the user]
Read n [the order of the matrix]
for i = 0 to n - 1 repeat
for j = 0 to n repeat
[End of ‘for’ loop]
[End of ‘for’ loop]

Step 2: [Gauss Elimination Method]
for k = 0 to n - 2 repeat
for i = k + 1 to n - 1 repeat
Set r ← a[i][k]/a[k][k]
for j = 0 to n repeat
Set a[i][j] ← a[i][j] - a[k][j] × r
[End of ‘for’ loop]
[End of ‘for’ loop]
[End of ‘for’ loop]
Set x[n-1] ← a[n-1][n]/a[n-1][n-1]
for i = n - 2 to 0 repeat
Set x[i] ← a[i][n]
for j = n - 1 to i + 1 repeat
Set x[i] ← x[i] - a[i][j] × x[j]
[End of ‘for’ loop]
Set x[i] ← x[i]/a[i][i]
[End of ‘for’ loop]
for i = 0 to n - 1 repeat
Print x[i]
[End of ‘for’ loop]
[End of Gauss Elimination Method]``````

### Code

1. Using this method two or more linear equations can be solved simultaneously.

2. For the large and complicated systems, it prevents confusion and keeps things systematic.

1. This is a slower process to solve the linear equations.

2. In the case of a sparse matrix, it needs more memory spaces also.

APPLICATION

1. Gauss elimination method is used in image enhancement.

2. It helps to solve linear equations is mesh connected processors.

3. It is used in algorithm scheduling.

4. It can be used in the channel decoding algorithm.

5. It is also helpful to solve parallel linear equations.