# Why do we use the diagonal matrix when executing a rotation that has to align with the coordinate axis

I have the following problem:

Turn the equation $$5x^2 + 8xy + 5y^2 = 9$$ into its canonical form

This equation has the following image:

My aim is to rotate the ellipse, so that its axis get alligned with the axis of the coordinate system. The end result should look like this:

We turn the equation into a matrix form as follows:

$$x^TAx−9=0$$

$$A=\begin{pmatrix}5&4\\4&5\end{pmatrix}$$

Here we would like to rotate the ellipse, so we should substitute A with an another matrix. I see that the algorithm includes finding the diagonal matrix, which is the proper linear transformation we are looking for.

However, I do not get why the diagonal matrix is the exact matrix we are looking for.

If we use another similarity transformation than the diagonalization one, then we will get mixed terms (I.e. $$a \cdot xy$$) and it is in general pretty difficult (relative to one without mixed terms) to determine which conic section we're dealing with when mixed terms are involved.
Moreover, we can orthogonalize the similarity matrix $$Q$$ used to diagonalize $$A$$, using e.g. the Gram Schmidt process, which makes the transformation a lot easier to interpret. Because orthogonal matrices correspond to a rotation/reflection transformation.