Gauss-Seidel & Jacobi Method Calculator
Enter a real 3×3 system, an initial vector, and a stopping rule to iterate with Gauss-Seidel, Jacobi, or both. The result includes the final residual and diagnostics that help distinguish a useful approximation from an unreliable run.
Gauss-Seidel approximate solution x₁1
- Approximate solution x₂
- 2
- Approximate solution x₃
- -1
- Iterations used
- 7
- Final iterate change
- 0
- Residual norm
- 0
- Spectral radius
- 0.05
- Convergence assessment
- Spectral radius is below 1, so convergence is guaranteed for every initial vector. The applied row order is strictly diagonally dominant.
- A posteriori error bound
- 0
- Recommended row order
- Best order: 1 → 2 → 3; applied order: 1 → 2 → 3. Its minimum diagonal-dominance margin is 2 and it is strictly diagonally dominant.
- Jacobi iterations used
- 12
- Jacobi residual norm
- 0
- Jacobi spectral radius
- 0.32
- Method comparison
- Gauss-Seidel met tolerance in 7 iterations, residual 1.53576e-7, spectral radius 0.0545545; Jacobi met tolerance in 12 iterations, residual 0.00000287853, spectral radius 0.320828.
Gauss-Seidel iteration table
| k | x₁ | x₂ | x₃ | Iterate change | Residual norm |
|---|---|---|---|---|---|
| 1 | 1.25 | 1.79 | -1.07 | 1.79 | 1.07 |
| 2 | 1.07 | 1.99 | -1.01 | 0.2 | 0.27 |
| 3 | 1 | 2 | -1 | 0.07 | 0.02 |
| 4 | 1 | 2 | -1 | 0 | 0 |
| 5 | 1 | 2 | -1 | 0 | 0 |
| 6 | 1 | 2 | -1 | 0 | 0 |
| 7 | 1 | 2 | -1 | 0 | 0 |
Residual norm is calculated against the equations as entered, even when rows are reordered for iteration.
An iterate-change tolerance is a stopping rule, not proof of a small residual or a unique solution.
How to use this calculator
- Enter the coefficient matrix A and right-hand-side vector b for Ax = b in row order.
- Choose Gauss-Seidel, Jacobi, or Compare both, then enter a starting vector.
- Set the largest allowed change between successive vectors and a maximum number of sweeps.
- Use automatic reordering when you want the calculator to try the strongest row order before iterating.
- Read the residual and convergence assessment alongside the approximate solution.
How Gauss-Seidel and Jacobi iteration work
Both methods approximate the solution of Ax = b by repeatedly rewriting each equation for one unknown. The entered matrix is A = [aᵢⱼ], the right-hand side is b, and the starting estimate is x⁽⁰⁾. Jacobi computes every component of the next vector from the previous vector:
xᵢ⁽ᵏ⁺¹⁾ = (bᵢ − Σ(j≠i) aᵢⱼxⱼ⁽ᵏ⁾) / aᵢᵢ
Gauss-Seidel instead uses each newly calculated component as soon as it is available:
xᵢ⁽ᵏ⁺¹⁾ = (bᵢ − Σ(j<i) aᵢⱼxⱼ⁽ᵏ⁺¹⁾ − Σ(j>i) aᵢⱼxⱼ⁽ᵏ⁾) / aᵢᵢ
That reuse often makes Gauss-Seidel reach the same tolerance in fewer sweeps, but it is not a universal rule. The iteration table reports each completed sweep, its infinity-norm change δₖ = ‖x⁽ᵏ⁾ − x⁽ᵏ⁻¹⁾‖∞, and the residual ‖b − Ax⁽ᵏ⁾‖∞.
Convergence checks and row order
Writing A = D + L + U, Jacobi has iteration matrix Tⱼ = −D⁻¹(L + U), while Gauss-Seidel has Tgs = −(D + L)⁻¹U. The spectral radius ρ(T) is the largest absolute eigenvalue of that matrix. When it is below 1, the corresponding linear iteration converges for every initial vector. A value at or above 1 is a warning that convergence is not guaranteed, not a proof that every particular starting vector will fail.
The calculator also checks strict diagonal dominance: in every row, the diagonal magnitude must exceed the sum of the other two magnitudes. That condition is sufficient for convergence here, but not necessary. It tests all six equation orders and recommends the one whose weakest diagonal-dominance margin is largest. Reordering changes the iteration path, not the underlying system or the residual reported against the entered equations.
What moves the result and what this tool leaves out
Row order, the starting vector, tolerance, and maximum sweep count all affect the displayed run. The a posteriori bound is shown only when q = ‖T‖∞ < 1, using ‖x − x⁽ᵏ⁾‖∞ ≤ [q / (1 − q)]δₖ. It is a contraction bound, so it can be conservative.
This calculator handles only real 3×3 systems in finite-precision arithmetic. It does not determine whether a singular or nearly singular system has a unique physical meaning, choose an appropriate model, scale badly conditioned data, or replace a direct solve when one is needed. A small iterate change alone is not enough; check the residual too.
Worked example
For 4x₁ + x₂ + x₃ = 5, 2x₁ + 7x₂ + x₃ = 15, and x₁ − 3x₂ + 12x₃ = −17, start from [0, 0, 0]. The exact solution is [1, 2, −1]: substituting x₁ = 3x₂ − 5 from the first two equations gives x₂ = 2, then x₁ = 1 and x₃ = −1.
With a tolerance of 0.000001, both methods approach those values, while Gauss-Seidel normally requires fewer sweeps for this strictly diagonally dominant order. The final residual checks the approximate vector by putting it back into all three original equations.
Common questions
What is the difference between Jacobi and Gauss-Seidel iteration?
Jacobi calculates every new component from the previous whole vector, so its components can be evaluated independently. Gauss-Seidel uses each newly updated component immediately within the same sweep. That usually makes Gauss-Seidel faster for the same system, although neither method is universally better.
Does the Gauss-Seidel method always converge?
No. A spectral radius below 1 guarantees convergence for every starting vector, and strict diagonal dominance is a useful sufficient condition. Neither condition is necessary, so a system can converge without being diagonally dominant, but a radius at or above 1 means the method has no general convergence guarantee.
Why does diagonal dominance matter?
Diagonal dominance means each equation is driven more strongly by its own unknown than by the other unknowns. For Jacobi and Gauss-Seidel, strict diagonal dominance is a practical sufficient condition for convergence. Rearranging equations can change which coefficients fall on the diagonal and can therefore change the iteration behavior.
What starting values and tolerance should I use?
Zero is a reasonable neutral starting vector when no estimate is available, but a physically informed estimate can reduce the number of sweeps. Choose a tolerance smaller than the precision you need in the solution, then confirm that the residual is also suitably small. Tightening tolerance cannot fix a method that is diverging or a poorly posed system.
What is the residual, and why can it differ from iterate change?
The residual is the infinity norm of b minus A times the current vector, so it measures how closely that vector satisfies the entered equations. Iterate change measures only movement from one sweep to the next. A sequence can move slowly while still leaving a meaningful equation error, especially with an unsuitable iteration or an ill-conditioned system.
Can rearranging equations make Gauss-Seidel converge?
It can. Row order changes the diagonal and lower-triangular parts used by the method, which changes its iteration matrix. This calculator tests all six row orders and can apply the one with the strongest weakest diagonal-dominance margin, but that heuristic cannot guarantee convergence in every system.