n=3; B=4*diag(ones(1,n))-diag(ones(1,n-1),1)-diag(ones(1,n-1),-1)
O=zeros(n)
mI=diag(ones(n,1))
A=[B,mI,O;mI,B,mI;O,mI,B]

% the general case is given in exercise 3
% i guess that's ok?
