The condition number and numerical stability
5 min read
Short answer
The condition number bounds how errors in are magnified in : . A large (nearly singular ) means tiny data errors can ruin the answer, no matter how good the algorithm is.
A fragile system
The system has two nearly parallel lines. Changing the right side in the fifth digit moves the solution a long way.
What you can do
You cannot fix ill-conditioning by changing the algorithm: it is a property of the problem. Options: rescale variables, reformulate, add regularization (as in ridge regression), or obtain more precise data.
Worked example
For , solve with and with .
First: , , so . Second: subtracting equations gives , so , , . A change of in one entry of moved the solution by about : this has in the tens of thousands.
Try it yourself
If and your data has 16 digits of precision, roughly how many digits can you trust in ?
Show the answer
About digits.
Keep going with practice
Vidi's linear algebra lessons explain why nearly dependent columns make least-squares fits unstable.