Matrix is singular to working precision

$\begingroup$

I have a problem while evaluating inverse using inv in MATLAB. My matrix looks like this:

term1 = 29929 29756 29929 0 29756 29756 29756 29584 29756 0 29584 29584 29929 29756 29929 0 29756 29756 0 0 0 0 0 0 29756 29584 29756 0 29584 29584 29756 29584 29756 0 29584 29584

when i try to calculate inverse, MATLAB throws a warning Matrix is singular to working precision and the result is:

ans = Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf

Can anyone tell me why this is happening and any ways to resolve it and get the correct result?

$\endgroup$ 6

2 Answers

$\begingroup$

Not only is the fourth row (resp. fourth column) identically zero, the last two rows (resp. last two columns) are exact copies of the second row (resp. second column). Also the first and third rows (resp. columns) are equal. Any one of these duplications would make the matrix singular (rank deficient).

This also informs what systems $Ax = b$ can be solved. For example, the fourth component of $b$ must be zero, and the last two components must be the same as $b$'s second component in order for a solution to exist (and similar remarks can be made about the nonuniqueness of solutions when they do exist).

Since the matrix is real symmetric, one might approach such cases by orthogonal diagonalization. As the matrix entries are exact integers, another approach would be the Smith normal form. Either transformation would reveal the singularity of the matrix with more detail than the failed Matlab inversion.

$\endgroup$ $\begingroup$

As described in the comments:

The issue is not matlab related, the matrix is really singular (As are all matrices that contain a zero row or column).

If you need some kind of inverse, you can try the pseudo inverse with pinv

If you need to solve equations you can use the backslash operator as such: x=A∖b

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like