3
$\begingroup$

I have two 5x5 matrices:

A={{430.984, -197.898, 106.409, -212.614, -61.7758}, {-197.898, 1144.67, -397.431,
    26.8918, 122.652}, {106.409, -397.431,
      492.869, -213.863, -122.323}, {-212.614, 26.8918, -213.863,
      960.716, -292.851}, {-61.7758, 122.652, -122.323, -292.851,
      492.797}}
B={{428.257, -110.756, -147.675, -110.756, -44.3025}, {-110.756,
      904.509, -369.187, -276.891, -110.756}, {-147.675, -369.187,
      1082.95, -369.187, -147.675}, {-110.756, -276.891, -369.187,
      904.509, -110.756}, {-44.3025, -110.756, -147.675, -110.756,
      428.257}}

They are symmetric.

What is the fastest way to find the change of basis matrix $P$ that solves for $P^TAP=B$?

mX = (Array[X, {5, 5}] );

NSolve[FullSimplify[Transpose[mX].A.mX] == B, Flatten[mX]]

does not end.

$\endgroup$
1

1 Answer 1

7
$\begingroup$
a = Eigensystem[A];
b = Eigensystem[B];

P = Transpose[a[[2]]] . DiagonalMatrix[Sqrt[b[[1]]/a[[1]]]] . b[[2]];

Transpose[P] . A . P - B // Norm
(*    4.31222*10^-12    *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.