% m15_backwardstab.m - backward stability of QR factorisation R = .001*eye(7) + 9*triu(ones(7),1 ) % ill-conditioned upper-triang R rng(4) % fix random number seed [Q,~] = qr(randn(7)); Q % random orthogonal Q A = Q*R % product of these [Q2,R2] = qr(A); % computed QR factorisation R R2 Q Q2 A Q2*R2 norm(R2-R) % error in factor R norm(Q2-Q) % error in factor Q norm(Q2*R2-A) % error in product Q*R % Wilkinson's dictum: on a computer with rounding errors, % a stable algorithm of numerical linear algebra gives a solution % which is **the exact solution of a slightly perturbed problem**.