# Solved – Matrices: system that is “computationally singular” versus “exactly singular”

I would like to know the mathematical concepts behind singular matrices. Matrices that do not have inverses in R throw one of two errors. I have provided some examples of both errors below:

1. ` Error in solve.default(W) :  system is computationally singular: reciprocal condition number = 1.58603e-17 `
2. ` Error in solve.default(Z) :  Lapack routine dgesv: system is exactly singular: U[2,2] = 0 `

Can anyone explain the difference between the two? Why is the first "nearly singular" whereas the second is "exactly singular"?

Contents

The condition number that is typically used in linear algebra to describe a matrix $$A$$ indicates, very roughly, how many significant digits of accuracy you can expect to lose when solving a linear system $$Ax=b$$ using infinite-point accurate arithmetic. In the first case (condition number of of $$1.58603e-17$$), the matrix is so close to singular that you are losing about 17 digits of accuracy. Double precision floats, according to the IEEE 754 standard, have about 16 digits of accuracy, so losing 17 digits means there's no accuracy left, basically. The matrix does have an inverse, but, at some point, a responsible algorithm will tell you that you are losing more accuracy than your data has rather than return a result that is almost certainly meaningless and letting subsequent calculations (including your analysis of the results) continue on unaware of this problem. That is what "computationally singular" means in this context.
The condition number is a function of the matrix $$A$$, not of the algorithms operating on $$A$$, so, for example, changing to a different linear solver won't change the condition number.