Can I implement the Jacobi and Gauss-Seidel method,at a matrix, even if its determinant equals to zero?
I use Matlab and want to find the convergence of the method for the Hilbert matrix. I wanted to find its determinant and it equals to zero. Why is it like that? Isn't it wrong? Or shouldn't the determinant be nonzero to implement these methods?
Does it have to do with the precision of Matlab or is there anywhere else a problem?
I'm not an expert, but since nobody else is answering I'll give it a try. Feel free to correct me if I'm writing something wrong.
You are trying to numerically solve a linear system of equations, $A x = b$, where $A$ is a Hilbert matrix, using the Jacobi / Gauss-Seidel method(s). The Jacobi method is guaranteed to converge if $A$ is diagonally dominant, which not the case for Hilbert matrices. The Gauss–Seidel method is guaranteed to converge if $A$ is diagonally dominant or positive definite, and the latter is the case for Hilbert matrices, so in principle it should be possible to use the Gauss–Seidel method.
However, even though Hilbert matrices are positive definite, the determinant goes quickly to zero for increasing $n$, and the condition number grows as $\mathrm O ((1+\sqrt2)^{4n} / \sqrt n)$, so that for $n = 250$ it is of the order $10^{380}$. For larger $n$, Hilbert matrices are increasingly ill-conditioned, which means that numerical algorithms applied to them are increasingly unstable. Moreover, according to this answer on math overflow, the Gauss–Seidel method is not to be recommended as a numerical algorithm in itself.
This means that though in principle it should be possible to solve a linear system of equations defined by a Hilbert matrix using the Gauss–Seidel method, practically it is bound to fail, which is what you have experienced when you found that
det(hilb(250))evaluates to 0 in Matlab due to limited numerical precision.