Reputation: 35
I want to solve a linear equation A*x=b with
A<-matrix(c(1,4,9,5,2,3,8,4,3,2,7,3,4,1,6,2),4,4)
b<-c(2,0,7,9)
If I then use the solve() function it shows an error:
solve(A,b)
Error in solve.default(A, b) :
system is computationally singular: reciprocal condition number = 1.06241e-18
Is there any fault in my approach or is this linear equation not possible to solve?
Upvotes: 0
Views: 58
Reputation: 84529
There are some linear relationships between the columns of A
:
> A <- matrix(c(1,4,9,5,2,3,8,4,3,2,7,3,4,1,6,2),4,4)
> # linear relationship between columnds 2,4,3:
> A[,2] + A[,4]
[1] 6 4 14 6
> 2 * A[,3]
[1] 6 4 14 6
> # linear relationship between columnds 1,3,2:
> A[,1] + A[,3]
[1] 4 6 16 8
> 2 * A[,2]
[1] 4 6 16 8
Therefore, A
is not invertible.
Upvotes: 1