function B=inv_hilb(n)
% Inverse of Hilbert matrix of order n.
% Exact result, B is a matrix of integer values.
B=eye(n);
for i = 1:n
    s=-1;
    for j = i:n
        s=-s;
        B(i,j)=nchoosek(n+i-1,n-j)*nchoosek(n+j-1,n-i)*nchoosek(i+j-2,i-1)^2;
        B(i,j)=s*(i+j-1)*B(i,j);
        if i<j, B(j,i)=B(i,j); , end
    end
end
return
