Skip to content
Back to formatted view

Raw Message

Message-ID: <30c82f5f0803021549h724fdc03r136f827a00357167@mail.gmail.com>
Date: 2008-03-02T23:49:54Z
From: Louise Hoffman
Subject: Need help to locate my mistake
In-Reply-To: <XFMail.080302210554.Ted.Harding@manchester.ac.uk>

>  Unfortunately, x^(-1) is not the inverse of x:
>
>  x<-matrix(c(2,4,4,5),nrow=2)
>  x
>  #      [,1] [,2]
>  # [1,]    2    4
>  # [2,]    4    5
>
>  x^(-1)
>  #      [,1] [,2]
>  # [1,] 0.50 0.25
>  # [2,] 0.25 0.20
>
>  i.e. it is the matrix which you get by applying the operation
>  (...)^(-1) to each element of x.
>
>  In R, the inverse of a non-singular matrix is (somewhat obscurely)
>  denoted by solve(x):
>
>  solve(x)
>  #            [,1]       [,2]
>  # [1,] -0.8333333  0.6666667
>  # [2,]  0.6666667 -0.3333333
>
>  solve(x)%*%x
>  #      [,1]         [,2]
>  # [1,]    1 1.110223e-16
>  # [2,]    0 1.000000e+00
>  (Note the slight rounding error); whereas
>
>  (x^(-1))%*%x
>  #      [,1] [,2]
>  # [1,]  2.0 3.25
>  # [2,]  1.3 2.00

Thanks for the very detailed explanation! I will never make that
mistake again =)