reasons for a non-invertible matrix

I am trying to factor analyze a matrix in R and I keep getting errors that lead me to believe my matrix is non-invertible. What are the reasons a matrix could be non-invertible? The only one I found was if the matrix contains a row or column of all 0's (which my matrix does not).

If needed the error I get (in R) is:

Error in solve.default(cv) :
Lapack routine dgesv: system is exactly singular: U[254,254] = 0

• You will have some column being a linear combination of other columns. There's a variety of ways that can happen. You don't give enough detail for us to say much more. – Glen_b May 17 '15 at 3:33

A square matrix is non-invertible (singular) if the number of columns are greater than the number of linear independent rows. There are ways around this depending on what you are doing, see pseudo inverse.

In other words for a square matrix A, there exists at least one column vector (or row vector) that can be written as a linear function of the other columns or rows respectfully. This is trivial for a vector of all 0's.

For an example of why the inverse can't exist, let's consider a trivial example, $A = \left[\begin{array}{cc} a & b \\ c & d \end{array}\right]$ if we follow the $2\times 2$ inverse formula then $A^{-1} = \frac{1}{ad - bc} \left[\begin{array}{cc} d & -b \\ -c & a \end{array}\right]$. Unfortunately if the column vectors $(a c) = \alpha (b d)$ then the denominator of the scalar for the inverse formula is 0, making the inverse non-finite.

For computational purposes a matrix can also be 'computationally singular' where the precision of the discrete representation on the computer isn't sufficient to calculate the inverse.

One way to check the number of linear independent columns in $R$ (but not necessarily know what they are) is through just looking at the eigenvalues. The number of non-zero eigenvalues will determine the 'rank' of the matrix, where the rank is the number of linearly independent columns or rows for square matrices. This can be done with:

 #for matrix A
eigen(A)\$values


So that your matrix to be invertible, its determinant must be nonzero.

So, if you have a matrice containing a row or column of 0's, logically its determinant will be zero and it can't be inversible...;-)