gwIsomorphic(alpha,beta)
Given two matrices representing symmetric bilinear forms over a field $k$, it is a fundamental question to ask when they are representing the same symmetric bilinear form, i.e. when they are equal in the GrothendieckWitt ring $\text{GW}(k)$.
Sylvester's Law of Inertia proves that any symmetric bilinear form can be diagonalized into a block sum of rank one symmetric bilinear forms. Since the rank one forms $\langle a \rangle \colon k \times k \to k$, $(x,y) \mapsto axy$ and $\langle ab^2 \rangle \colon k \times k \to k$, $(x,y) \mapsto ab^2xy$ differ by a change of basis in the ground field, it follows they are isomorphic (provided that $a,b\ne 0$). Thus after diagonalizing a form, it suffices to consider the square class of each entry appearing along the diagonal. Consider the following example over the complex numbers:



The two forms are isomorphic since they can be diagonalized, after which they can be rewritten as the identity matrix after a change of basis, since every nonzero element is a square class over $\mathbb{C}$ (the same is true for any quadratically closed field). Thus we have that the rank of a form completely determines it over the complex numbers. That is, it provides an isomorphism $\text{GW}(\mathbb{C}) \to \mathbb{Z}$.
Over the reals, the story is a bit different. Since there are two classes over the reals, $ \mathbb{R}^\times / \left(\mathbb{R}^\times\right)^2 \cong \left\{\pm 1\right\}$ we have a further invariant which classifies symmetric bilinear forms, called the signature. This is computed as first diagonalizing, then taking the number of positive entries appearing on the diagonal minus the number of negative entries appearing on the diagonal.


Rank and signature completely classify symmetric bilinear forms over the reals.


Over finite fields, rank is still an invariant of a form, however signature no longer makes sense as the field is not totally ordered. Instead we consider the discriminant of the nondegenerate symmetric bilinear form, which is the determinant of any Gram matrix representing the form. The discriminant is welldefined once we consider its target as landing in square classes of the field. $\text{GW}(\mathbb{F}_q) \to \mathbb{F}_q^\times / \left(\mathbb{F}_q^\times\right)^2$. Over finite fields we look to compare both rank and discriminant of a form.






We see that $\text{disc}(\alpha)$ is a square, while the discriminants of $\beta$ and $\gamma$ are not. Therefore we see that $\beta \cong \gamma$ but neither of them are isomorphic to $\alpha$.



Over the rationals, further invariants must be considered. We first check if the rank, discriminant, and signature (when considered as a real form) all agree. If so, we must further check whether the HasseWitt invariants agree at all primes. This is an instance of the HasseMinkowski principle which states that quadratic forms are isomorphic over a global field if and they are isomorphic over all its completions (see [S73, IV Theorem 7] or [L05, VI.3.3]).
The HasseWitt invariant of a diagonal form $\langle a_1,\ldots,a_n\rangle$ over a field $K$ is defined to be the product $\prod_{i<j} \left( \phi(a_i,a_j) \right)$ where $\phi \colon K \times K \to \left\{\pm 1\right\}$ is any symbol (see e.g. [MH73, III.5.4] for a definition). It is a classical result of Hilbert that over a local field of characteristic not equal to two, there is one and only symbol, $(,)_p$ called the Hilbert symbol ([S73, Chapter III]) computed as follows:
$(a,b)_p = \begin{cases} 1 & z^2 = ax^2 + by^2 \text{ has a nonzero solution in } K^3 \\ 1 & \text{otherwise.} \end{cases}$
Consider the following example, where we observe that $z^2 = 2x^2 + y^2$ does admit nonzero solutions mod 7, in particular $(x,y,z) = (1,0,3)$:

The Hasse invariant will be 1 for almost all primes. In particular after diagonalizing a form $\beta \cong \left\langle a_1,\ldots,a_n\right\rangle$ then the Hasse invariant at a prime $p$ will be 1 automatically if $p\nmid a_i$ for all $i$. Thus we only have finitely many Hasse invariants to compare for any pair of symmetric bilinear forms.



Citations:
The object gwIsomorphic is a method function.