The condition number of linear systems#
The condition number reflects how sensitive a function evaluation
With this in mind, we now compute the condition number for linear systems of equations
We consider the following two problems:
Given a fixed
, what is the local relative condition number of , defined by ?Given a fixed
, what is the local relative condition number of , defined by ?
Conveniently, both questions can be answered with the same calculation. Let
Then
To continue, we use the following lemma, whose proof is given in the optional materials. It is a direct generalisation of a well-known result for scalars (i.e.
Lemma 1 (Matrix-valued von Neumann series)
Let
with
Assuming that
where in the last step we used that
Similarly, to answer the second question, let
Therefore, both condition numbers
Fact: Condition number of linear systems
Assume that
The condition number
We do not prove this result here.
Python skills#
You can compute the condition number of a matrix using the numpy.linalg.cond
function. Here are a few examples:
import numpy as np
# Example 1: 2x2 matrix
A = np.array([[1, 1], [0, 0.01]])
cond_number = np.linalg.cond(A)
print(f"Condition number of A: {cond_number}")
# Example 2: 3x3 matrix
B = np.array([[1, 2, 3], [0, 5, 6], [7, 0, 9]])
cond_number_B = np.linalg.cond(B)
print(f"Condition number of B: {cond_number_B}")
# Example 3: Using different norms
C = np.array([[2, 3], [-1, 1]])
cond_number_C_1 = np.linalg.cond(C, 1) # 1-norm
cond_number_C_inf = np.linalg.cond(C, np.inf) # Infinity norm
cond_number_C_2 = np.linalg.cond(C, 2) # 2-norm
print(f"Condition number of C (1-norm): {cond_number_C_1}")
print(f"Condition number of C (Infinity norm): {cond_number_C_inf}")
print(f"Condition number of C (2-norm): {cond_number_C_2}")
Self-check questions#
Question
Compute the
as a function of
Answer
We have
Hence,
and
Question (Sharp condition number)
Let
Compute local relative condition number
Here
Answer
We have
To satisfy
Question (Sharp condition number)
Repeat for
Answer
We have
Question
Let
Compute
Answer
First compute
For the
Similarly,
Thus,
For the
hence
All three condition numbers coincide and equal
Question
Consider
Its eigenvalues are
Answer
Since
Recall
Hence, a relative perturbation of about
Optional material#
Proof of the convergence lemma for the matrix-valued von Neumann series
Here is the proof of the convergence lemma for matrix-valued von Neumann series.
Proof. Let
for some
We find