Hi, All, If I have a symmetric matrix, how can I get the negative square root of the matrx, ie. X^(-1/2) ? Thanks, Cindy [[alternative HTML version deleted]]
> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On > Behalf Of cindy Guo > Sent: Monday, August 10, 2009 2:32 PM > To: r-help at r-project.org > Subject: [R] matrix power > > Hi, All, > > If I have a symmetric matrix, how can I get the negative square root of the > matrx, ie. X^(-1/2) ? > > Thanks, > > Cindy >Cindy, Just to be sure we are all on the same page. Are saying you have a matrix X, and you want to find the a matrix A such that X = A %*% A And you want to then find the matrix inverse of A ? Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204
On 10-Aug-09 21:31:30, cindy Guo wrote:> Hi, All, > If I have a symmetric matrix, how can I get the negative square root > of the matrx, ie. X^(-1/2) ? > > Thanks, > > CindyX <- matrix(c(2,1,1,2),nrow=2) X # [,1] [,2] # [1,] 2 1 # [2,] 1 2 E <- eigen(X) V <- E$values Q <- E$vectors Y <- Q%*%diag(1/sqrt(V))%*%t(Q) Y # [,1] [,2] # [1,] 0.7886751 -0.2113249 # [2,] -0.2113249 0.7886751 solve(Y%*%Y) ## i.e. find its inverse # [,1] [,2] # [1,] 2 1 # [2,] 1 2 Hence (Y%*%Y)^(-1) = X, or Y = X^(-1/2) Hopingb this helps, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 10-Aug-09 Time: 22:53:25 ------------------------------ XFMail ------------------------------