Showing that two real matrices are not congruent over $\mathbb{Q}$ Maybe it is a stupid question but I will still ask it here.
How can I prove that the following matrices are not congruent over $\mathbb{Q}$?
\begin{pmatrix}
  -1 & 0\\
  0 & 2\\
  \end{pmatrix}
\begin{pmatrix}
  -1 & 0\\
  0 & 1\\
  \end{pmatrix}
Thanks in advance
 A: Fi $B=Q^TAQ$ then $\det(B)=\det(Q^T)\det(A)\det(Q)$, i.e. $\frac{\det(B)}{\det(A)}=\det^2(Q)$ must be a square.
A: If your matrices are $A$ and $B$ then you should prove whether there exists an invertible matrix $Q$ such that the equation holds:
$$Q^TAQ=B$$
For your and others convenience:
$$\left( \begin{array}{cc} q_{11}^{2}a_{11} + q_{21}^{2}a_{22} &  q_{11}q_{12}a_{11} + q_{21}q_{22}a_{22} \\ q_{11}q_{12}a_{11} + q_{21}q_{22}a_{22} & q_{12}^{2}a_{11} + q_{22}^{2}a_{22}\end{array}\right) = \left( \begin{array}{cc} b_{11} & 0 \\ 0 & b_{22} \end{array}\right).$$
Let $q_{12}=q_{21}=0$ for example and look for whether/when: $b_{jj} = a_{jj}q_{jj}^{2}$
Saw your comment: general case going deeper see here
When are two diagonal matrices congruent?
A: Hint:
Suppose that there is some invertible matrix $P$ such that:
$\begin{pmatrix}
  -1 & 0\\
  0 & 2\\
  \end{pmatrix} 
= P^T 
\begin{pmatrix}
  -1 & 0\\
  0 & 1\\
  \end{pmatrix}
P$
Then write out $P$ in component form, i.e. write $P=\begin{pmatrix}
  a & b\\
  c & d\\
  \end{pmatrix}$
(with all entries in $\mathbb{Q}$) and multiply out the right hand side. This will give you some simultaneous equations in terms of $a,b,c$ and $d$. With enough manipulation, you should be able to find a relation between $a$ and $d$ that contradicts them both being in $\mathbb{Q}$.
