CSC212 ยท 2081 ยท 10 marks
What are the limitations of direct methods for solving a system of linear equations? How does Gauss Seidel method differ from Jacobi iteration? Solve the following system of linear equations using Jacobi iteration method:
What are the limitations of direct methods for solving a system of linear equations? How does Gauss Seidel method differ from Jacobi iteration? Solve the following system of linear equations using Jacobi iteration method:
$$ \begin{aligned} 2x - 7y - 10z &= -17 \ 5x + y + 3z &= 14 \ x + 10y + 9z &= 7 \end{aligned} $$
[10]
Limitations of Direct Methods, Gauss-Seidel vs Jacobi, and Jacobi Iteration
Part 1: Limitations of Direct Methods
Direct methods (Gauss Elimination, LU Decomposition, Cramer's Rule) obtain the solution in a finite number of steps, but have limitations:
- High computational cost: Gauss Elimination needs about $O(n^3)$ operations; expensive for large $n$.
- Round-off error accumulation: Fixed long sequences of operations let rounding errors propagate.
- Large memory needs: Full matrix storage is required.
- Poor for sparse systems: Fill-in destroys sparsity, wasting memory and time.
- Pivoting problems: Zero or small pivots cause failure or instability without pivoting.
- Hard to parallelize: Inherently sequential.
Part 2: Gauss-Seidel vs Jacobi
| Feature | Jacobi | Gauss-Seidel |
|---|---|---|
| Values used | Only previous iteration values | Most recent updated values immediately |
| Storage | Needs old and new arrays | Single array (in-place) |
| Convergence | Slower | Faster (โ twice) |
| Parallelism | Easy | Harder |
Formulas: $$x_i^{(k+1)} = \frac{1}{a_{ii}}\Big(b_i - \sum_{j\neq i} a_{ij}x_j^{(k)}\Big)\quad\text{(Jacobi)}$$ $$x_i^{(k+1)} = \frac{1}{a_{ii}}\Big(b_i - \sum_{j<i} a_{ij}x_j^{(k+1)} - \sum_{j>i} a_{ij}x_j^{(k)}\Big)\quad\text{(Gauss-Seidel)}$$
Part 3: Jacobi Iteration Solution
Given System
$$2x - 7y - 10z = -17 \quad (1)$$ $$5x + y + 3z = 14 \quad (2)$$ $$x + 10y + 9z = 7 \quad (3)$$
Step 1: Rearrange for Diagonal Dominance
Swap to place dominant coefficients on the diagonal: $$5x + y + 3z = 14 \quad (1')$$ $$x + 10y + 9z = 7 \quad (2')$$ $$2x - 7y - 10z = -17 \quad (3')$$
Check:
- Row 1: $|5|=5 > 1+3=4$ โ
- Row 2: $|10|=10 = 1+9=10$ (borderline, acceptable)
- Row 3: $|-10|=10 > 2+7=9$ โ
Step 2: Iteration Formulas
$$x^{(k+1)} = \tfrac{1}{5}\big(14 - y^{(k)} - 3z^{(k)}\big)$$ $$y^{(k+1)} = \tfrac{1}{10}\big(7 - x^{(k)} - 9z^{(k)}\big)$$ $$z^{(k+1)} = \tfrac{1}{10}\big(17 + 2x^{(k)} - 7y^{(k)}\big)$$
Step 3: Iterations (start $x^{(0)}=y^{(0)}=z^{(0)}=0$)
Iteration 1: $$x^{(1)} = \tfrac{1}{5}(14) = 2.8$$ $$y^{(1)} = \tfrac{1}{10}(7) = 0.7$$ $$z^{(1)} = \tfrac{1}{10}(17) = 1.7$$
Iteration 2: $$x^{(2)} = \tfrac{1}{5}(14 - 0.7 - 3(1.7)) = \tfrac{1}{5}(14 - 0.7 - 5.1) = \tfrac{8.2}{5} = 1.64$$ $$y^{(2)} = \tfrac{1}{10}(7 - 2.8 - 9(1.7)) = \tfrac{1}{10}(7 - 2.8 - 15.3) = \tfrac{-11.1}{10} = -1.11$$ $$z^{(2)} = \tfrac{1}{10}(17 + 2(2.8) - 7(0.7)) = \tfrac{1}{10}(17 + 5.6 - 4.9) = \tfrac{17.7}{10} = 1.77$$
Iteration 3: $$x^{(3)} = \tfrac{1}{5}(14 - (-1.11) - 3(1.77)) = \tfrac{1}{5}(14 + 1.11 - 5.31) = \tfrac{9.8}{5} = 1.96$$ $$y^{(3)} = \tfrac{1}{10}(7 - 1.64 - 9(1.77)) = \tfrac{1}{10}(7 - 1.64 - 15.93) = \tfrac{-10.57}{10} = -1.057$$ $$z^{(3)} = \tfrac{1}{10}(17 + 2(1.64) - 7(-1.11)) = \tfrac{1}{10}(17 + 3.28 + 7.77) = \tfrac{28.05}{10} = 2.805$$
Iteration 4: $$x^{(4)} = \tfrac{1}{5}(14 + 1.057 - 3(2.805)) = \tfrac{1}{5}(14 + 1.057 - 8.415) = \tfrac{6.642}{5} = 1.3284$$ $$y^{(4)} = \tfrac{1}{10}(7 - 1.96 - 9(2.805)) = \tfrac{1}{10}(7 - 1.96 - 25.245) = \tfrac{-20.205}{10} = -2.0205$$ $$z^{(4)} = \tfrac{1}{10}(17 + 2(1.96) - 7(-1.057)) = \tfrac{1}{10}(17 + 3.92 + 7.399) = \tfrac{28.319}{10} = 2.8319$$
Iteration 5: $$x^{(5)} = \tfrac{1}{5}(14 + 2.0205 - 3(2.8319)) = \tfrac{1}{5}(14 + 2.0205 - 8.4957) = \tfrac{7.5248}{5} = 1.505$$ $$y^{(5)} = \tfrac{1}{10}(7 - 1.3284 - 9(2.8319)) = \tfrac{1}{10}(7 - 1.3284 - 25.4871) = \tfrac{-19.8155}{10} = -1.9816$$ $$z^{(5)} = \tfrac{1}{10}(17 + 2(1.3284) - 7(-2.0205)) = \tfrac{1}{10}(17 + 2.6568 + 14.1435) = \tfrac{33.8003}{10} = 3.380$$
Observation on Convergence
The iterates are oscillating and not settling quickly:
| k | x | y | z |
|---|---|---|---|
| 1 | 2.80 | 0.70 | 1.70 |
| 2 | 1.64 | -1.11 | 1.77 |
| 3 | 1.96 | -1.057 | 2.805 |
| 4 | 1.328 | -2.021 | 2.832 |
| 5 | 1.505 | -1.982 | 3.380 |
The values are drifting rather than converging tightly. This is because Row 2 is only borderline dominant ($|10| = |1| + |9|$), so strict diagonal dominance is not satisfied, and Jacobi converges very slowly (borderline behavior).
Exact Solution (for reference)
Solving the system directly gives: $$x = 1,\quad y = -2,\quad z = 3$$
The Jacobi iterates ($x\to$ near 1.5, $y\to$ near $-2$, $z\to$ near 3) are drifting toward the neighborhood of this solution but require many more iterations owing to the borderline dominance.
Final result (converged / exact): $x = 1,\ y = -2,\ z = 3$.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.