Orthogonally diagonalize matrix?

Find matrix P that orthogonally diagonalizes C. $$C= \begin{pmatrix} 1&2&0\\2&1&0\\ 0&0&5\\ \end{pmatrix}$$

I have worked through this problem by taking the eigenvectors and then normalizing the answer. The answer I get is

$$P= \begin{pmatrix} -1/\sqrt2&1/\sqrt2&0\\1/\sqrt2&1/\sqrt2&0\\ 0&0&1\\ \end{pmatrix}$$

My book though gives the following answer of

$$P= \begin{pmatrix} 1/\sqrt2&1/\sqrt2&0\\1/\sqrt2&-1/\sqrt2&0\\ 0&0&1\\ \end{pmatrix}$$

The eigenvalues I got were $$5,3,$$and $$-1$$. The eigenvectors and normalization I got were $$(0,0,1)=(0,0,1)$$ $$(1,1,0)=(1/\sqrt2,1/\sqrt2,0)$$ and $$(-1,1,0)=(-1/\sqrt2,1/\sqrt2,0)$$.

Which one is correct?, if any.

• Why not compute $P^{-1}CP$ for both choices of $P$ to see what you get? Aug 5 at 20:45
• I get the same answer for both, the original matrix. Aug 5 at 20:51
• Why have you chosen to order your basis as $\{(0,0,1),(1,1,0),(-1,1,0)\}$ (well, the ON basis of this) and not any of the other ways? Would that change your matrix $P$? How? And does the ordering of the basis affect if $P$ can orthogonally diagonalise $C$? Aug 5 at 20:52
• Diagonalizing matrices are not unique, since you can modify the basis you want to get another basis (e.g., multiplying an eigenvector by $1$ or $-1$ will not change orthonormality). Here, it's a matter of the order in which you put the eigenvectors, and possibly multiplying an eigenvector by $-1$. Aug 5 at 20:53
• I’m not quite sure how the textbook got the y value to be negative and not the x-value.Unless they did multiply the eigenvector by -1, which seems unnecessary. Aug 5 at 20:56