Numerical MethodUnit 67 min read
Solving Linear Systems: Methods, Errors & Applications
Unit 6 of Numerical Methods covers direct (Gaussian elimination, LU decomposition) and iterative (Jacobi, Gauss-Seidel) methods for solving linear systems, error analysis, pivoting strategies, and real-world applications in finance, engineering, and optimization.
TAKEAWAYS:
- Linear systems are solved via direct methods (exact but computationally expensive) or iterative methods (approximate but efficient for large systems).
- Pivoting (partial/complete) prevents division by zero and improves numerical stability.
- Error analysis (true error, relative error) quantifies solution accuracy.
- Jacobi/Gauss-Seidel methods converge faster for diagonally dominant matrices.
- Real-world uses include loan amortization (banks), traffic flow optimization (Pathao), and portfolio risk modeling (NEPSE).
1. Introduction to Linear Systems
A linear system is a set of linear equations with the same variables. For example: Solutions can be:
- Unique solution (lines intersect at one point).
- No solution (parallel lines).
- Infinite solutions (same line).
Matrix Form: , where:
- = coefficient matrix,
- = solution vector,
- = constant vector.
2. Direct Methods: Gaussian Elimination
Goal: Convert into upper triangular form, then back-substitute.
Steps:
- Forward Elimination: Use row operations to create zeros below the diagonal.
- Back Substitution: Solve for variables starting from the last row.
Example 1: Solve
Solution Trace:
- Augmented Matrix:
[2 2 1 | 12] [3 2 2 | 8] [5 10 -8 | 10] - Row Reduction:
- → Upper triangular form:
[2 2 1 | 12] [0 -1 0.5 | -2] [0 0 -12 | -10] - Back Substitution:
Final Answer: , , .
3. Pivoting Strategies
Problem: Division by small numbers causes numerical instability (round-off errors).
Types:
- Partial Pivoting: Swap rows to place the largest absolute value in the pivot position.
- Complete Pivoting: Swap rows and columns for the largest absolute value.
Example 2: Partial Pivoting Solve: Without Pivoting: (incorrect due to tiny pivot). With Pivoting: Swap rows → correct solution , .
flowchart TD
A["Original System\n(Unstable)"] -->|"Swap Rows"| B["Stable System\nAfter Pivoting"]
B --> C["Correct Solution\nx=1, y=1"]4. LU Decomposition
Decompose , where:
- = lower triangular matrix,
- = upper triangular matrix.
Advantage: Faster for multiple right-hand sides ().
Example 3: LU Decomposition For :
- → Solve , then .
5. Iterative Methods: Jacobi and Gauss-Seidel
Used for large sparse systems (e.g., power grids, traffic networks).
Jacobi Method
Update all variables simultaneously:
Gauss-Seidel Method
Update variables sequentially (uses latest values):
Example 4: Gauss-Seidel for Initial Guess: Iteration 1:
- Convergence: After 5 iterations, , , .
6. Error Analysis
| Error Type | Formula | When Used |
|---|---|---|
| True Error | Exact solution known. | |
| Relative Error | Normalized error comparison. |
Example 5: For , :
- True error =
- Relative error = (5%).
7. Comparison of Methods
| Method | Pros | Cons | Best For |
|---|---|---|---|
| Gaussian Elimination | Exact solution. | time. | Small systems. |
| LU Decomposition | Efficient for multiple . | Requires to be invertible. | Repeated solves. |
| Jacobi | Simple to implement. | Slow convergence. | Diagonally dominant matrices. |
| Gauss-Seidel | Faster than Jacobi. | Requires proper ordering. | Large sparse systems. |
In the Real World
Bank Loan Amortization (Nabil Bank, Global IME)
- Idea Used: Solving linear systems for monthly payments.
- How: The system models loan principal/interest, where encodes interest rates and is the total repayment. Gaussian elimination solves for monthly installments.
- Example: A ₹500,000 loan at 8% for 10 years → 120 equations (one per month) solved iteratively.
Traffic Route Optimization (Pathao, Daraz Logistics)
- Idea Used: Least-cost path via linear systems.
- How: Traffic flow is modeled as , where = flow rates, = demand. Gauss-Seidel finds optimal routes dynamically.
- Example: Pathao’s algorithm reduces Kathmandu’s Thamel traffic congestion by 15% using real-time system solves.
Stock Portfolio Risk (NEPSE, Kantipur Stocks)
- Idea Used: Portfolio optimization via linear systems.
- How: The Markowitz model solves to minimize risk for a given return . LU decomposition speeds up recalculations.
- Example: A ₹1M portfolio with 5 stocks → 5×5 system solved daily to rebalance holdings.
Exam Tip
For Gaussian Elimination:
- Always show row operations explicitly.
- Use partial pivoting unless told otherwise.
- Check for inconsistent systems (e.g., ).
For Iterative Methods:
- State the convergence criterion (e.g., ).
- Gauss-Seidel converges faster if the matrix is diagonally dominant ( ).
Error Questions:
- True error is absolute; relative error is normalized.
- Example: If the true value is 100 and approximate is 99, relative error = 0.01.
Common Pitfalls:
- Forgetting to swap rows in pivoting → wrong answer.
- Misapplying back substitution → incorrect variables.
- LU decomposition requires to be invertible (check ).
Visual Summary:
mindmap
root((Linear Systems))
Direct Methods
Gaussian Elimination
LU Decomposition
Iterative Methods
Jacobi
Gauss-Seidel
Error Analysis
True Error
Relative Error
Real-World
Banks
Traffic
StocksBased on the TU BIT syllabus for Numerical Method (BIT203), unit 6.
Discussion
Loading…