Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1. Hilbert matrices are a family of matrices that have very high conditi

ID: 3167879 • Letter: P

Question

Problem 1. Hilbert matrices are a family of matrices that have very high condition numbers. The Hilbert matrix H(n) of size n × n has matrix elements The MATLAB command to generate a Hilbert matrix of size n is hilb(n). In this problem you will use MATLAB to study the reliability of the residual and the relative residual as a predictor of the error of an approximate solution of the linear system H(11)x = b (a) In MATLAB, let A denote the Hilbert matrix H(11), and xexact stand for the ex- act solution xexact = (1 2 3 10 11)". Define the right-hand side b by typing b = A*xexact , and then let xapprox be the solution of the linear system Ax-b found by MATLAB (you can find xapprox by using the MATLAB command xapprox-A or xapprox-linsolve (A,b), no need to write your own program) (b) Find the error e-xapprox-Xexact and the residual r = Axapprox-b, and the 10-norms of b, Xexact, e, and r, as well as the relative error and the relative residual. (c) Use the MATLAB command norm to find |Alloo, IA-1loc, and k.o (A) (d) Check that the inequalities hold for the particular example in this problem. Please write a clear and detailed solution.

Explanation / Answer

MATLAB CODE:

n=11;

% It geneartes hilber matrix of size n*n. here n=11
for i=1:n
    for j=1:n
        A(i,j)=1/(i+j-1);
    end
end
xexact=[1 2 3 4 5 6 7 8 9 10 11]';
b=A*xexact; % calculating b=A*xexact
xapprox=A; % solving Axapprox=b;
e=xapprox-xexact;%calculating error
r=A*xapprox-b;%calculating residue

% l-infinity norms of b e,r ,xexact without using norm command of matlab
binf=max(sum(abs(b),2));
einf=max(sum(abs(e),2));
rinf=max(sum(abs(r),2));
xexact_inf=max(sum(abs(xexact),2));

%finding relative error =norm(error)/norm(xexact);
relative_error=norm(e)/norm(xexact);

%finding relative residual=norm(residual)/norm(b);
relative_residual=norm(r)/norm(b);

% finding infinity norm of A ,A inverse, and condition number of A using norm command of matrix
Ainf=norm(A,Inf);
Ainv_inf=norm(inv(A),Inf);
kinfA=Ainf*Ainv_inf;

Now to check both the inequalities check the components of each inequalities in MATLAB as follows

To check inequality 1:

>> rinf/Ainf

ans =

     5.882215191333868e-16

>> einf

einf =

   0.023029235587176

>> Ainv_inf*rinf

ans =

   0.723499338544802

If you observe, from above values we can say that inequality 1 is true

To check inequality 2:

>> (rinf/binf)*(1/kinfA)

ans =

     1.312926146737455e-31

>> einf/xexact_inf

ans =

   0.002093566871561

>> kinfA*(rinf/binf)

ans =

   0.198625387409563

From above we can say that inequality 2 is true

The inequalities hold true for the particular example given.

Thus we can say that residual and relative residual are reliable predictor of error of an approximate solution of the linear system H(11)x=b.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote