---
title: You need to solve Ax = b for a large matrix. Why is forming A⁻¹ explicitly usually a bad idea, and what would you do…
url: https://gurkanozkan.ai/learn/questions/research-solving-linear-systems-005/
markdown: https://gurkanozkan.ai/learn/questions/research-solving-linear-systems-005.md
kind: question
role: Research
stage: Technical
difficulty: Medium
json: https://gurkanozkan.ai/api/learn/questions/research-solving-linear-systems-005.json
robots: noindex
---

# 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?

Research · Technical · Medium

## 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.

*Corrected by an independent AI reviewer.*

## 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.
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
