# Check equivalence of quadratic forms over finite fields

How to check whether the two quadratic forms \begin{equation} x_1^2 + x_2^2 \quad \text{(I)}\end{equation} and \begin{equation} 2x_1x_2 \quad \text{(II)} \end{equation}

are equivalent on each of the spaces $\mathbb{F}_3^2\, \text{and}\,\mathbb{F}_5^2$? I know that these forms correspond to the two matrices \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} in case (I) and \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} in case (II). But what do I do with those and what difference do the different fields make?

## 2 Answers

The characteristic of the field makes a big difference in the computations. I would start by comparing the discriminates of the two matrices.

Over both fields, the discriminants are $\pm 1$. The question is: do $\pm1$ differ by a square factor in both fields or not?

Over the field of five elements, $1\cdot 3^2\equiv -1\pmod 5$, but over the field of three elements, $a^2\equiv 1\not\equiv -1\pmod 3$ for all nonzero $a$.

After some work, you can find that the two matrices are cogredient this way: $$\begin{bmatrix}3&1\\1&3\end{bmatrix}\begin{bmatrix}1&0\\0&1\end{bmatrix}\begin{bmatrix}3&1\\1&3\end{bmatrix}=\begin{bmatrix}0&1\\1&0\end{bmatrix}$$

Here's an elementary brute force way to figure this out using just algebra. From $$\begin{bmatrix}a&b\\c&d\end{bmatrix}\begin{bmatrix}1&0\\0&1\end{bmatrix}\begin{bmatrix}a&c\\b&d\end{bmatrix}=\begin{bmatrix}a&b\\c&d\end{bmatrix}\begin{bmatrix}a&c\\b&d\end{bmatrix}=\begin{bmatrix}a^2+b^2&ac+bd\\ac+bd&c^2+d^2\end{bmatrix}=\begin{bmatrix}0&1\\1&0\end{bmatrix}$$

we have already learned that $a^2=-b^2$, $c^2=-d^2$ and $ac+bd=1$. Earlier I noted that $1$ differs from $-1$ by a factor of $3^2$, so I suppose my change of basis matrix has determinant $3$, so $ad-bc=3$.

Now

$$a= a^2c+adb\\ =-b^2c+adb\\ = b(ad-bc)\\ = 3b$$

Similarly $$c= ac^2+dcb\\ =-d^2a+dcb\\ = -d(ad-bc)\\ = -3d = 2d$$

We've consumed the two equations involving squares, and now we combine the other two.

We have that

$$1=ac+bd=6bd+bd=7bd=2bd$$

Hence, $bd=3$ or in other words $d=3/b$. At this point we have $a,c,d$ all in terms of $b$ ($a=3b$, $d=3/b$, $c=2d=1/b$).

Choosing $b=1$, we arrive at $a=d=3$, $b=c=1$.

• Thanks, that helped a lot. But how did you come up with the matrix $P = \begin{pmatrix} 1 & 3 \\ 3 & 1 \end{pmatrix}$ over $\mathbb{F}_5$? – Taufi May 17 '16 at 12:57
• @Taufi Hi: I was just in the process of explaining. It's in there now. Thanks for waiting. – rschwieb May 17 '16 at 13:09
• No, thank you for taking the time to explain the solution so thoroughly. +10 if I could – Taufi May 17 '16 at 13:13

You've wrtten the other way round. For the quadratic form $x_1^2 + x_2^2$, the corresponding matrix is the identity while that for $2x_1x_2$ is $A = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$. The forms are equivalent iff the matrices are congruent. (over $\mathbb{F}_3$ and $\mathbb{F}_5$)

So, suppose $A = P^TIP = P^TP$ over $\mathbb{F}_3$ for some invertible $P$. Then, taking determinants gives $-1 = ( \det P)^2$, which is a contradiction as $-1$ is not a quadratic residue modulo $3$.

Over $\mathbb{F}_5$, you can check that they indeed are equivalent by the matrix $P = \begin{pmatrix} 1 & 3 \\ 3 & 1 \end{pmatrix}$ as we have, $(3x_1+x_2)^2 + (x_1+3x_2)^2 = 2x_1x_2$ in $\mathbb{F}_5$.