# Re: [R] B %*% t(B) = R , then solve for B

From: Shawn Koppenhoefer <shawn.koppenhoefer_at_epfl.ch>
Date: Tue, 12 Apr 2011 17:37:27 +0200

BTW,
The same solution can be found using SVD (Singular Value Decomposition)

example,

## Define the matrix that we want to decompose into the product of a matrix and its transform
M<-matrix(c(0.6098601, 0.2557882, 0.1857773,

```             0.2557882,  0.5127065,  -0.1384238,
0.1857773, -0.1384238,   0.9351089 ),
nrow=3, ncol=3, byrow=TRUE)

```

## Compute the singular-value decomposition, and construct F from its pieces SVD=svd(M, nu=3, nv=3)

```U=SVD\$u
D=diag(SVD\$d)
V=SVD\$v
```

U %*% D %*% t(V)
F = U %*% sqrt(diag(SVD\$d))

## Test to see of the product of F with its transpose is equal to M F %*% t(F) #

[,1] [,2] [,3]

```[1,] 0.6098601  0.2557882  0.1857773
[2,] 0.2557882  0.5127065 -0.1384238
[3,] 0.1857773 -0.1384238  0.9351089

```

/Shawn

p.s.
HOWEVER I would still like to find a solution that gives me a diagonal matrix for F.
For example, I would like this result:,

> F

[,1] [,2] [,3]

```    [1,] 0.781  0.000 0.000
[2,] 0.328  0.637 0.000
[3,] 0.238 -0.341 0.873

[[alternative HTML version deleted]]

______________________________________________
```
R-help_at_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. Received on Tue 12 Apr 2011 - 16:15:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 12 Apr 2011 - 16:40:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.