4
$\begingroup$

I have a $3\times 3$ matrix which I want to diagonalize, $A$.

So I want to find the matrix $P$ such that $A=P^{-1}DP$, where $D$ is the diagonal matrix such that the eigenvalues of $A$ appear in the diagonal of $D$.

How do I find $P$ via Mathematica? Is there a suitable command?

Thanks! I checked the help section in Mathematica and didn't find such a command.

$\endgroup$
3
  • 5
    $\begingroup$ JordanDecomposition[$A$] returns $\{P^{-1},D\}$. (See DiagonalizableMatrixQ.) $\endgroup$ Jan 31, 2021 at 9:08
  • 2
    $\begingroup$ To make Sneeze's hint more explicit: unless you're absolutely sure your matrix is diagonalizable (symmetric, normal, etc.), use JordanDecomposition[]. $\endgroup$ Jan 31, 2021 at 12:30
  • 2
    $\begingroup$ Check. Documentation. For. Eigensystem. $\endgroup$ Jan 31, 2021 at 15:52

1 Answer 1

7
$\begingroup$

example:

m = {{1, 0, 0, 1}, {0, -1, 1, 0}, {0, 1, -1, 0}, {1, 0, 0, 1}};
DiagonalizableMatrixQ@m
True


{d, pt} = Eigensystem@m;
p = Transpose@pt;
p . DiagonalMatrix[d] . Inverse[p]
{{1, 0, 0, 1}, {0, -1, 1, 0}, {0, 1, -1, 0}, {1, 0, 0, 1}}


{s, j} = JordanDecomposition@m;(* returns {P^-1,D} *)
s . j . Inverse@s (* P^(-1).D.P *)
{{1, 0, 0, 1}, {0, -1, 1, 0}, {0, 1, -1, 0}, {1, 0, 0, 1}}
$\endgroup$

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