Gauss Seidal PDF
Gauss Seidal PDF
#What
Gauss-Seidel Method: A Simple Guide
is the Gauss-Seidel
Method?
## What is the Gauss-Seidel Method?
The Gauss-Seidel method helps solve a set of linear equations by guessing the answers and
improving them step by step. It’s useful for systems with many equations that are hard to solve
directly. It works best when each equation has a large number for its main variable (called
diagonally dominant).
##
HowHow Does
Does It Work?
It Work?
Imagine you have two equations:
4x + y = 8
x + 3y = 6
### General
General Idea:Idea
For any system of equations, solve for each variable one at a time. Use the newest values for
variables you’ve already calculated and the old values for the ones you haven’t. The idea is to
keep updating each variable using the latest information.
## Example:
Example: Solving
Solving a System
a System withwith 5 Steps
5 Steps
Let’s solve this system:
4x + y + z = 12
x + 5y + z = 15
x + y + 6z = 18
Start with a guess: x = 0, y = 0, z = 0. We’ll do 5 steps and show answers rounded to 6 decimal
places.
### Step-by-Step
Step-by-Step Equations
Equations
Rewrite each equation to solve for one variable:
x = (12 - y - z) / 4
y = (15 - x - z) / 5
z = (18 - x - y) / 6
### Doing
Doing 5 Steps
5 iterations
Step 1:
Iteration1:
x = (12 - 0 - 0) / 4 = 3.000000
y = (15 - 3.000000 - 0) / 5 = 2.400000
z = (18 - 3.000000 - 2.400000) / 6 = 2.100000
New guess: x = 3.000000, y = 2.400000, z = 2.100000
Step 2:
Iteration2:
x = (12 - 2.400000 - 2.100000) / 4 = 1.875000
y = (15 - 1.875000 - 2.100000) / 5 = 2.205000
z = (18 - 1.875000 - 2.205000) / 6 = 2.320000
New guess: x = 1.875000, y = 2.205000, z = 2.320000
Step 3:
Iteration3:
x = (12 - 2.205000 - 2.320000) / 4 = 1.868750
y = (15 - 1.868750 - 2.320000) / 5 = 2.162250
z = (18 - 1.868750 - 2.162250) / 6 = 2.328167
New guess: x = 1.868750, y = 2.162250, z = 2.328167
Step 4:
Iteration4:
x = (12 - 2.162250 - 2.328167) / 4 = 1.877396
y = (15 - 1.877396 - 2.328167) / 5 = 2.158887
z = (18 - 1.877396 - 2.158887) / 6 = 2.327286
New guess: x = 1.877396, y = 2.158887, z = 2.327286
Step 5:
Iteration5
x = (12 - 2.158887 - 2.327286) / 4 = 1.878457
y = (15 - 1.878457 - 2.327286) / 5 = 2.158851
z = (18 - 1.878457 - 2.158851) / 6 = 2.327115
New guess: x = 1.878457, y = 2.158851, z = 2.327115
steps, thethe
After 5 iterations, solution is about
solution x =x 1.878457,
is about y=
= 1.878457, y =2.158851,
2.158851,z z==2.327115.
2.327115.
### Question
Question 1 1
Solve for 5 iterations:
3x + y + z = 6
x + 4y + z = 8
x + y + 5z = 10
Equations:
x = (6 - y - z) / 3
y = (8 - x - z) / 4
z = (10 - x - y) / 5
Iteration 1:
x = (6 - 0 - 0) / 3 = 2.000000
y = (8 - 2.000000 - 0) / 4 = 1.500000
z = (10 - 2.000000 - 1.500000) / 5 = 1.300000
New guess: x = 2.000000, y = 1.500000, z = 1.300000
Iteration 2:
x = (6 - 1.500000 - 1.300000) / 3 = 1.066667
y = (8 - 1.066667 - 1.300000) / 4 = 1.408333
z = (10 - 1.066667 - 1.408333) / 5 = 1.505000
New guess: x = 1.066667, y = 1.408333, z = 1.505000
Iteration 3:
x = (6 - 1.408333 - 1.505000) / 3 = 1.028889
y = (8 - 1.028889 - 1.505000) / 4 = 1.366528
z = (10 - 1.028889 - 1.366528) / 5 = 1.520917
New guess: x = 1.028889, y = 1.366528, z = 1.520917
Iteration 4:
x = (6 - 1.366528 - 1.520917) / 3 = 1.037518
y = (8 - 1.037518 - 1.520917) / 4 = 1.360391
z = (10 - 1.037518 - 1.360391) / 5 = 1.520418
New guess: x = 1.037518, y = 1.360391, z = 1.520418
Iteration 5:
x = (6 - 1.360391 - 1.520418) / 3 = 1.039730
y = (8 - 1.039730 - 1.520418) / 4 = 1.359963
z = (10 - 1.039730 - 1.359963) / 5 = 1.520061
New guess: x = 1.039730, y = 1.359963, z = 1.520061
### Question 2
Solve for 5 iterations:
5x + y + z = 10
x + 6y + z = 12
x + y + 7z = 14
Equations:
x = (10 - y - z) / 5
y = (12 - x - z) / 6
z = (14 - x - y) / 7
Iteration 1:
x = (10 - 0 - 0) / 5 = 2.000000
y = (12 - 2.000000 - 0) / 6 = 1.666667
z = (14 - 2.000000 - 1.666667) / 7 = 1.476190
New guess: x = 2.000000, y = 1.666667, z = 1.476190
Iteration 2:
x = (10 - 1.666667 - 1.476190) / 5 = 1.371429
y = (12 - 1.371429 - 1.476190) / 6 = 1.525397
z = (14 - 1.371429 - 1.525397) / 7 = 1.729025
New guess: x = 1.371429, y = 1.525397, z = 1.729025
Iteration 3:
x = (10 - 1.525397 - 1.729025) / 5 = 1.349115
y = (12 - 1.349115 - 1.729025) / 6 = 1.486977
z = (14 - 1.349115 - 1.486977) / 7 = 1.737701
New guess: x = 1.349115, y = 1.486977, z = 1.737701
Iteration 4:
x = (10 - 1.486977 - 1.737701) / 5 = 1.355064
y = (12 - 1.355064 - 1.737701) / 6 = 1.484539
z = (14 - 1.355064 - 1.484539) / 7 = 1.737200
New guess: x = 1.355064, y = 1.484539, z = 1.737200
Iteration 5:
x = (10 - 1.484539 - 1.737200) / 5 = 1.355652
y = (12 - 1.355652 - 1.737200) / 6 = 1.484525
z = (14 - 1.355652 - 1.484525) / 7 = 1.737117
New guess: x = 1.355652, y = 1.484525, z = 1.737117
### Question 3
Solve for 5 iterations:
6x + y + z = 9
x + 7y + z = 11
x + y + 8z = 13
Equations:
x = (9 - y - z) / 6
y = (11 - x - z) / 7
z = (13 - x - y) / 8
Iteration 1:
x = (9 - 0 - 0) / 6 = 1.500000
y = (11 - 1.500000 - 0) / 7 = 1.357143
z = (13 - 1.500000 - 1.357143) / 8 = 1.267857
New guess: x = 1.500000, y = 1.357143, z = 1.267857
Iteration 2:
x = (9 - 1.357143 - 1.267857) / 6 = 1.062500
y = (11 - 1.062500 - 1.267857) / 7 = 1.238494
z = (13 - 1.062500 - 1.238494) / 8 = 1.462376
New guess: x = 1.062500, y = 1.238494, z = 1.462376
Iteration 3:
x = (9 - 1.238494 - 1.462376) / 6 = 1.049855
y = (11 - 1.049855 - 1.462376) / 7 = 1.213967
z = (13 - 1.049855 - 1.213967) / 8 = 1.467022
New guess: x = 1.049855, y = 1.213967, z = 1.467022
Iteration 4:
x = (9 - 1.213967 - 1.467022) / 6 = 1.053169
y = (11 - 1.053169 - 1.467022) / 7 = 1.211401
z = (13 - 1.053169 - 1.211401) / 8 = 1.466929
New guess: x = 1.053169, y = 1.211401, z = 1.466929
Iteration 5:
x = (9 - 1.211401 - 1.466929) / 6 = 1.053612
y = (11 - 1.053612 - 1.466929) / 7 = 1.211351
z = (13 - 1.053612 - 1.211351) / 8 = 1.466880
New guess: x = 1.053612, y = 1.211351, z = 1.466880
### Question 4
Solve for 5 iterations:
7x + y + z = 14
x + 8y + z = 16
x + y + 9z = 18
Equations:
x = (14 - y - z) / 7
y = (16 - x - z) / 8
z = (18 - x - y) / 9
Iteration 1:
x = (14 - 0 - 0) / 7 = 2.000000
y = (16 - 2.000000 - 0) / 8 = 1.750000
z = (18 - 2.000000 - 1.750000) / 9 = 1.583333
New guess: x = 2.000000, y = 1.750000, z = 1.583333
Iteration 2:
x = (14 - 1.750000 - 1.583333) / 7 = 1.523810
y = (16 - 1.523810 - 1.583333) / 8 = 1.486607
z = (18 - 1.523810 - 1.486607) / 9 = 1.776620
New guess: x = 1.523810, y = 1.486607, z = 1.776620
Iteration 3:
x = (14 - 1.486607 - 1.776620) / 7 = 1.533825
y = (16 - 1.533825 - 1.776620) / 8 = 1.461194
z = (18 - 1.533825 - 1.461194) / 9 = 1.778331
New guess: x = 1.533825, y = 1.461194, z = 1.778331
Iteration 4:
x = (14 - 1.461194 - 1.778331) / 7 = 1.537211
y = (16 - 1.537211 - 1.778331) / 8 = 1.460557
z = (18 - 1.537211 - 1.460557) / 9 = 1.778025
New guess: x = 1.537211, y = 1.460557, z = 1.778025
Iteration 5:
x = (14 - 1.460557 - 1.778025) / 7 = 1.537345
y = (16 - 1.537345 - 1.778025) / 8 = 1.460579
z = (18 - 1.537345 - 1.460579) / 9 = 1.777997
New guess: x = 1.537345, y = 1.460579, z = 1.777997
### Question 5
Solve for 5 iterations:
8x + y + z = 15
x + 9y + z = 17
x + y + 10z = 20
Equations:
x = (15 - y - z) / 8
y = (17 - x - z) / 9
z = (20 - x - y) / 10
Iteration 1:
x = (15 - 0 - 0) / 8 = 1.875000
y = (17 - 1.875000 - 0) / 9 = 1.680556
z = (20 - 1.875000 - 1.680556) / 10 = 1.644444
New guess: x = 1.875000, y = 1.680556, z = 1.644444
Iteration 2:
x = (15 - 1.680556 - 1.644444) / 8 = 1.459500
y = (17 - 1.459500 - 1.644444) / 9 = 1.543006
z = (20 - 1.459500 - 1.543006) / 10 = 1.799749
New guess: x = 1.459500, y = 1.543006, z = 1.799749
Iteration 3:
x = (15 - 1.543006 - 1.799749) / 8 = 1.457156
y = (17 - 1.457156 - 1.799749) / 9 = 1.527010
z = (20 - 1.457156 - 1.527010) / 10 = 1.801583
New guess: x = 1.457156, y = 1.527010, z = 1.801583
Iteration 4:
x = (15 - 1.527010 - 1.801583) / 8 = 1.458925
y = (17 - 1.458925 - 1.801583) / 9 = 1.526610
z = (20 - 1.458925 - 1.526610) / 10 = 1.801447
New guess: x = 1.458925, y = 1.526610, z = 1.801447
Iteration 5:
x = (15 - 1.526610 - 1.801447) / 8 = 1.458993
y = (17 - 1.458993 - 1.801447) / 9 = 1.526617
z = (20 - 1.458993 - 1.526617) / 10 = 1.801439
New guess: x = 1.458993, y = 1.526617, z = 1.801439