CACS252 Numerical Method

Numerical MethodUnit 28 min read

Solving Linear Systems: Methods, Errors & Real-World Apps

Unit 2 of Numerical Method covers direct (Gaussian elimination, LU decomposition, Cholesky) and iterative (Jacobi, Gauss-Seidel, SOR) methods for solving linear algebraic equations, error analysis, and their applications in optimization, engineering, and finance—with visual traces of each method’s convergence and real-

Core Concepts & Methods

1. Linear Systems: Definitions & Errors

A system of linear equations is written as , where:

  • is an coefficient matrix,
  • is the unknown vector,
  • is the right-hand side vector.

Types of Errors

  • Round-off error: Due to finite precision in floating-point arithmetic (e.g., in binary).
  • Truncation error: Approximation errors from iterative methods (e.g., stopping Gauss-Seidel after 10 iterations).
  • Condition number (): Measures sensitivity to input errors. A high (e.g., ) means small changes in can drastically alter .

Worked Example 1: Condition Number Calculation For , compute . Solution:

  1. Eigenvalues: , .
  2. . Interpretation: A 1% error in could cause a 200-fold error in .

2. Direct Methods

A. Gaussian Elimination

  • Process: Transform into upper triangular form via row operations, then back-substitute.
  • Pivoting: Partial (swap rows) or complete (swap rows/columns) to avoid division by near-zero.
  • Time Complexity: .
flowchart TD
    A["Original Matrix A"] --> B["Forward Elimination\n(Create zeros below diagonal)"]
    B --> C["Back Substitution\n(Solve Ux = y)"]

Worked Example 2: Gaussian Elimination Solve: Solution:

  1. Forward Elimination:
    • Result:
  2. Back Substitution:
    • , , .

B. LU Decomposition

  • Factorize , where:
    • : Lower triangular with 1s on diagonal.
    • : Upper triangular.
  • Advantage: Reuse and for multiple vectors (e.g., in optimization).

Worked Example 3: LU Decomposition Factorize: Solution:

  1. Doolittle’s Algorithm:
    • , .
    • , .
    • Final:

C. Cholesky Decomposition

  • For symmetric positive-definite matrices (, all eigenvalues > 0).
  • Factorize , where is lower triangular.
  • Efficiency: Fewer operations than LU ( vs. ).

Worked Example 4: Cholesky Factorization Factorize: Solution:

  1. Compute .
  2. , .
  3. , .
  4. .
  5. Final :

3. Iterative Methods

Used for large sparse systems (e.g., finite element analysis in civil engineering).

A. Jacobi Method

  • Formula:
  • Convergence: Requires (diagonally dominant or symmetric positive-definite).

B. Gauss-Seidel Method

  • Improvement: Uses updated immediately in the same iteration.
  • Formula:
  • Convergence: Faster than Jacobi for many problems.

Worked Example 5: Gauss-Seidel for Traffic Flow Model Kathmandu’s ring road traffic as: Solution:

  1. Initial guess: .
  2. Iteration 1:
  3. Iteration 2:
  4. Convergence: After 5 iterations, .

C. Successive Over-Relaxation (SOR)

  • Formula: where (optimal speeds convergence).
  • Use Case: When Gauss-Seidel is slow (e.g., large grids in PDEs).

Comparison Table:

Method Convergence Rate Memory Usage Best For
Jacobi Slow () Low Simple problems
Gauss-Seidel Faster than Jacobi Low Diagonally dominant matrices
SOR Fastest (with ) Low Large sparse systems (e.g., FEA)
LU/Cholesky Exact (no iteration) High Small dense systems

In the Real World

  1. eSewa (Nepal):

    • Problem: Allocating servers to handle peak transaction loads (e.g., Dashain sales).
    • Method: LU decomposition solves the load-balancing matrix , where represents server capacities and is demand.
    • Why? Exact solution (LU) ensures no over/under-provisioning.
  2. Daraz Order Fulfillment:

    • Problem: Routing delivery trucks to minimize fuel cost (a linear system with constraints).
    • Method: Gauss-Seidel iteratively adjusts routes until the cost function converges to the optimal path.
    • Example: For 3 warehouses and 5 delivery zones, the system solves:
  3. NTC Electricity Grid:

    • Problem: Solving Kirchhoff’s laws for voltage/current in the national grid.
    • Method: Cholesky decomposition for symmetric admittance matrices (since grids are lossless and symmetric).
    • Impact: Ensures stable power distribution during peak hours (e.g., winter mornings).

Exam Tip

  1. For Direct Methods:

    • Always check if the matrix is symmetric positive-definite before using Cholesky (saves time).
    • Show pivoting steps in Gaussian elimination if the matrix is ill-conditioned.
    • Common Pitfall: Forgetting to normalize rows in LU decomposition (e.g., ).
  2. For Iterative Methods:

    • Gauss-Seidel vs. Jacobi: Gauss-Seidel is preferred unless the matrix is strictly diagonally dominant (then Jacobi may converge faster).
    • Stopping Criterion: Use (e.g., ).
    • SOR Trick: If Gauss-Seidel converges slowly, try first.
  3. Error Analysis:

    • Always compute the condition number if asked about stability.
    • For iterative methods, plot the error vs. iteration graph (examiners love this!).
  4. Real-World Tie-Ins:

    • If the question mentions "optimization" or "large-scale," assume iterative methods.
    • For "exact solution" or "small systems," use LU/Cholesky.
    • Nepal Context: Relate to traffic (Gauss-Seidel), finance (LU for loan amortization), or energy grids (Cholesky).

Visual Summary:

mindmap
  root((Linear Systems))
    Direct Methods
      Gaussian Elimination
        Pivoting
        Back Substitution
      LU Decomposition
        Doolittle's Algorithm
      Cholesky
        Symmetric Positive-Definite
    Iterative Methods
      Jacobi
        Slow but Simple
      Gauss-Seidel
        Faster, Uses Updated Values
      SOR
        Optimal Relaxation (ω)
    Errors
      Round-off
      Truncation
      Condition Number
    Real-World
      eSewa (LU)
      Daraz (Gauss-Seidel)
      NTC Grid (Cholesky)

Based on the TU BCA syllabus for Numerical Method (CACS252), unit 2.

Discussion

Loading…