Choosing
Solution Methods
Learn when to use Elimination, Matrix Inverse, or LU Decomposition to solve \( Ax = b \) efficiently.
What Does Solving \( Ax = b \) Mean?
Given a system of \( n \) linear equations in \( n \) unknowns, we can write it as a single matrix equation \( Ax = b \), where \( A \) is the coefficient matrix, \( x \) is the unknown vector, and \( b \) is the right-hand side.
Three dominant approaches exist: Gaussian Elimination, Matrix Inverse, and LU Decomposition. Each excels in different scenarios.
The Three Methods at a Glance
Why the Method Matters
Every algorithm has a computational cost measured in floating-point operations (flops). Choosing poorly can make your computation orders of magnitude slower.
Gaussian Elimination
Row-reduce the augmented matrix \( [A \mid b] \) to upper-triangular form \( U \), then solve by back-substitution.
The Matrix Inverse Approach
If \( A \) is invertible, the solution is \( x = A^{-1}b \). Computing \( A^{-1} \) requires solving \( n \) systems: \( A \cdot [\text{col}_1 \mid \cdots \mid \text{col}_n] = I_n \).
LU Decomposition
Factor \( A = LU \), where \( L \) is lower-triangular and \( U \) is upper-triangular. Then solve in two cheap triangular steps.
Key Distinction: One Solve vs. Many
How to Choose Your Method
Step-by-Step Decision Process
Example 1: Single Solve
Solve the system: \( \begin{cases} 2x + y - z = 8 \\ -3x - y + 2z = -11 \\ -2x + y + 2z = -3 \end{cases} \)
Example 2: Multiple Right-Hand Sides
A circuit analysis requires solving \( Ax = b_k \) for \( k = 1, 2, \ldots, 100 \), where \( A \) is a fixed \( 50 \times 50 \) matrix representing the circuit topology.
Example 3: When You Need \( A^{-1} \)
A statistics formula requires the matrix \( (X^TX)^{-1} \) explicitly to compute the covariance matrix of regression coefficients: \( \text{Cov}(\hat{\beta}) = \sigma^2(X^TX)^{-1} \).
Even in this case, the actual computation is typically done via LU: factor \( A = LU \), then solve \( A \cdot e_i = \text{col}_i(A^{-1}) \) for each standard basis vector \( e_i \). Total cost: \( \sim 2n^3 \) flops.
Numerical Stability: Partial Pivoting
In practice, all three methods require pivoting: swapping rows to avoid dividing by small numbers that amplify rounding errors.
Common Mistakes
Method Comparison
| Elimination | LU Decomp. | Inverse | |
|---|---|---|---|
| Setup cost | \( \sim \frac{2}{3}n^3 \) | \( \sim \frac{2}{3}n^3 \) | \( \sim 2n^3 \) |
| Per-solve cost | \( \sim \frac{2}{3}n^3 \) | \( \sim 2n^2 \) | \( \sim 2n^2 \) |
| Best scenario | Single \( b \) | Many \( b \)'s | Need \( A^{-1} \) itself |
| Stability | Excellent | Excellent | Weaker |
| Storage | \( O(n^2) \) | \( O(n^2) \) | \( O(n^2) \) |
Question 1 of 5
You need to solve \( Ax = b \) for a single right-hand side \( b \). Which method is most efficient?
Question 2 of 5
A simulation requires solving \( Ax = b_k \) for 500 different vectors \( b_k \), all with the same coefficient matrix \( A \). What is the most efficient approach?
Question 3 of 5
What is the approximate flop count for computing the inverse of an \( n \times n \) matrix?
Question 4 of 5
Why is partial pivoting essential in Gaussian elimination?
Question 5 of 5
In LU decomposition with \( PA = LU \), what does the matrix \( P \) represent?