2 perceptual is a real word

This is far too long for a comment. From a pantload of experience finding explicit rational congruences, I can suggest that this problem could be decided by actual formulas. In any case finding some specific matrices ought to be instructive. My difficulty is that the numbers have passed what I can manage with my C++ programs ( I do not have n=12 explicit), plus I never wrote anything for 4 by 4 or larger.

Well, if we multiply both sides of a rational congruence by the square of the LCM $k$ of the "denominators" we get an integral "congruence" $$P^t A P = k^2 B.$$ where $P$ is integral. For $n=4,$ where $A$ is diag(1) and $B$ is diag(4) we just get $k=2$ and $P$ is diag(2).

For $n=6,$ with $A= diag(1,15)$ and $B=diag(6,10)$ we get $k=2$ and
$$P \; \; = \; \; \left( \begin{array}{cc} 3 & 5\\ -1 & 1 \end{array} \right) .$$

For $n=8,$ with $A= diag(1,28)$ and $B=diag(8,56)$ we get $k=2$ and
$$P \; \; = \; \; \left( \begin{array}{cc} 2 & 14\\ -1 & 1 \end{array} \right) .$$

For $n=10,$ with $A= diag(1,45,210)$ and $B=diag(10,120,126)$ we get $k=7$ and
$$P \; \; = \; \; \left( \begin{array}{ccc} 10 & 30 & -63\\ 2 & 6 & 7 \\ 1 & -4 & 0 \end{array} \right) .$$

The bad news for me is that $n=12$ began to run into bounds on my C++ program. So I wanted to show others how to find these matrices in computer languages with unbounded integers. The main things are that you should assume that, while there will be infinitely many possible "denominators" $k$ that work, both for computational and perceptional perceptual purposes it is worth investigating the smallest values $k= 1,2,3,\ldots$ first. Next, given a value $k,$ we do not attempt to vary all $n^2$ elements in the matrix $P.$ This is computationally infeasible. Instead, make a list of possible column 1's, then a list of possible column 2's, and so on. Once the $n$ lists of columns are complete, do what probably amounts to what they call "backtracking," meaning that you pick a column 1 ( meaning $c_1^t \; A \; c_1 = k^2 B_{11}$), then a column 2, if those are compatible so far ($c_2^t \; A \; c_1 = 0$) then pick a column 3, and so on.

As $A$ and $B$ are diagonal we automatically get multiple copies of essentially the same matrices with the only change being $\pm$ signs. But I am really impressed that there has been essentially one matrix $P$ for each $k.$ This tells me that there may be predictable patterns in the triple $(n,k,P),$ different for $n \equiv 0,2 \pmod 4$ but perhaps related in some way all the same.

1

This is far too long for a comment. From a pantload of experience finding explicit rational congruences, I can suggest that this problem could be decided by actual formulas. In any case finding some specific matrices ought to be instructive. My difficulty is that the numbers have passed what I can manage with my C++ programs ( I do not have n=12 explicit), plus I never wrote anything for 4 by 4 or larger.

Well, if we multiply both sides of a rational congruence by the square of the LCM $k$ of the "denominators" we get an integral "congruence" $$P^t A P = k^2 B.$$ where $P$ is integral. For $n=4,$ where $A$ is diag(1) and $B$ is diag(4) we just get $k=2$ and $P$ is diag(2).

For $n=6,$ with $A= diag(1,15)$ and $B=diag(6,10)$ we get $k=2$ and
$$P \; \; = \; \; \left( \begin{array}{cc} 3 & 5\\ -1 & 1 \end{array} \right) .$$

For $n=8,$ with $A= diag(1,28)$ and $B=diag(8,56)$ we get $k=2$ and
$$P \; \; = \; \; \left( \begin{array}{cc} 2 & 14\\ -1 & 1 \end{array} \right) .$$

For $n=10,$ with $A= diag(1,45,210)$ and $B=diag(10,120,126)$ we get $k=7$ and
$$P \; \; = \; \; \left( \begin{array}{ccc} 10 & 30 & -63\\ 2 & 6 & 7 \\ 1 & -4 & 0 \end{array} \right) .$$

The bad news for me is that $n=12$ began to run into bounds on my C++ program. So I wanted to show others how to find these matrices in computer languages with unbounded integers. The main things are that you should assume that, while there will be infinitely many possible "denominators" $k$ that work, both for computational and perceptional purposes it is worth investigating the smallest values $k= 1,2,3,\ldots$ first. Next, given a value $k,$ we do not attempt to vary all $n^2$ elements in the matrix $P.$ This is computationally infeasible. Instead, make a list of possible column 1's, then a list of possible column 2's, and so on. Once the $n$ lists of columns are complete, do what probably amounts to what they call "backtracking," meaning that you pick a column 1 ( meaning $c_1^t \; A \; c_1 = k^2 B_{11}$), then a column 2, if those are compatible so far ($c_2^t \; A \; c_1 = 0$) then pick a column 3, and so on.

As $A$ and $B$ are diagonal we automatically get multiple copies of essentially the same matrices with the only change being $\pm$ signs. But I am really impressed that there has been essentially one matrix $P$ for each $k.$ This tells me that there may be predictable patterns in the triple $(n,k,P),$ different for $n \equiv 0,2 \pmod 4$ but perhaps related in some way all the same.