You need to solve Ax = b for a large matrix. Why is forming A⁻¹ explicitly usually a bad idea, and what would you do for a dense matrix, a symmetric positive-definite matrix, and a very large sparse matrix?
Answer
Model answer, written in a candidate's voice
In short
- Explicit inverse is more expensive, dense, and less stable than factorising.
- Dense: LU with partial pivoting, O(n^3) once then O(n^2) solves.
- SPD: Cholesky, about half the cost, stable, no pivoting.
- Large sparse: iterative solvers (CG/GMRES) with preconditioning, exploit sparsity.
- Condition number governs error amplification.
- Woodbury identity handles low-rank updates.
In full
I would not form A^{-1} explicitly: it costs more than a factorisation (about 2n^3 flops for the inverse versus 2n^3/3 for LU and n^3/3 for Cholesky), is usually dense even when A is sparse, and multiplying by an explicitly computed inverse adds rounding and can amplify error, whereas a factorisation-based solve is backward stable and reusable. For a dense matrix I would do LU with partial pivoting, paying O(n^3) once and then O(n^2) per solve. For an SPD matrix I would use Cholesky, roughly half the LU cost, with no pivoting and very stable solves. For a very large sparse matrix I would avoid the inverse entirely and use iterative methods—conjugate gradient for SPD, GMRES or BiCGSTAB for nonsymmetric—with a preconditioner such as ILU, Jacobi, multigrid, or domain decomposition, exploiting matrix-vector products in O(nnz). The condition number kappa(A) governs error amplification, so a large kappa means small perturbations in A or b can be magnified in x. If the matrix changes by a low-rank update, the Woodbury identity lets me update the solution using the existing factorisation and a small dense correction instead of refactorising.
What a strong answer covers
- An explicit inverse costs more and is numerically less stable than factorising.
- Dense: LU with partial pivoting (O(n³) once, then cheap solves).
- SPD: Cholesky (about half the cost, very stable).
- Large sparse: iterative solvers (conjugate gradient, GMRES) with preconditioning.
- The condition number governs error amplification. The Woodbury identity handles low-rank updates.
Common mistakes
- Quoting O(n²) for Gaussian elimination.
- Ignoring conditioning.