The MATLAB experiment below is an introduction to condition numbers.
>> % In this simple MATLAB session we illustrate what happens when
>> % we solve a system with a large condition number.
>> H = hilb(10) % a 10-by-10 Hilbert matrix
H =
Columns 1 through 7
1.0000 0.5000 0.3333 0.2500 0.2000 0.1667 0.1429
0.5000 0.3333 0.2500 0.2000 0.1667 0.1429 0.1250
0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111
0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000
0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 0.0909
0.1667 0.1429 0.1250 0.1111 0.1000 0.0909 0.0833
0.1429 0.1250 0.1111 0.1000 0.0909 0.0833 0.0769
0.1250 0.1111 0.1000 0.0909 0.0833 0.0769 0.0714
0.1111 0.1000 0.0909 0.0833 0.0769 0.0714 0.0667
0.1000 0.0909 0.0833 0.0769 0.0714 0.0667 0.0625
Columns 8 through 10
0.1250 0.1111 0.1000
0.1111 0.1000 0.0909
0.1000 0.0909 0.0833
0.0909 0.0833 0.0769
0.0833 0.0769 0.0714
0.0769 0.0714 0.0667
0.0714 0.0667 0.0625
0.0667 0.0625 0.0588
0.0625 0.0588 0.0556
0.0588 0.0556 0.0526
>> cond(H)
ans =
1.6025e+13
>> x = ones(10,1) % the exact solution
x =
1
1
1
1
1
1
1
1
1
1
>> b = H*x % corresponding right-hand side vector
b =
2.9290
2.0199
1.6032
1.3468
1.1682
1.0349
0.9307
0.8467
0.7773
0.7188
>> y = H\b % computed solution
y =
1.0000
1.0000
1.0000
1.0000
0.9999
1.0003
0.9996
1.0004
0.9998
1.0000
>> norm(x-y) % compute difference
ans =
7.2339e-04
>> cond(H)*eps % predicted error from condition number
ans =
0.0036