# Finding the orthogonal diagonalizing similarity of a symmetric matrix

I'm aware that there are some questions similar to this here, but none that could solve my problem.

So, I have to diagonalize a symmetric symbolic matrix $m$ (to be seen below) and obtain the orthogonal transformation $P$ such that $P^TmP=D$ where $D$ is diagonal. Here is the last thing I have tried:

m = {{a*x^2, c*x*y}, {c*x*y, b*y^2}};

{vals, vecs} = Simplify[Eigensystem[m], Assumptions -> a > 0 && b > 0 && c > 0 && x \[Element] Reals && y \[Element] Reals];

vecs = Simplify[Normalize /@ vecs, Assumptions -> a > 0 && b > 0 && c > 0 && x \[Element] Reals && y \[Element] Reals];

FullSimplify[vecs.vecs\[Transpose] == IdentityMatrix[2], Assumptions -> a > 0 && b > 0 && c > 0 && x \[Element] Reals && y \[Element] Reals]


Where the last line does not return True, but rather a matrix, in the LHS, with elements different from unit in the diagonal (but, correctly, with $0$ in the off-diagonal).

Now, if it is not clear enough, I'm really new to Mathematica and would immensely appreciate any tips such as where it would be sufficient for me to include the Assumptions and to Simplify at all in a case like this (I would say that the very last FullSimplify, with the Assumptions, would be enough, but am not sure). Besides that, my problem is that the matrix $P$, or vecs\[Transpose], is not orthogonal, which because of stated facts obviously results from the fact that the eigenvectors are not normalized in the proper sense.

I have the feeling that the problem comes from some imaginary numbers not taken care of by the assumptions, but cannot quite pin it down exactly.

Now, the solution suggested in this question works perfectly and I can understand why it works, but cannot understand why the Normalize, as I used, doesn't and if there isn't a less artisanal way (than the one of the link above) of solving the problem.

## 1 Answer

This helps:

assumptions = a > 0 && b > 0 && c > 0 && x ∈ Reals && y ∈ Reals;
Simplify[vecs.vecs\[Transpose] /. Abs -> RealAbs, assumptions]]


{{1, 0}, {0, 1}}

You experience a typical issue when using symbolic compuations involving Norm and Normalize: Mathematica treats all variables as complex numbers. Thus, Abs[z]^2 does not equal z^2 which often prevents the crucial simplification step. Recently, RealAbs was added to the language and it allows this simplification:

RealAbs[z]^2 // Simplify


z^2

Yet, it is somewhat mysterious to me that your approach did not work, because your assumptions imply that all variables are real numbers...

• Thanks a lot! This is exactly what I thought was the root of the problem but couldn't understand why the assumptions would not simplify it. – GaloisFan Sep 16 '18 at 20:15
• You're welcome! – Henrik Schumacher Sep 16 '18 at 20:20