This problem is quoted from the $3$rd year transfer exam of math major in the university.
$$\begin{align} a:=\text{real number}\\ A:= \begin{pmatrix} 0&a&2\\ 1&0&2\\ 2&2&3 \end{pmatrix} \end{align}$$
Represent the necessary and sufficient conditions for an existence of an orthogonal matrix$~P~$such that$~B:=P^{-1}AP~$is a diagonal matrix, using$~a~$
My works begin from here
$$\begin{align} \det\left(A-\lambda I\right)&=\det\begin{pmatrix}0-\lambda&a&2\\1&-\lambda&2\\2&2&3-\lambda\end{pmatrix}\\&=\det\begin{pmatrix}-\lambda&a&2\\1&-\lambda&2\\2&2&3-\lambda\end{pmatrix}{(-1)^3\over(-1)^3}\\&=-\det\begin{pmatrix}\lambda&-a&-2\\-1&\lambda&-2\\-2&-2&\lambda-3\end{pmatrix}\\ &=-\left\{\lambda^2(\lambda-3)-4a-4-4\lambda-4\lambda-a(\lambda-3)\right\}\\&=-\left\{\lambda^2(\lambda-3)-4a-4-8\lambda-a\lambda+3a\right\}\\&=-\left\{\lambda^3-3\lambda^2-(a+8)\lambda-(a+4)\right\} \end{align}$$
$$ \color{red}{\left(\lambda^3-3\lambda^2-(a+8)\lambda-(a+4)\right)=0} $$
Firstly I tried setting $~ a=-4 ~$ and obtained follwing.
$$\begin{align} \lambda^3-3\lambda^2-4\lambda&=0\\ \lambda(\lambda^2-3\lambda-4) &=0\\ \lambda(\lambda+1)(\lambda-4) &=0\\ \therefore~\lambda&=\underbrace{-1,0,4}_{\text{eigenvalues} } \end{align}$$
$$ \begin{pmatrix}x\\y\\z\end{pmatrix}=\underbrace{\alpha\begin{pmatrix}-2\\0\\1\end{pmatrix},~\beta\begin{pmatrix}-2\\1/2\\1\end{pmatrix},~\gamma\begin{pmatrix}0\\1/2\\1\end{pmatrix}}_{\text{eigenvectors where}~(\alpha,\beta,\gamma)~\neq(0,0,0) } $$
BTW I don't know which of these $~ \alpha,\beta,\gamma~\not\in\mathbb{R}\setminus\{0\}~$ or $~ \alpha,\beta,\gamma~\not\in\mathbb{C}\setminus\{0\}~$ should I write.
And I checked that the following matrix $~P~$makes $~P^{-1}AP~$ a diagonal matrix.
$$ \begin{align} P&=\underbrace{\begin{pmatrix} -2 & -2 & 0 \\ 0 & 1/2 & 1/2 \\ 1 & 1 & 1 \end{pmatrix}}_{\text{Arranged the eigenvectors} } \\ P^{-1}&=\begin{pmatrix} 0 & -2 & 1 \\ -1/2 & 2 & -1 \\ 1/2 & 0 & 1 \end{pmatrix} \end{align} $$
So it can be concluded that putting $~a=-4~$is one of the sufficient condition(s) for the problem statement.
I am anxious about that there might be more possible value(s) of $~a~$ which makes a diagonal matrix, using the red equation. How can I verify it?
Moreover, how can I assess the necessary condition(s)? I've thought the following but cannot proceed from it.
$$ \begin{align} \begin{pmatrix} s & 0 & 0 \\ 0 & t & 0 \\ 0 & 0 & u \end{pmatrix}:&=P^{-1}AP\\Q:&=P^{-1}\\ \begin{pmatrix} s & 0 & 0 \\ 0 & t & 0 \\ 0 & 0 & u \end{pmatrix}&=QAP\\ &=\begin{pmatrix} q_{11} & q_{12} & q_{13}\\ q_{21} & q_{22} & q_{23}\\ q_{31} & q_{32} & q_{33}\\ \end{pmatrix} \begin{pmatrix} 0&a&2\\ 1&0&2\\ 2&2&3 \end{pmatrix} \begin{pmatrix} p_{11} & p_{12} & p_{13}\\ p_{21} & p_{22} & p_{23}\\ p_{31} & p_{32} & p_{33}\\ \end{pmatrix}\\&= \underbrace{\begin{pmatrix} q_{12}+2q_{13} &a\cdot q_{11}+2 q_{13} & 2 (q_{11}+q_{12})+3q_{13}\\ q_{22}+2q_{23}&a\cdot q_{21}+2 q_{23} & 2 (q_{21}+q_{22})+3q_{23}\\ q_{32}+2q_{33}&a\cdot q_{31}+2 q_{33} & 2 (q_{31}+q_{32})+3q_{33}\\ \end{pmatrix} \begin{pmatrix} p_{11} & p_{12} & p_{13}\\ p_{21} & p_{22} & p_{23}\\ p_{31} & p_{32} & p_{33}\\ \end{pmatrix}}_{\text{Seems too complicated for an exam's problem.} } \end{align} $$
A real square matrix is orthogonally diagonalisable if and only if it is symmetric. So the answer is: $a=1$.