Let $T: P_3 \rightarrow P_3$ be the transformation $T(f)=5 \operatorname{proj}_v(f) -2f$ where $V$ is a subspace spanned by the vectors $1 + 2t+t^2$ and $t +t^2+ 3t^3$.
The inner product on the vector space $P_{3}$ is defined as: $\textit{f} \cdot \textit{g} =\int_{-1}^1 fg \,dt$
a) determine a matrix representation (D) for the transofmration S relative to a basis $\beta$ of eigenvalues
b) is the transformation $T$ orthogonally diagonalisable?
I solved a) by choosing a basis $\beta=\{f_1, f_2, g_1, g_2\}$ where $f_1, f_2$ form a basis for $V$ and $g_1, g_2$ form a basis for the orthogonal complement of $V.$ However, I don't know how to reason on b). The solution says that it is orthogonally diagonalisable because you can choose a ON-basis for $V$ and an ON-basis for the orthogonal complement of $V$, thus forming an ON-basis of eigenvectors for $P_3$.
How do I know that I can form an ON-basis for the two subspaces and why is that sufficent to show that $T$ is orthogonally diagonalisable? Can't an ON basis be formed for all subspaces using the Gram-Schmidt process, thus you can find an ON-basis for all eigenspaces, which then would imply that all matrices are orthogonally diagonalisable which is not the case. Any help would be greatly appreciated!
The answer to a) is $$D= \begin{bmatrix} 3 & 0 & 0 & 0\\ 0 & 3 & 0 & 0\\ 0 & 0 & -2 & 0\\ 0 & 0 & 0 & -2\\ \end{bmatrix}$$
If you apply Gramm-Schmidt to $\{f_1,f_2\}$, you will get a set $\{h_1,h_2\}$ of two orthonormal elements of $V$. Besides, $T(h_1)=3h_1$ and $T(h_2)=3h_2$. And if you apply Gramm-Schmidt to $\{g_1,g_2\}$, you will get a set $\{h_3,h_4\}$ of other two orthonormal elements of $V$. Besides, $T(h_3)=-2h_3$, $T(h_4)=-2h_4$, and, since $h_1,h_2\in V$ and $h_3,h_4\in V^\perp$, the set $\{h_1,h_2,h_3,h_4\}$ is also orthonormal. Finaly, the matrix of $T$ with respect to the basis $\{h_1,h_2,h_3,h_4\}$ as the one that you got.