A <- structure(c(0.30490157183014, 0.379973564544057, 0.873301277763403,
-0.893646079502174, 0.431187404805374, 0.124394961825634, 0.329289714515811,
0.81835048248589, -0.471031603747781), .Dim = c(3L, 3L))
B <- structure(c(0.149775627871975, 0.180504771175303, 0.972103538147304,
-0.636965365859095, 0.769591777715467, -0.0447617958613814, 0.756202607765634,
0.612492059749103, -0.230241379323433), .Dim = c(3L, 3L))
I have two 3x3 matrices, A
and B
. I want to compute: AA^TBB^T
.
> A %*% t(A) %*% B %*% t(B)
[,1] [,2] [,3]
[1,] 1.000000e+00 -5.551115e-17 -1.665335e-16
[2,] -5.551115e-17 1.000000e+00 -2.498002e-16
[3,] -1.942890e-16 -2.498002e-16 1.000000e+00
> (A %*% t(A)) %*% (B %*% t(B))
[,1] [,2] [,3]
[1,] 1.000000e+00 1.078521e-32 -1.665335e-16
[2,] 3.081488e-32 1.000000e+00 -2.498002e-16
[3,] -1.665335e-16 -2.498002e-16 1.000000e+00
Why are A %*% t(A) %*% B %*% t(B)
and (A %*% t(A)) %*% (B %*% t(B))
giving me different results? Is this implying that AA^TBB^T
is different from (AA^T)(BB^T)
?