The diagonalization of a matrix is only unique up to an ordering of the eigenvalues. What is happening here is that the Eigenvalues in dp
and d.d
are ordered differently. One easily verifies that
Simplify[SortBy[Diagonal[d.d], N] == SortBy[Diagonal[dp], N]]
Returns True
.