function [ A , b, D , L , U ] = test_problem_hw5( n )

% Construct main diagonal

i=1:n;
j=1:n;
s=(-3)*ones(1,n);
D=sparse(i,j,s,n,n);

% Construct lower triangular part (first the minor diagonal, then 1st row)
i1=3:n;
j1=2:n-1;
s1=(-1)*ones(1,n-2);
i2=2:n;
j2=ones(1,n-1);
s2=(-1)*ones(1,n-1)/n;
L=sparse(i1,j1,s1,n,n)+sparse(i2,j2,s2,n,n);

% The upper triangular part is the transpose of L
U=L';

A=D-L-U;

% construct right hand side, such that the vector of all 1's is a solution
b=A*ones(n,1);

end

