LA 101
M09 · L01
Module 9: Numerical Linear Algebra
Floating Point and Conditioning
Computers store real numbers with finite precision. Understanding rounding errors and the condition number — the matrix's amplification factor for perturbations — is essential before trusting any numerical result.
01 / 11
LA 101
M09 · L01
IEEE 754 Double Precision
Finite Representation
64
Bits total
52
Mantissa bits
~16
Decimal digits
Machine epsilon
ε_mach = 2⁻⁵² ≈ 2.2×10⁻¹⁶ — the smallest positive number such that 1 + ε_mach ≠ 1 in floating point. Relative rounding error in any single float operation is at most ε_mach.
02 / 11
LA 101
M09 · L01
Rounding Error
Catastrophic Cancellation
Relative Error
\frac{|\mathrm{fl}(x)-x|}{|x|}\leq\varepsilon_{\text{mach}},\quad \varepsilon_{\text{mach}}=2^{-52}\approx 2.2\times10^{-16}
Example
If a ≈ b, then a − b loses log₁₀(|a|/|a−b|) decimal digits. Quadratic formula: for b² ≈ 4ac, compute large root via quadratic formula, small root via x₁x₂ = c/a. Never subtract nearly equal floats.
03 / 11
LA 101
M09 · L01
Condition Number
Amplifying Perturbations
- Definition: κ(A) = ‖A‖ · ‖A⁻¹‖ = σ_max / σ_min
- Meaning: worst-case amplification of relative error
- If κ = 10⁶: ε_mach = 10⁻¹⁶ error in b → 10⁻¹⁰ error in x
- Rule of thumb: κ = 10^k → lose k decimal digits
- κ = 1: orthogonal matrix — perfectly conditioned
04 / 11
LA 101
M09 · L01
Condition Number Bound
Error Amplification
Perturbation Bound
\frac{\|\delta x\|}{\|x\|}\leq\kappa(A)\frac{\|\delta b\|}{\|b\|},\quad\kappa(A)=\frac{\sigma_{\max}}{\sigma_{\min}}
The relative error in x is bounded by κ(A) times the relative error in b. Ill-conditioning is a property of the problem, not the algorithm. Even a perfect algorithm cannot beat this bound.
05 / 11
LA 101
M09 · L01
Classic Example
The Hilbert Matrix
H₁₀ — 10×10 Hilbert matrix
H_{ij} = 1/(i+j−1). Condition number κ₂(H₁₀) ≈ 1.6×10¹³. Double precision gives only ~3 reliable digits in the solution. Arises in polynomial regression with monomial basis — use orthogonal polynomials instead.
Other ill-conditioned sources
Multicollinear features (correlated columns), Vandermonde matrices, discretized PDEs with fine meshes, near-singular physical systems.
06 / 11
LA 101
M09 · L01
Numerical Stability
Stable vs. Unstable Algorithms
- Backward stable: result is exact for nearby problem (δ ∼ ε_mach)
- Unstable: amplifies rounding beyond what κ(A) requires
- LU without pivoting: unstable — small pivots explode
- LU with partial pivoting: backward stable in practice
- Never form A⁻¹b: wasteful and less stable than factorization
07 / 11
LA 101
M09 · L01
Least Squares Stability
QR vs. Normal Equations
Condition Number Comparison
\kappa(X^T X)=\kappa(X)^2
Why QR wins
If κ(X) = 10⁸ (borderline), then κ(XᵀX) = 10¹⁶ — essentially singular in double precision. QR works directly with X: gives 8 reliable digits vs. 0 from normal equations. All serious libraries use QR or SVD.
08 / 11
LA 101
M09 · L01
Practical Checklist
When to Worry
- Check κ(A): if κ > 10^(16−p), p-digit accuracy is impossible
- Normalize data: standardizing X brings singular values together
- Use regularization: ridge adds λI, caps κ at (σ_max²+λ)/λ
- Monitor residuals: ‖Ax̃ − b‖/‖b‖ reveals backward error
- Use QR/SVD: never normal equations for least squares
10 / 11
LA 101
M09 · L01
Module 9 · Lesson 1 Complete
Precision and Stability
ε_mach ≈ 2.2×10⁻¹⁶ bounds single-op rounding. Cancellation destroys digits. κ(A) = σ_max/σ_min amplifies errors. κ = 10^k → lose k digits. Ill-conditioning is the problem's fault, not the algorithm's. Use LU with pivoting, QR for least squares, never form A⁻¹.
Module 9: Numerical Linear Algebra
Floating Point · Conditioning · Iterative Methods
11 / 11