Consider the symmetric matrix $ A=\left[\begin{matrix} 1 & -1 & 3\\ -1 & 2 & 1 \\ 3 & 1 & 1 \end {matrix}\right]$.
Since it is symmetric, there exists an orthogonal matrix $P$ and $D_1$=$\left[\begin{matrix} -\sqrt{6} & 0 & 0\\ 0 & 4 & 0 \\ 0 & 0 & \sqrt{6} \end {matrix}\right]$ such that$$D_1=P^{-1}AP=P^{t}AP.$$
However, when consider the case when A is congruent to $D_2$, $D_2=\left[\begin{matrix} 1 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & -24 \end {matrix}\right]$, and $Q=\left[\begin{matrix} 1 & 1 & -7\\ 0 & 1 & -4 \\ 0 & 0 & 1 \end {matrix}\right]$ we have that $$A=Q^{t}D_2Q.$$
So, $D_1$ doesn't equal to $D_2$.
My question is what is the missing point so that this weird thing happened. Thank you!
Congruency is different from similarity in that the former does not preserve the eigenvalues, but it does preserves the sign of them.
Example: $$ \begin{bmatrix} 1 & 0 \\ 0 & 2 \end{bmatrix}, \quad \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} $$ you could clearly give a congruence between these matrices.