I have a 5 by 5 matrix:
t <- read.table(header=FALSE,
text=" 1 0 0 -0.0000009038 0
0 1 0 0.0000000000 0
0 0 1 0.0000000000 0
0 0 0 1.0000000000 0
0 0 0 0.0000000000 1
")
When I try to take the inverse of this matrix, I get different results with
tt <- solve(t)
and
tt <- 1/(t)
Why? Shouldn't they both work?
1/t is not the inverse of a matrix. It is rather elementwise reciprocal. Same way in math if you have a function, f(x), then 1/f(x) is not the inverse of the matrix.
Note that even in math, the inverse of a matrix is never written as 1/A
if A is a matrix.
In R. The inverse of a matrix is computed as solve(A)