# Given a symmetric matrix $A$, find $P$ such that $P^T A P$ is a diagonal matrix

Given $$A =\begin{pmatrix} 0 & 3 & 0 \\ 3 & 0 & 4 \\ 0 & 4 & 0\end{pmatrix}$$ find a matrix $P$ such that $P^T A P$ orthogonally diagonalizes $A$. Verify that $P^TAP$ is diagonal.

I'm not sure how to approach this problem. Any help is appreciated. Thanks!

• Presumably you should find eigenvalues and eigenvectors? – Ted Shifrin Jul 21 '16 at 17:36
• – Moo Jul 21 '16 at 17:36
• @TedShifrin: Do you have any relations to Lenoid Shifrin? :) – Hosein Rahnama Jul 21 '16 at 17:46
• @H.R. Not that I know of, although we could be distant cousins or something. Same is true of some non-mathematicians of whom I'm aware with the same patronym. – Ted Shifrin Jul 21 '16 at 17:50

You want to find the eigenvalues and eigenvectors of $A$. Since $A$ is a real symmetric matrix, the eigenvectors should be orthogonal if the eigenvalues are distinct (which it is in this case): if they were not distinct you might have to use the Gram-Schmidt procedure to make the eigenvectors orthogonal. Divide each by its length, so they are orthonormal. Then form the matrix $P$ whose columns are those orthonormal eigenvectors.
This should be easy even without calculating any eigenvalues or eigenvectors explicitly. Note that $A=5(uv^T+vu^T)$, where $u=(0,1,0)^T$ and $v=\frac15(3,0,4)^T$ are already two orthonormal vectors. So, if you take $w=\frac15(4,0,-3)^T$, then $Q=(u,v,w)$ is real orthogonal and $$A=5Q\pmatrix{0&1\\ 1&0\\ &&0}Q^T.$$ Thus the problem boils down to the orthogonal diagonalisation of $\pmatrix{0&1\\ 1&0}$. Yet this $2\times2$ matrix geometrically represents the reflection about the line $x=y$. So, it is immediate that $$A=5Q\pmatrix{\frac1{\sqrt{2}}&\frac1{\sqrt{2}}\\ \frac1{\sqrt{2}}&-\frac1{\sqrt{2}}\\ &&1}\pmatrix{1\\ &-1\\ &&0}\pmatrix{\frac1{\sqrt{2}}&\frac1{\sqrt{2}}\\ \frac1{\sqrt{2}}&-\frac1{\sqrt{2}}\\ &&1}Q^T.$$ Absorb the factor $5$ into the diagonal matrix in the middle, you are done.