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, > > Cindy
X <- 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.hard...@manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 10-Aug-09 Time: 22:53:25 ------------------------------ XFMail ------------------------------ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.