Problem: Let $f: \mathbf{R}^{2} \times \mathbf{R}^{2} \mapsto \mathbf{R}$ denote a symmetric bi-linear form. Let $g \in M a t_{2}(\mathbf{R})$ satisfy $f(g u, g v)=f(u, v)$ for all $u, v \in \mathbf{R}^{2}$. What are the possible values for $\operatorname{det} g$ ?
Official solution:
Write $f(u, v)=u^{t} A v$ and $A$ is symmetric. Then $f(g u, g v)=f(u, v)$ implies $u^{t} g^{t} A g v=u^{t} A v$ for all $u, v \in \mathbf{R}^{2}$. This last equation holds for all $u, v \in \mathbf{R}^{2}$ if and only if $g^{t} A g=A$. Since $A$ is symmetric, there is an invertible matrix $P$ such that $A=P^{t} D P$ and where $D=\pm I$ or $D=\left(\begin{array}{cc}\pm 1 & \\ & 0\end{array}\right)$. In both cases, plugging this into the equality $g^{t} A g=A$, we obtain $g^{t} P^{t} D P g=P^{t} D P$, or $\left(P g P^{-1}\right)^{t} D\left(P g P^{-1}\right)=D .$ Let $h=P g P^{-1} .$ Then $h^{t} D h=D$ and $\operatorname{det} g=\operatorname{det} h .$ If $D=\pm I$, then $h^{t} D h=D$ is the same as $h^{t} h=I$ and $h$ is orthogonal. Hence $\operatorname{det} g=\operatorname{det} h=\pm 1 .$ If $D=\left(\begin{array}{cc}\pm 1 & \\ & 0\end{array}\right)$ and $h=\left(\begin{array}{ll}a & b \\ c & d\end{array}\right)$, then $h^{t} D h=D$ is equivalent to $\left(\begin{array}{ll}a^{2} & a b \\ a b & b^{2}\end{array}\right)=\left(\begin{array}{ll}1 & 0 \\ 0 & 0\end{array}\right)$. Thus $a=\pm 1$ and $b=0$, and $h=\left(\begin{array}{cc}\pm 1 & 0 \\ c & d\end{array}\right)$. This implies that in this case $\operatorname{det} g$ can obtain any value.
Question:
I understood everything until the part where it says " $ D=\pm I $ or $ D=\left(\begin{array}{cc}\pm 1 & \\ & 0\end{array}\right) $ " and thus my question is how did they arrive to this conclusion? I know $ D=\left(\begin{array}{cc} \lambda_1 & \\ & \lambda_2 \end{array}\right) $ where $ \lambda_1,\lambda_2 $ are the eigenvalues of $ A $ including multiplicity, but how they they arrive to the fact that $ \lambda_1, \lambda_2 = \pm 1 $ or $\lambda_1 = \pm 1 , \lambda_2 = 0 $ ?
Note: There's exactly the same problem here Symmetric bilinear and determinant but there's no relation to the question I've asked.
Edit: I think in the solution, one can put the values $ -1 , 0 ,1 $ in $ D $ since the values can be normalized by dividing the row and column by the root of the absolute value of the element on the diagonal. In fact one does not need it here since one can use every possible diagonal form of $ A $, as long as $ A $ is non-invertible. So according to what is written, $ A $ can even be the zero matrix and then every $ g $ satisfies the requirement.
Thanks in advance for help!