0% found this document useful (0 votes)
12 views

Eفاطمه

The document discusses the Gauss elimination method for solving systems of linear equations. It explains the steps of the Gauss method, which involves transforming the coefficient matrix into an upper triangular matrix using elementary row operations. An example problem is worked through to demonstrate the method. The C++ code for implementing the Gauss elimination method on the example is also provided.

Uploaded by

bit20181210218
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Eفاطمه

The document discusses the Gauss elimination method for solving systems of linear equations. It explains the steps of the Gauss method, which involves transforming the coefficient matrix into an upper triangular matrix using elementary row operations. An example problem is worked through to demonstrate the method. The C++ code for implementing the Gauss elimination method on the example is also provided.

Uploaded by

bit20181210218
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

‫‪Gauss method‬‬

‫‪of deletion‬‬
‫فاطمة خالد ياسر‬
‫مصطفى طه‬
‫معاذ ليث‬
Gauss method of deletion
The Gauss-Seidel method is a rapid, easily implementable, and stable technique for
solving systems of linear equations.

It strikes a balance between accuracy and time consumption and is applicable to


various fields like engineering and physics. Controlled iterations allow for fine-tuning
of solution accuracy.

Chaos-Seidel deletion is efficient for deleting elements in different arrangements.


Gaussian elimination, named after Karl Friedrich Gauss, is useful for solving linear
systems, finding matrix rank, and calculating inverses, applying basic row operations
to reduce matrices to triangular forms.
Gauss method of deletion
01- Gaussian method of elimination
It is considered one of the simplest direct methods for solving a system of linear equations and
can be explained as follows:

𝑎11𝑥1 + 𝑎12𝑥2 + ⋯ + 𝑎1𝑛𝑥𝑛 = 𝑏1


𝑎21𝑥1 + 𝑎22𝑥2 + ⋯ + 𝑎2𝑛𝑥𝑛 = 𝑏2
…… ………

𝑎𝑚1𝑥1 + 𝑎𝑚2𝑥2 + ⋯ + 𝑎𝑚𝑛𝑥𝑛 = 𝑏𝑚


The above equations can be written as follows

[ 𝑎11 𝑎12… 𝑎1𝑛 :b1]


[ 𝑎21 𝑎22 … 𝑎2𝑛 :b2]
.
.
.
[ 𝑎𝑚1 𝑎𝑚2 … 𝑎𝑚𝑛 :bm]
1 - We transform the above matrix into a higher triangular matrix by following the following:

a) Zeroing out the value of 21, 31 from the equations, that is, what is successively
below the main diagonal

21 by the formula = 0
Multiply by the first row and add by the second row and likewise

R2=R2-a21/a11*R1

Multiply by the first row and add by the third row, and this becomes the matrix
As follows:

[𝑎11 𝑎12… 𝑎1𝑛 :b1]


[0 𝑎22 … 𝑎2𝑛 :b2]
[a31 𝑎32 … 𝑎3𝑛 :b3]
b) Zeroing out the value of 31=0
R3 =R3 −𝑎31/ 𝑎11 * R1
2- We can find the values of each x through
the row in the matrix that contains the
most zeros, and then we take the extracted
It is multiplied by the second line and added
value and substitute it in the matrix before
with the second line
it until the number of unknowns in the
Fourth, and so on until the matrix becomes as matrix is extracted.
follows:

[𝑎11 𝑎12… 𝑎1𝑛 :b1]


[x1 x2 x3 : b1]
[ 0 𝑎22 … 𝑎2𝑛 :b2
[0 x2 x3 : b2]
.
[0 0 x3 : b3]
.

[ 0 0 … 𝑎 𝑚𝑛 :bm]
Example: [3 −1 2 :12]
Using the Gauss elimination method, [ 0 7⁄3 7⁄3 :7]
find a solution to the system of equations:- [ 2 -2 -1 : 2]

3𝑥1 − 𝑥2 + 2𝑥3 = 12 R3=R3-a31/a11*R1


𝑥1 + 2𝑥2 + 3𝑥3 = 11
2𝑥1 − 2𝑥2 − 𝑥3 = 2 [3 −1 2 : 12 ]
the solution-: [ 0 7⁄3 7⁄3 : 7 ]
[ 0 − 4⁄3 − 7⁄3 ; -6 ]
[ 3 −1 2 ] [12]
A= [ 1 2 3] , B=[11] R3=R3-a32-a22/R2
[2 −2 −1] [2] [ 3 −1 2 :12]
[0 7⁄3 7⁄3 :7]
[0 0 −1 :-2]
[ 3 −1 2 : 12]
[A:B]= [ 1 2 3 : 11] ⇒−𝑥3 = −2 ⇒ 𝑥3 = 2
[2 −2 −1 : 2] 7/ 3 𝑥2 +7/3 𝑥3 = 7 ⇒ 𝑥2 + 2 = 3 ⇒ 𝑥2 = 1

R2=R2-a21/a11*R1 3𝑥1 – x2 + 4x3 = 12 ⇒ 𝑥1 = 3


The C++ code for the previous example:

#include <iostream> // Make the other elements in the column zero


#include <vector> for (int k = 0; k < n; k++) {
using namespace std; if (k != i) {
int main() { double factor = matrix[ k ][ i ];
vector<vector<double>> matrix = {{3, -1, 2, 12}, for (int j = i; j < n + 1; j++) {
{1, 2, 3, 11}, matrix[ k ][ j ] - = factor * matrix[ i ][ j ];
{2, -2, -1, 2}}; }
}
int n = matrix.size(); }
for (int i = 0; i < n; i++) { }
// Make the diagonal element 1 // Print the solution
double divisor = matrix[i][i]; cout << "Solution:" << endl;
for (int j = i; j < n + 1; j++) { for (int i = 0; i < n; i++) {
matrix[ i ][ j ] /= divisor; cout << "x" << i + 1 << " = " << matrix[ i ][ n ]
} << endl;
}
return 0;
}
Example:
Using the Gauss elimination method, find a R2=R2-a21/a11*R1
solution to the system of equations:-
[5 3 1 : 5]
5x1 + 3x2 + x3= 5
[ 0 7/3 4/5 : 1]
X1 + 2x2 + x3 = 2
[ 2 -1 2 : 9 ]
2x1 – x2 + x3 = 9

Sol/
R3=R3-a31/a11*R1
[531] [5]
[5 3 1 : 5]
A=[1 2 1 ] , B= [2]
[ 0 7/3 4/5 : 1]
[2 -1 1] [9]
[ 0 -11/5 8/5 : 7]

[5 3 1 :5]
R3=R3-a32/a22*R2
A:B=[1 2 1 : 2 ]

[2 -1 2 : 9 ]
R3=R3-a32/a22*R2

[ 5 3 1 : 5]
[ 0 7/3 4/5 : 1}
[0 0 100/35 : 60/7]

100/35X3=60/7 60/7*35/100 X3=3

7/3X2 + 4/5X3=1 7/5X2=1-12/5 X2=1

5X1 + 3X2 +X3 = 5 5X1 + 3(-1) + 3 = 5


5X=5 X1=5
Thanks

You might also like