# Diagonalization of a quadratic form in integers

Hello,

Recently I've been studying the problem of quadratic form diagonalization. Suppose that we have a form $F(x,y,z)$ with corresponding symmetric matrix $M$. This form is equivalent to another form $F'(x',y',z')$ which is in Smith normal form. The matrix that corresponds to $F'$ is $M'$ and it is diagonal. Note that both $F$ and $F'$ have integral coefficients. It is known that there exist two matrices $A$ and $B$ (which coefficients are integers as well) such that $M' = AMB$.

Now, do I understand correctly that $F$ and $F'$ represent exactly the same set of integers? If so, am I right that there must exist a change of variables of the form

$$x = a_{11}x' + a_{12}y' + a_{13} z'$$ $$y = a_{21}x' + a_{22}y' + a_{23} z'$$ $$z = a_{31}x' + a_{32}y' + a_{33} z'$$

that transforms $F$ into $F'$? Finally, is it possible to deduce the matrix $(a_{ij})$ given $M'$, $M$, $A$ and $B$?

P.S. Here's an example. I have the following matrix $M$ of determinant 1:

$$5, 13, 1$$

$$13, 34, 0$$

$$1, 0, 35$$

It corresponds to $M' = I$ where $I$ is an identity matrix. The Sage command M.smith_form() produced the following $A$:

$$0, 0, 1$$ $$0, 1, 0$$

$$1, 0, 0$$

and $B$:

$$-34, -455, 1190$$ $$13, 174, -455$$ $$1, 13, -34$$

Now I need to find $(a_{ij})$.

• Here's an example: $M = [5, 13, 1, 13, 34, 0, 1, 0, 35]$. It is equivalent to $M' = [1, 0, 0, 0, 1, 0, 0, 0, 1]$. In Sage the command M.smith_form() produces the following $A$ and $B$: $A = [0, 0, 1, 0, 1, 0, 0, 0, 1]$, $B = [-34, -455, 1190, 13, 174, -455, 1, 13, -34]$. Now I need to find the corresponding matrix $(a_{ij})$. – Anton Aug 9 '12 at 10:34

## 1 Answer

The actual correct manipulation is $$\left( \begin{array}{rrr} 3 & -1 & 0 \\\ -5 & 2 & 0 \\\ -34 & 13 & 1 \end{array} \right) \cdot \left( \begin{array}{rrr} 5 & 13 & 1 \\\ 13 & 34 & 0 \\\ 1 & 0 & 35 \end{array} \right) \cdot \left( \begin{array}{rrr} 3 & -5 & -34 \\\ -1 & 2 & 13 \\\ 0 & 0 & 1 \end{array} \right) = \left( \begin{array}{rrr} 1 & 0 & 0 \\\ 0 & 1 & 0 \\\ 0 & 0 & 1 \end{array} \right)$$

Taking the sign for transpose as an apostrophe, we evaluate a quadratic form with symmetric matrix $A$ at a column vector $x$ as $$x' A x.$$ We change from one symmetric matrix to another by taking a matrix $P$ of determinant $1$ and finding $P' A P,$ as I do above. This is called an equivalence. Typically, for dimension $3$ or higher, most authors allow $\det P = \pm 1.$

There is no guarantee that a for diagonalizes over the integers. There is also no guarantee of diagonalization over $\mathbb Q,$ as there may be the necessity for a few terms of type $xy$ or $x^2 + xy+y^2$ in $\mathbb Z_2,$ the $2$-adic integers.

I'm not entirely sure what to recommend, but Rational Quadratic Forms by Cassels is an inexpensive Dover reprint.

• OK, $x$ definitely reveals $(a_{ij})$, since in that case $B^{T} = A$. Which algorithm did you use to find $x$? – Anton Aug 10 '12 at 11:02
• @Anton, using my symbols, in $P' A P = I,$ I have a large number of programs in C++ for manipulating positive integral forms in 3 variables. A few for indefinite forms, then just one in Magma for computing genera. Maybe you should email me, I have a collection of notes, currently about 100 pages, that explains a good deal, while sticking to the language of matrices and quadratic forms. Click on my profile (my name) for instructions to find my two main email addresses. Very good bibliography as well. – Will Jagy Aug 10 '12 at 20:01
• @Anton, the 100-page item is a pdf from Latex. – Will Jagy Aug 10 '12 at 20:17