Skip to main content

Condition Number Calculator

Solve condition number problems step-by-step with our free calculator. See formulas, worked examples, and clear explanations.

Share this calculator

Formula

cond(A) = ||A|| * ||A^(-1)|| or cond_2(A) = sigma_max / sigma_min

The condition number is the product of the matrix norm and its inverse norm. For the 2-norm, it equals the ratio of the largest to smallest singular values. A condition number near 1 indicates stability, while a large value indicates the system is sensitive to perturbations.

Worked Examples

Example 1: Well-Conditioned Matrix

Problem: Find the condition number of A = [[1, 0], [0, 1]] (identity matrix).

Solution: The identity matrix has singular values sigma1 = 1, sigma2 = 1.\nCondition number (2-norm) = sigma1/sigma2 = 1/1 = 1.\nThe inverse is also the identity, so all norms give condition number = 1.\nThis is the best possible conditioning.

Result: Condition number = 1 (perfectly conditioned)

Example 2: Ill-Conditioned Matrix

Problem: Find the condition number of A = [[1, 2], [3, 4]].

Solution: Determinant = 1(4) - 2(3) = -2\nInverse = [[-2, 1], [1.5, -0.5]]\nFrobenius norm of A = sqrt(1+4+9+16) = sqrt(30)\nFrobenius norm of inverse = sqrt(4+1+2.25+0.25) = sqrt(7.5)\nCondition (Frobenius) = sqrt(30) * sqrt(7.5) = sqrt(225) = 15\n2-norm condition = sigma_max/sigma_min = 5.465/0.366 = 14.933

Result: Condition number (2-norm) = 14.93 | Well-conditioned

Frequently Asked Questions

What is the condition number of a matrix?

The condition number of a matrix measures how sensitive the solution of a linear system Ax = b is to small changes in A or b. It is defined as the product of the norm of A and the norm of its inverse. A condition number close to 1 means the matrix is well-conditioned and the solution is stable. A large condition number means the matrix is ill-conditioned and even tiny perturbations in the input can cause large changes in the output. The condition number is always greater than or equal to 1, and it equals 1 only for orthogonal matrices (in the 2-norm).

How is the condition number calculated?

The condition number depends on the matrix norm chosen. For the 2-norm, it is the ratio of the largest to smallest singular values of the matrix. For the Frobenius norm, it equals the product of the Frobenius norms of the matrix and its inverse. For the 1-norm, it uses maximum absolute column sums, and for the infinity-norm, maximum absolute row sums. The 2-norm condition number is most commonly used because it has a direct geometric interpretation in terms of how much the matrix stretches or compresses vectors. Each norm gives a slightly different condition number, but they all convey similar information about sensitivity.

What does a high condition number mean?

A high condition number indicates that the matrix is ill-conditioned, meaning that the solution to Ax = b is highly sensitive to perturbations. In floating-point arithmetic, you can expect to lose roughly log10(condition number) digits of accuracy in the computed solution. For example, if the condition number is 10^6 and you use double precision (about 16 significant digits), the solution may only be accurate to about 10 digits. In practical applications, a condition number above 10^12 or so means the computed solution may be completely unreliable. High condition numbers arise when the matrix is close to being singular.

What is the difference between the condition number and the determinant?

While both relate to matrix invertibility, they measure different things. The determinant tells you whether a matrix is singular (zero determinant) or not, but a nonzero determinant does not guarantee good conditioning. A matrix can have a large determinant and still be ill-conditioned, or a small determinant and be well-conditioned. The condition number provides a quantitative measure of how close the matrix is to being singular in a meaningful numerical sense. For numerical computation, the condition number is far more informative than the determinant about the reliability of solving linear systems.

How does the condition number affect numerical computations?

In numerical linear algebra, the condition number is critical for understanding the accuracy of computed solutions. When solving Ax = b using floating-point arithmetic, the relative error in the solution x is bounded by the condition number times the relative error in the input data. This means that for a condition number of 1000, a 0.001% error in the input could produce up to a 1% error in the output. Iterative solvers may converge slowly for ill-conditioned systems. Preconditioning techniques are specifically designed to reduce the effective condition number and improve both accuracy and convergence speed.

What are singular values and how do they relate to the condition number?

Singular values are the square roots of the eigenvalues of A-transpose times A, and they represent the stretching factors of the matrix transformation along orthogonal directions. Every matrix has a singular value decomposition (SVD), and the singular values are always non-negative real numbers. The largest singular value measures the maximum stretching, and the smallest measures the minimum. The 2-norm condition number is simply the ratio of the largest to the smallest singular value. When the smallest singular value is close to zero, the condition number is large, indicating near-singularity and numerical instability.

References