Condition Number Explained with Worked Examples

The condition number measures how much errors in the data of can be magnified in the solution: the relative error in can be up to times the relative error in .

Write 2x or 2*x to multiply, ^ for powers, and ; between simultaneous equations. You can also type factor, expand, derivative of, integrate … from a to b, limit … as x->0 or 15% of 80.

Try an example

Before you start

This page is easier if you are comfortable with:

  • matrix inverses and norms
  • solving Ax = b
  • relative error

What Condition number means

For , (the inverse of a 2 × 2 matrix). In the maximum-row-sum norm, and , so : modestly conditioned. For (nearly singular, determinant , the 2 × 2 determinant): , , .

A rule of thumb: about decimal digits are lost in solving the system; for , , so with 16-digit arithmetic only about 11 digits of the answer can be trusted. A matrix with (an orthogonal matrix) is perfectly conditioned. The condition number is large when the matrix is close to singular, i.e. when its rows are nearly dependent.

It governs the accuracy of Gaussian elimination (Gaussian elimination cost, solving a linear system) and the convergence rate of iterative methods (Jacobi and Gauss–Seidel, conjugate gradients). In the 2-norm is the ratio of the largest to the smallest singular value, related to eigenvalues (eigenvalues of a 2 × 2 matrix); regularisation such as ridge regression improves it.

What is it used for?

The condition number tells how much a linear system magnifies errors in its data.

How to use condition number

  1. Compute .
  2. Choose a norm (e.g. maximum absolute row sum).
  3. Compute and .
  4. Multiply: ; digits lost .

Graph

Condition numbers: identity 1, the matrix [[1,2],[3,4]] 21identity: 1[[1,2],[3,4]]: 2100.511.522.530510152025Condition numbers: identity 1, the matrix [[1,2],[3,4]] 21matrixyGraph with x from 0 to 3 and y from 0 to 25. Shows bars (2); point identity: 1 at (1, 1); point [[1,2],[3,4]]: 21 at (2, 21).

A nearly singular matrix can have a condition number of tens of thousands.

Worked examples

These examples are worked by hand, step by step, so you can compare your own working.

Example 1: a modest matrix

Find for .

Worked example
Answer
2121
  1. ‖A‖∞
  2. ‖A⁻¹‖∞

Example 2: a nearly singular matrix

Find for .

Worked example
Answer
4000440004
  1. Norms

Example 3: digits lost

How many digits are lost for ?

Worked example
Answer
4.64.6
  1. Formula

Special cases

A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.

diag(1, 0.01)

κ = 1/0.01 = 100

Ratio of extreme singular values.

(1 2; 3 4) in the 1-norm

κ₁ = 6 × 3.5 = 21

max column sums.

Error amplification

relative error in x ≤ κ × relative error in b

With κ = 100, 1% in b can be 100% in x.

Identity

κ(I) = 1

Perfectly conditioned.

Word problems

The condition number κ(A) = ‖A‖‖A⁻¹‖ measures how much relative errors in b can be amplified in the solution of Ax = b: ‖δx‖/‖x‖ ≤ κ ‖δb‖/‖b‖.

A diagonal matrix

Find κ for diag(1, 0.01).

  1. ‖A‖1
  2. ‖A⁻¹‖100
  3. Check: 100 ✓100.

The 1-norm

Find κ₁ for (1 2; 3 4), given A⁻¹ = (−2 1; 1.5 −0.5).

  1. ‖A‖₁max(4, 6) = 6
  2. ‖A⁻¹‖₁max(3.5, 1.5) = 3.5
  3. κ₁21
  4. Check: ✓21.

Error bound Higher

If κ = 100 and the relative error in b is 0.01, bound the relative error in x.

  1. κ × 0.01
  2. Check: 1, i.e. 100% ✓1.

Digits lost Higher

Roughly how many digits are lost when κ = 10⁶?

  1. log₁₀ κ
  2. Check: 6 ✓6.

Common mistakes

Using the determinant

small det means ill-conditioned ✗

κ is the right measure ✓

Scaling changes det but not κ.

κ < 1

κ = 0.5 ✗

κ ≥ 1 always ✓

‖A‖‖A⁻¹‖ ≥ ‖I‖ = 1.

Mixing norms

one norm for ‖A‖, another for ‖A⁻¹‖ ✗

use the same norm ✓

Be consistent.

Thinking κ depends on b

varies with b ✗

depends only on A ✓

It is a matrix property.

Exam tips

  1. κ = ‖A‖‖A⁻¹‖.
  2. κ ≥ 1.
  3. log₁₀ κ digits lost.
  4. Same norm.
  5. Ill-conditioned = large κ.

Practice questions

Try each one on paper, then open the answer. Use the solver above to see the full working.

1. κ for diag(2, 0.5) Foundation

4

2. κ for diag(1, 0.001) Foundation

1000

3. Error bound κ = 50, input error 0.02 Foundation

1

4. Digits lost for κ = 10⁴ Higher

4

5. κ₁ of (2 0; 0 1): 2 × 1 Higher

2

6. κ₁ of (1 2; 3 4): 6 × 3.5 Higher

21

Practice generator

Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.

Solve: …

Key terms

Condition number
‖A‖‖A⁻¹‖.
Ill-conditioned
κ very large.
Norm
Size of a matrix.
Singular value
Stretch factor.
Relative error
Error ÷ size.
Perturbation
Small change in b.

Frequently asked questions

What is the condition number?

‖A‖‖A⁻¹‖.

What does a large κ mean?

Small errors in b can cause large errors in x.

What is the smallest κ?

1.

How many digits are lost?

About log₁₀ κ.

Which page covers elimination cost?

Gaussian elimination cost.

Which page covers the power method?

power method.

More in Numerical methods and optimisation and the formula sheets.