Condition Number Calculator
Welcome to the condition number calculator. Need to determine whether your linear algebra problem is well-conditioned or unstable? Will incorrect measurements or poor rounding be the downfall of your matrix equation? Here, we'll show you what a matrix condition number is and how to find the condition number of any matrix, so that you can protect yourself against any errors that may creep in.
What is the condition number of a matrix?
Before we can make sense of any result our condition number calculator produces, let's first define the matrix condition number and what it represents. We usually denote the condition number of a matrix A as cond(A) or κ(A). We can define it mathematically as follows:
κ(A) = ∥A∥ · ∥A-1∥ (if A is invertible), otherwise κ(A) = ∞
In this equation, ∥·∥ is any matrix norm. When we want to specify which norm we used, we can use the relevant subscript in the condition number symbol, such as κ2(A) for the matrix 2-norm ∥·∥2. In addition, A-1 is the matrix inverse of A.
The matrix A is non-invertible if its determinant is zero (i.e., |A| = 0). In this case, it has an infinite condition number. To still gain some insight into the matrix's conditionality, some mathematicians would redefine the condition number with the pseudoinverse A+ as κ(A) = ∥A∥ · ∥A+∥. This alternate definition would still deliver huge, near-infinite condition numbers for non-invertible matrices, thereby still honoring our initial definition.
We can interpret the condition number in multiple ways. Firstly, cond(A) measures the ratio of maximum stretching to maximum shrinking of a unit vector x⃗ (i.e., ∥x⃗∥ = 1) when A is multiplied with it. Therefore, an equivalent definition of the condition number is:
κ(A) = ( max∥x∥=1 ∥Ax⃗∥ ) · ( min∥x∥=1 ∥Ax⃗∥ )-1
In pure mathematics, a matrix is either invertible or not. But, as the second way of interpreting the condition number, cond(A) is a measure of how invertible A is. As cond(A) increases, A gets closer to being non-invertible. The third and most important use of condition numbers is in linear algebra — let's take a look at why below!
The matrix condition number in linear algebra
When we have a system of linear equations A·x⃗ = b⃗, the condition number takes on a special meaning. cond(A) now becomes the rate at which the solution x⃗ will change in relation to a change in b⃗. For this reason, we can call cond(A) the problem's error magnification factor. Changes in b⃗ are usually due to errors made in formulating the problem, such as taking erroneous measurements or making rounding errors.
So, suppose some error crept in, and the values contained in b⃗ are slightly wrong. How far from the truth our newly-found solution x⃗ is depends on cond(A):
- If the condition number of matrix A is large, x⃗ is vulnerable to errors. The error in x⃗ resulting from the error in b⃗ will therefore be large.
- Inversely, if cond(A) is small, x⃗ will be well-protected against reasonable errors in b⃗, and so its error will be small.
We can restate this relation mathematically. With δb⃗ representing the error in b⃗ and δx⃗ the resulting change in x⃗, we can relate the relative errors with:
∥δx⃗∥ / ∥x⃗∥ ≤ cond(A) · ( ∥δb⃗∥ / ∥b⃗∥ )
How to find the condition number of a matrix?
To find the condition number by hand, follow these steps:
- Pick a matrix norm ∥·∥ (for example the 1-norm, the infinity norm, or the 2-norm).
- Compute the norm of A, i.e., ∥A∥.
- Find the inverse matrix A-1. If the determinant of A is zero, then A is singular and cond(A) = ∞.
- Compute the norm of the inverse, i.e., ∥A-1∥.
- Multiply the two norms together: cond(A) = ∥A∥ · ∥A-1∥.
Our calculator reports the condition number in four norms at once:
- κ1 — uses the 1-norm (maximum absolute column sum).
- κ∞ — uses the infinity norm (maximum absolute row sum).
- κ2 — uses the 2-norm (spectral norm); this equals the ratio of the largest to the smallest singular value, σmax/σmin, and is the value most people mean by "the" condition number.
- κF — uses the Frobenius norm (root of the sum of squared entries).
How to use the condition number calculator?
- Choose the size of your square matrix (2×2, 3×3, or 4×4).
- Type the entries of your matrix into the grid — decimals and negative numbers are allowed.
- Optionally attach a metric, US/imperial, or currency context (12 world currencies, including the US dollar and the Russian ruble) if your entries stand for real-world quantities. Note that the condition number itself is a dimensionless ratio.
- Press Calculate condition number to read off cond(A) in all four norms, the determinant, the inverse matrix, and a plain-language stability verdict.
How to find the condition number of a matrix? – An example
Consider the 3×3 matrix loaded by default:
2 1 0 1 3 1 0 1 2
- Its determinant is |A| = 8, so the matrix is invertible.
- The 1-norm (and, by symmetry, the infinity norm) of A is 5 — the largest absolute column (or row) sum, here the middle column 1 + 3 + 1.
- Inverting A and taking the norm of the inverse gives ∥A-1∥1 = 1 (every column of A-1 has absolute values summing to 1).
- Therefore κ1(A) = 5 × 1 = 5 — a small number, so this matrix is very well-conditioned.
A condition number close to 1 means the matrix is well-conditioned and safe to work with. A very large condition number (say, above 106) means the matrix is ill-conditioned: tiny errors in your data can be amplified into large errors in the solution. As a rule of thumb, you lose roughly log10(cond) digits of accuracy when solving the system.
FAQs
What is a good condition number?
A condition number close to 1 is ideal — the matrix is well-conditioned. Orthogonal matrices have the
best possible 2-norm condition number, exactly 1. Values up to a few hundred are generally fine; values above
about 106 signal an ill-conditioned matrix where numerical results become unreliable.
What does an infinite condition number mean?
It means the matrix is singular (its determinant is zero) and cannot be inverted. The system
A·x⃗ = b⃗ then has either no solution or infinitely many solutions.
Why is the condition number always at least 1?
Because ∥A∥ · ∥A-1∥ ≥ ∥A·A-1∥ =
∥I∥ = 1 for any sub-multiplicative norm. So no matrix can have a condition number below 1.
Does the condition number depend on the norm?
Yes. Different norms give different condition numbers for the same matrix, though they are all equivalent up to
constant factors. The 2-norm (spectral) condition number, σmax/σmin, is the
most commonly quoted one.