Finding the condition number of a matrix $A$, and the values of b such that $A$ is ill-conditioned

condition numbernormed-spacesnumerical methods

Let $A=\begin{pmatrix} 1 & b \\ 0 & 1\\\end{pmatrix}$, what is the condition number of A, for which values of b the matrix A is ill-conditioned.

My trial:
Since it does not specify in which norm to calculate the cond number, therefore I computed it for the $l^1, l^{\infty}, l^2$ norms, using the formula :
$cond(A)= ||A|| ||A^{-1}||$.

I got

For $l^1$ $cond_1(A)= (1+|a|)^2$

For $l^{\infty}$ $cond_{\infty}(A)= (1+|a|)^2$

For $l^2$ $cond_2(A)\leq (2+a^2)$

And the

I don't know if this is what I shoud compute, or there are more options that I shoud consider.

For the second part, i am not sure about it but I think that the matrix would be ill-conditioned when it has a big or large condition number so it happens for big values of b.

Can you correct me, or give any tips.

Best Answer

You computed correctly $K_1(A)$ and $K_{\infty}(A)$.

Try to solve $A x=c$ when $c=[1,1]$ and then compute it for a perturbed r.h.s. $\tilde{c} = c + \delta c$. The key thing point in this case is that $$\frac{||\delta x||}{||x||} \leq K(A) \frac{||\delta c||}{||c||}$$ i.e. the condition number is a magnification factor for the relative error. Note also that it's not so important in this case which norm you use to compute $K(A)$.

  • For $b=2 \cdot 10^{6}$ you obtain $x=[-1999999,1]$ to be the exact solution.

  • Let's perturb of the r.h.s. $c$ with a $\delta c$ s.t. $||\delta c||=10^{-3}$: the solution is

$$\tilde{x} =x + \delta x=[-2.001998999000000\cdot 10^{6},1+10^{-3}]$$ where the first component is dramatically different from the first one of $x$. Thus your linear system has an high sensitivity to a small variation of the data, and this behaviour is justified by the large condition number you got in this case: $K_\infty(A)=(1+2 \cdot 10^{6})^2$.

You can try by yourself playing with the following Python snippet

    import numpy as np
    
    b = 1e6;
    A = np.array([[1,b],[0,1]])
    print("Condition number compute with linalg",np.linalg.cond(A))
    c = np.array([1,1])
    
    deltac = np.array([1e-3,1e-3]) #perturbation
    cc = c + deltac #perturbed r.h.s.
    
    x = np.linalg.solve(A,c)
    xx = np.linalg.solve(A,cc)
    
    print("Solution of original system is",x)
    print("Solution with perturbed r.h.s.",xx)
Related Question