Numerical MethodsUnit 59 min read

Solution of Linear Algebraic Equations – Direct & Iterative Methods

Unit 5 of Numerical Methods: covers theory and practice of solving linear systems using direct methods (Gaussian elimination, LU, Crout, Cholesky), iterative methods (Jacobi, Gauss‑Seidel, SOR, Conjugate Gradient), matrix inversion, error analysis, condition number, and real‑world applications.

Key points

  • Linear systems \(A\mathbf{x}=\mathbf{b}\) are solved by transforming \(A\) into simpler forms.
  • Direct methods give exact solutions in finite steps; iterative methods converge to the solution and are useful for large sparse systems.
  • LU decomposition (Crout/Cholesky) reduces solving time for multiple right‑hand sides.
  • The condition number of \(A\) predicts sensitivity of the solution to data errors.
  • Error analysis (forward, backward, relative) is essential for assessing numerical reliability.

Introduction

Linear algebraic equations are the backbone of numerical simulation, engineering design, and data science. A system of linear equations can be written in matrix form

where is the coefficient matrix, the unknown vector, and the right‑hand side.
The goal of this unit is to equip you with systematic procedures to obtain efficiently and accurately, and to understand when each method is appropriate.

Definitions

  • Coefficient matrix : square matrix of constants.
  • Triangular matrix: all entries below (lower) or above (upper) the main diagonal are zero.
  • LU decomposition: where is lower triangular and is upper triangular.
  • Pivoting: swapping rows (partial) or columns (full) to avoid division by small numbers.
  • Iterative method: starts with an initial guess and refines it using a recurrence.
  • Convergence: .
  • Condition number : measures sensitivity of the solution to perturbations.

Direct Methods

Gaussian Elimination (with Partial Pivoting)

The classic algorithm transforms into an upper triangular matrix by successive elimination of sub‑diagonal entries. The solution is then obtained by back‑substitution.

flowchart TD
    A["Start with \(A\) and \(\mathbf{b}\)"] --> B["Forward elimination"]
    B --> C["Partial pivoting"]
    C --> D["Upper triangular matrix \(U\)"]
    D --> E["Back substitution"]
    E --> F["Solution \(\mathbf{x}\)"]

Figure 1 – Gaussian elimination process

Worked Example
Solve

Forward elimination (no pivot needed):

Resulting upper triangular system:

Back substitution:

Thus .

LU Decomposition – Crout’s Method

Crout’s algorithm factors as where has non‑zero diagonal entries and has unit diagonal.

flowchart TD
    A["Start with \(A\)"] --> B["Compute \(L\) and \(U\) (Crout)"]
    B --> C["Solve \(L\mathbf{y}=\mathbf{b}\) (forward)"]
    C --> D["Solve \(U\mathbf{x}=\mathbf{y}\) (backward)"]
    D --> E["Solution \(\mathbf{x}\)"]

Figure 2 – Crout’s LU decomposition

Worked Example
Factor

Crout’s algorithm yields

Given , forward solve to get , then back‑solve to obtain .

Cholesky Decomposition

For symmetric positive‑definite , . It requires only half the operations of LU.

Figure 3 – Cholesky decomposition

Matrix Inversion – Gauss‑Jordan

To find , augment with the identity matrix and perform row operations until the left side becomes .

flowchart TD
    A["Start with \([A|I]\)"] --> B["Row operations"]
    B --> C["Left side becomes \(I\)"]
    C --> D["Right side is \(A^{-1}\)"]

Figure 4 – Gauss‑Jordan inversion

Iterative Methods

Jacobi Method

Each component of is computed from the previous iterate:

flowchart TD
    X0["Initial guess \(\mathbf{x}^{(0)}\)"] --> X1["Compute \(\mathbf{x}^{(1)}\) using Jacobi"]
    X1 --> X2["Check convergence"]
    X2 -->|"Not converged"| X1
    X2 -->|"Converged"| X3["Solution \(\mathbf{x}\)"]

Gauss‑Seidel Method

Improves Jacobi by using newly computed components immediately:

Successive Over‑Relaxation (SOR)

Adds a relaxation factor (1 <  < 2) to accelerate convergence:

Conjugate Gradient (CG)

Specialized for symmetric positive‑definite . Uses residuals and search directions to converge in at most steps.

flowchart TD
    R0["Start with \(\mathbf{r}^{(0)} = \mathbf{b} - A\mathbf{x}^{(0)}\)"] --> P0["Set \(\mathbf{p}^{(0)} = \mathbf{r}^{(0)}\)"]
    P0 --> C1["Compute \(\alpha_k = \frac{(\mathbf{r}^{(k)})^T\mathbf{r}^{(k)}}{(\mathbf{p}^{(k)})^T A \mathbf{p}^{(k)}}\)"]
    C1 --> C2["Update \(\mathbf{x}^{(k+1)} = \mathbf{x}^{(k)} + \alpha_k \mathbf{p}^{(k)}\)"]
    C2 --> C3["Update \(\mathbf{r}^{(k+1)} = \mathbf{r}^{(k)} - \alpha_k A \mathbf{p}^{(k)}\)"]
    C3 --> C4["Check convergence"]
    C4 -->|"Not converged"| C1
    C4 -->|"Converged"| C5["Solution \(\mathbf{x}\)"]

Error Analysis

Forward Error

Backward Error

Relative Error

Condition Number

A large indicates that small perturbations in or can cause large changes in .

Figure 5 – Condition number effect

Comparison of Direct vs Iterative Methods

Method Complexity Memory Suitable for Pros Cons
Gaussian Elimination Small to medium dense Simple, exact Not efficient for large sparse
LU (Crout/Cholesky) Dense, multiple RHS Reuse factorization Requires pivoting
Gauss‑Jordan Small systems Gives inverse Numerically unstable
Jacobi per iteration Sparse, parallelizable Simple Slow convergence
Gauss‑Seidel per iteration Sparse, diagonally dominant Faster than Jacobi Requires ordering
SOR per iteration Sparse, tuned Accelerated Choosing
Conjugate Gradient per iteration Symmetric positive‑definite Fast, memory‑efficient Requires SPD

In the real world

  1. Google PageRank – Computes the rank vector by solving , where is the web‑link matrix. The system is large and sparse; Conjugate Gradient or GMRES is used.
  2. eSewa transaction settlement – Balancing debits and credits across multiple user accounts can be expressed as where is a sparse incidence matrix. Gauss‑Seidel with partial pivoting ensures fast settlement.
  3. Ncell network optimization – Allocation of bandwidth to base stations is modeled as a linear system derived from flow conservation constraints. LU decomposition with partial pivoting solves the system quickly for real‑time adjustments.

Worked Example – Heat Conduction in a 2×2 Plate

A square metal plate of side is discretized into a grid (including boundaries). Boundary temperatures: left and right edges , top and bottom edges . The interior node temperatures satisfy

Matrix form with

Using Gaussian elimination (no pivot needed), we obtain

Figure 6 – Grid and matrix for heat conduction

The solution shows that the interior nodes reach the same temperature as the boundaries due to symmetry.

Exam tip

  • Know the algorithmic steps of Gaussian elimination, LU, and iterative methods; be able to write them in pseudocode.
  • Practice pivoting: identify when partial pivoting is required and how it changes the algorithm.
  • Solve a full system by hand (or with a calculator) to reinforce forward/backward substitution.
  • Understand convergence criteria for iterative methods; be prepared to compute the spectral radius or use the relaxation factor .
  • Error analysis: be able to compute forward, backward, and relative errors, and explain the impact of the condition number.
  • Draw a small matrix and perform one elimination step to demonstrate your understanding of row operations.


Based on the PU BE Computer (PU) syllabus for Numerical Methods, unit 5.

Discussion

Loading…