Search code examples
rmatrixmatrix-inverse

Calculate the inverse of a matrix : system is computationally singular [error]


I have a matrix m :

(m <- matrix(c(26,14,24,14,20,42,24,42,90), 3))

#      [,1] [,2] [,3]
# [1,]   26   14   24
# [2,]   14   20   42
# [3,]   24   42   90

When i run solve(m) to calculate the inverse of the matrix, i get this error message :

solve(m)

Error in solve.default(m) : system is computationally singular: reciprocal condition number = 6.21104e-18


Solution

  • The problem is the columns are not linearly independent.

    The first column * -1/3 + second column * 7/3 is equal to the third column.

    -m[, 1] * 1/3 + 7/3 * m[, 2]
    
    # [1] 24 42 90