Given the symmetric matrix: $$A = \left( \begin{array}{ccc} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 1 \\ \end{array} \right)$$ find an orthogonal matrix $S$ such that $S^TAS$ is a diagonal matrix.
I don't know how to do this at all. All I know is that symmetric matrices in general are diagonalizable by some orthogonal matrix. I also know that a matrix is orthogonal if its rows or columns form an orthonormal basis of, in this case, $\mathbb{R}^3$. So I tried to find the eigenvectors of A and use Gram Schmidt to orthongonalize them, but using the matrix consisting of those vectors does not result in a diagonal matrix anymore.
So how do I actually find the particular choice of S such that the property holds?
Hint: $$A = I+\left( \begin{array}{ccc} 0 & 0 & 1 \\ 0 & 0 & 0 \\ 1 & 0 & 0\\ \end{array} \right)$$and the second matrix leaves the orthogonal spaces $sp\{e_2\}, sp\{e_1,e_3\}$ invariant.