Understanding Condition Number
The condition number of a matrix A, denoted κ(A) or cond(A), measures the maximum factor by which small input errors can be amplified in the output. For an invertible square matrix, it is defined as the product of the matrix's norm and the norm of its inverse.
When solving a linear system A·x = b, the condition number acts as an error magnification factor. If b is perturbed by a small amount due to measurement noise or computational rounding, the solution x will shift by roughly κ(A) times that perturbation. A condition number of 1 (achieved by the identity matrix) represents optimal stability—errors pass through unchanged. Larger values indicate increasingly ill-conditioned problems where numerical solutions become unreliable.
If a matrix is singular (non-invertible), its condition number is infinite, signalling that small changes in b may produce no solution or infinitely many solutions.
Condition Number Formula
The condition number is calculated by selecting a matrix norm and computing the product of the norm of the original matrix and the norm of its inverse:
κ(A) = ‖A‖ · ‖A⁻¹‖
where:
‖A‖ = matrix norm of A
‖A⁻¹‖ = matrix norm of the inverse of A
κ(A)— Condition number of matrix A‖A‖— Norm of the matrix (using your chosen norm type)‖A⁻¹‖— Norm of the matrix inverse
Computing the Condition Number Step-by-Step
To find a matrix's condition number:
- Choose a matrix norm. Common choices are the 1-norm, 2-norm (spectral norm), Frobenius norm, and infinity norm. The 2-norm is standard for stability analysis because it relates directly to the largest singular value.
- Compute the matrix inverse. Use Gaussian elimination, LU decomposition, or cofactor methods. If the determinant is zero, the matrix is singular and κ(A) = ∞.
- Calculate both norms. Apply your chosen norm formula to both A and A⁻¹, ensuring consistency throughout.
- Multiply the results. The product is your condition number.
For small matrices (2×2 and 3×3), hand calculation is feasible; larger systems benefit from numerical libraries that compute condition numbers more efficiently via singular value decomposition.
Common Pitfalls and Considerations
When working with condition numbers, be aware of these practical insights:
- Scaling does not change the condition number — Multiplying an entire matrix by a scalar γ does not alter its condition number. Both the matrix and its inverse scale inversely, cancelling out in the product. Thus κ(γA) = κ(A). This property makes condition number a scale-invariant measure of numerical difficulty.
- Diagonal matrices have a simple condition number formula — For a diagonal matrix D with non-zero entries, κ(D) = max(|dᵢᵢ|) ÷ min(|dᵢᵢ|) using the 2-norm. This is simply the ratio of the largest to smallest diagonal element. Diagonal matrices with entries of very different magnitudes tend to be ill-conditioned.
- Condition numbers below 10 indicate stability — A condition number between 1 and 10 suggests the system is well-conditioned and small input errors will not grossly distort the solution. Values above 100 warrant caution; above 10,000 indicates severe numerical danger and potential loss of significant figures in floating-point arithmetic.
- Norm choice matters for interpretation — Different norms can yield different condition numbers for the same matrix. The 2-norm (spectral norm) is most common in theory and practice because it directly relates to singular values and eigenvalues, making it physically meaningful for stability analysis.
Practical Example
Consider the 2×2 system with matrix A = [3.7, 0.9; 7.8, 1.9] and right-hand side b = [7.4; 15.6].
The solution is x = [2; 0]. Now suppose b is measured with a small error: b = [7.4; 15.605]. Using the 2-norm, this matrix has a condition number of approximately 24.6. The error in b is roughly 0.03%, but the relative error in the solution will be magnified by a factor near 24.6, resulting in a solution error of about 0.8%—roughly 25 times larger than the input error. This demonstrates why systems with high condition numbers are prone to numerical difficulty.