Show that in $M_3(\mathbb{Z}_7), \begin{pmatrix}3 & 0 & 0 \\ 0 & 3 & 0\\ 0 & 0 & 0\end{pmatrix} \cong \begin{pmatrix}1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 0\end{pmatrix}$ but $\begin{pmatrix}3 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & 0\end{pmatrix} \not\cong \begin{pmatrix}1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 0\end{pmatrix}.$
I know that to show that two matrices $A$ and $B$ are congruent, it suffices to show that for some invertible matrix $P, A = P^T B P$. However, I am unable to find such an invertible matrix, so I was wondering if it was easier to arrive at a contradiction if I assume that no such matrix exists?
To show that the given two matrices are not congruent, one way (though obviously not very generalizable) is to show that no matrix $P = \begin{pmatrix}a & b & c\\ d & e & f\\ g & h & i\end{pmatrix} \in M_3(\mathbb{Z}_7)$ can satisfy that $P^T AP = B,$ where $A = \begin{pmatrix}3 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & 0\end{pmatrix}$ and $B = \begin{pmatrix}1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 0\end{pmatrix}$ (in this case this works, but it may be harder to show this if such a matrix exists, but it just isn't invertible). One can do so by manipulating a system of equations and showing that there is never a solution (e.g. one can fix a variable $d$ and consider when $d\in \{0,1,2,3,4,5,6\}$). So I was wondering if there was an easier approach for this?
the multiplicative inverse of $3$ is $5$ because $15 \equiv 1 \pmod 7.$ While $5$ is not a square, it is the sum of two squares, namely $2^2 + 1^2.$ We want these as columns of $P,$ with the columns obviously having dot product zero, for $$ P = \left( \begin{array}{rr} 2 & -1 \\ 1 & 2 \\ \end{array} \right) $$ If the dot product of integer vectors is zero, it is also zero mod 7.
Then $$ P^T (3I) P $$ comes out nicely