I'm considering a matrix A such that A=PDP^-1.
The way I solve this using Mathematica is:
a={{0, -1}, {-1, 0}}
d = DiagonalMatrix[Eigenvalues[a]]
{{-1,0}, {0,1}}
p = Transpose[Eigenvectors[a]]
p.d.Inverse[p]
{{0, -1}, {-1, 0}}
Which is correct.
Problem is, the P matrix is not what I expected it to be. The matrix that Mathematica generates is
p={{1, -1}, {1, 1}}
But I am looking for
p2={{1/Sqrt[2], 1/Sqrt[2]}, {1/Sqrt[2], -(1/Sqrt[2])}}
p2.d.Inverse[p2]
{{0,-1}, {-1,0}}
Which also solves the equation. Is there a way for me to force Mathematica to show me different answers when executing Transpose[Eigenvectors[a]]?
What you need to do is normalize the answer you get. There is a function called Normalize, which can be used like this:
Normalize /@ {{1, -1}, {1, 1}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With