# Fricke Klein method for isotropic ternary quadratic forms

Preface: the most natural way to take one isotropic vector for an indefinite quadratic form and find others is to use stereographic projection. This gives a parametrization in the same $n$ variables as the quadratic form. After clearing denominators, there is also not much control over the gcd of the resulting integers. So, although finding an integer multiple of every primitive solution is guaranteed, we may not be entirely sure we have found all primitive solutions with entries up to some bound in absolute value.

There is a trick for indefinite ternary forms, which leads to a parametrization by two parameters, with considerable control of the gcd's.

Most of this appears in my answers to Isotropic ternary forms

Question: is it true that the primitive integer solutions to $$A(x^2 + y^2 + z^2) - B (yz+zx+xy) =0$$ can all be parametrized by a finite number of solutions as below, in shorthand $R_j U?$ The calculations are awfully convincing, but I have proved only a few. In case anyone gets interested, i wrote out the proof for $A=2, B=113,$ about twenty four pages pdf.

Once we have integers $B > A > 0,$ a necessary and sufficient condition that the form be isotropic in $\mathbb Q,$ and therefore $\mathbb Z,$ is that both $B-A$ and $B+2A$ have integer expressions as $s^2 + 3 t^2.$

There is an interesting alternative, method goes back to Fricke and Klein, gives a two variable parametrization, and can be adjusted to deal with GCD's. There is a complete answer to this, finding all primitive solutions, meaning $\gcd(x,y,z) = 1.$

We begin with finding all primitive solutions to $y^2 - z x = 0.$ If $g = \gcd(x,z) > 1,$ then $g^2 | y^2$ and $g | y,$ so $g | \gcd(x,y,z).$ However, $\gcd(x,y,z) = 1.$ So, $\gcd(x,z) = 1.$ Since $xz = y^2,$ either $x=u^2, z=v^2,$ or $x=-u^2,z=-v^2,$ in either case with $\gcd(u,v) = 1.$ That is, possibly by changing from $(x,y,z)$ to $(-x,-y,-z)$ so as to arrange $x \geq 0,$ all primitive solutions are $$x = u^2, y = u v, z = v^2.$$

Next, the quadratic form is $X^T G X / 2,$ where $$G = \left( \begin{array}{rrr} 2a & d & e \\ d & 2b & f \\ e & f &2c \end{array} \right)$$ and $$X = \left( \begin{array}{r} x \\ y \\ z \end{array} \right)$$

The quadratic form $y^2 - z x$ is $X^T H X / 2,$ where $$H = \left( \begin{array}{rrr} 0 & 0 & -1 \\ 0 & 2 & 0 \\ -1 & 0 & 0 \end{array} \right)$$ It is a theorem in Fricke and Klein (1897), pages 507-508, that, because the quadratic form has at least one integer solution, in which $(x,y,z)$ are not all zero, there exists a square matrix of integers $R$ and a nonzero integer $n$ such that $$R^T G R = n H.$$ As $R$ has an inverse, we can take $S$ to have integral entries and minimize positive $k$ in $$RS = SR = k I.$$

We already know that we can take all solutions of $y^2 - z x = 0$ as the column vector $$U = \left( \begin{array}{r} u^2 \\ uv \\ v^2 \end{array} \right)$$ for relatively prime $(u,v).$ That is, $U^T H U = 0,$ and all solutions are a scalar multiple of $U.$

What happens if $X^T G X = 0,$ the "solutions" we want, with gcd one? Well, $R^T G R = n H,$ so $S^T R^T G R S = n S^T H S,$ so $$G = \frac{n}{k^2} S^T H S,$$ and $X^T G X = 0$ says $$X^T S^T H S X = 0.$$ We have already shown that there is some integer $w$ with $$SX = w U.$$ This gives us $RSX = w RU$ and $kX = w RU.$ Now, as $\gcd(x,y,z) = 1,$ there is a row vector $A = (\alpha,\beta,\gamma)$ with $AX = 1.$ This tells us $k = w ARU.$ As $ARU$ is some integer, $w | k,$ and the earlier $kX = w RU$ becomes $$X = \frac{1}{h} R U$$ for $h = \frac{k}{w} \in \mathbb Z.$ Furthermore, as $RS = SR = k I,$ we know $k | \det R,$ so $h | k$ tells us $h | \det R.$ One may leave it this way: list the divisors of $\det R,$ including $\det R$ itself. For each primitive pair $(u,v),$ produce the column vector $RU,$ which will be a solution but perhaps not primitive. Divide out by the gcd of the entries of $RU.$ All integer primitive solutions are given by $$X = RU/ g_1,$$ where $g_1$ is the gcd of the three entries of $RU.$ It is worth emphasizing that $g_1$ is a divisor of $\det R.$ Also, we get some explicit bounds, as $$|X|^2 = \frac{1}{g_1^2} U^T R^T R U,$$ since $R$ is nonsingular integer and $R^T R$ is symmetric positive definite. So, no matter what, we have a way to find all primitive solutions $X$ with some $|X| \leq \mbox{bound}$ by taking $|u|, |v|$ up to some other bound we can figure out. $$\bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc$$ A more interesting alternative: for each divisor of $\det R,$ we may rewrite the eventual primitive solution with that gcd as a new recipe, $R_1 U$ for a new integer matrix $R_1$ that also solves $R_1^T G R_1 = n H.$

The example I like to show is solving $$2(x^2 + y^2 + z^2) - 113(yz + zx + xy)=0,$$ four "recipes," $$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 37 u^2 + 51 uv + 8 v^2 \\ 8 u^2 -35 uv -6 v^2 \\ -6 u^2 + 23 uv + 37 v^2 \end{array} \right)$$

$$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 32 u^2 + 61 uv + 18 v^2 \\ 18 u^2 -25 uv -11 v^2 \\ -11 u^2 + 3 uv + 32 v^2 \end{array} \right)$$

$$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 38 u^2 + 45 uv + 4 v^2 \\ 4 u^2 -37 uv -3 v^2 \\ -3 u^2 + 31 uv + 38 v^2 \end{array} \right)$$

$$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 29 u^2 + 63 uv + 22 v^2 \\ 22 u^2 -19 uv -12 v^2 \\ -12 u^2 -5 uv + 29 v^2 \end{array} \right)$$

For all four recipes, $$x^2 + y^2 + z^2 = 1469 \left( u^2 + uv + v^2 \right)^2$$ Since $u^2 + uv + v^2 \geq 3 u^2 / 4$ and $u^2 + uv + v^2 \geq 3 v^2 / 4,$ this gives us explicit bounds on the absolute values of $u,v$ that gives us all (primitive) solutions of $2(x^2 + y^2 + z^2) = 113 (yz+zx+xy)$ with the absolute values of $x,y,z$ up to a desired bound.

Indeed, we were able to choose all four coefficient matrices with this pattern: $$R = \left( \begin{array}{ccc} \alpha & \beta & \gamma \\ \gamma & - \beta + 2 \gamma & \alpha - \beta + \gamma \\ \alpha - \beta + \gamma & 2 \alpha - \beta & \alpha \end{array} \right)$$

The rows constitute a cycle of three neighboring, but not reduced, binary quadratic forms under the action of the matrix $$P = \left( \begin{array}{rr} 0 & 1 \\ -1 & -1 \end{array} \right),$$ where $P^3 = I.$ As soon as we write $X = RU$ we get the identity $$x^2 + y^2 + z^2 = \left( \alpha^2 + (\alpha - \beta + \gamma)^2 + \gamma^2 \right) \cdot \left( u^2 + uv + v^2 \right)^2$$

In all four cases we simply discard occurrences when the resulting $x,y,z$ have a common factor. With the understanding that we negate all $x,y,z$ so that the entry with largest absolute value is positive, then sort so that $$x \geq |y| \geq |z|,$$ here are the answers with maximum up to $1200$

jagy@phobeusjunior:~$./isotropy_binaries_combined 2 113 1200 | sort -n x y z first line u v 29 22 -12 < 29, 63, 22 > 1 0 32 18 -11 < 32, 61, 18 > 1 0 37 8 -6 < 37, 51, 8 > 1 0 38 4 -3 < 38, 45, 4 > 1 0 188 171 -86 < 37, 51, 8 > 1 2 211 144 -82 < 38, 45, 4 > 1 2 226 123 -76 < 32, 61, 18 > 1 2 243 94 -64 < 29, 63, 22 > 1 2 246 88 -61 < 38, 45, 4 > 2 1 258 59 -44 < 37, 51, 8 > 2 1 264 38 -29 < 29, 63, 22 > 2 1 268 11 -6 < 32, 61, 18 > 2 1 396 262 -151 < 37, 51, 8 > 1 3 432 209 -134 < 38, 45, 4 > 1 3 472 129 -94 < 29, 63, 22 > 3 1 489 76 -58 < 32, 61, 18 > 3 1 516 458 -233 < 38, 45, 4 > 2 3 526 447 -232 < 37, 51, 8 > 2 3 628 311 -198 < 38, 45, 4 > 3 2 656 262 -177 < 32, 61, 18 > 2 3 671 232 -162 < 37, 51, 8 > 3 2 692 183 -134 < 29, 63, 22 > 2 3 726 47 -32 < 32, 61, 18 > 3 2 727 36 -22 < 29, 63, 22 > 3 2 804 787 -382 < 32, 61, 18 > 1 5 894 688 -373 < 29, 63, 22 > 1 5 953 946 -456 < 38, 45, 4 > 3 4 1034 492 -317 < 37, 51, 8 > 1 5 1062 443 -296 < 29, 63, 22 > 5 1 1102 363 -256 < 38, 45, 4 > 1 5 1123 314 -228 < 32, 61, 18 > 5 1 1159 1046 -528 < 32, 61, 18 > 1 6 1179 118 -88 < 38, 45, 4 > 5 1 1188 19 2 < 37, 51, 8 > 5 1 1199 1002 -524 < 29, 63, 22 > 1 6 x y z first line u v  I should probably point out that, while it was quite easy (after writing the C++ programs) to make a list of primitive solutions to$ 2(x^2 + y^2 + z^2) - 113(yz + zx + xy)=0 $with$x \geq |y| \geq |z|$for$x \leq 1200,$and just as easy to identify the four square matrices$R_1,R_2,R_3,R_4$used above, it was quite a big job to prove that these really do give all (ordered) primitive solutions. I have a pdf of the whole business in detail, about twenty pages Latex. Oh: in the above, we may always take$u,v \geq 0.$It is a reasonable conjecture that the problem$ A(x^2 + y^2 + z^2) - B(yz + zx + xy)=0, $with$\gcd(A,B)=0,B > A > 0,$and both$B-A$and$B + 2A$expressible in integers as$s^2 + 3 t^2,$always works out with a finite number of such$R_i.$No proof. • What's the point in a permanent selection of numbers?$A=2$;$B=113$You set their value via the parameters$s,t$. And now using them as parameters to write the parametrization of solutions. Dec 11, 2015 at 17:30 ## 3 Answers Another example, with three of the "recipes" required. All these problems I have checked needed either$2^k$or$3 \cdot 2^k$such$R$matrices. jagy@phobeusjunior:~$ ./isotropy 1 50

A = 1       B = 50

19     42     15
15    -12     -8
-8     -4     19

24     36      7
7    -22     -5
-5     12     24

25     32      4
4    -24     -3
-3     18     25

end of  A = 1       B = 50

B - 2 A =  48       B - A = 49      B + 2 A =  52

gcd( 4B-4A, B+2A) =  4

lambda =  13  t = 2  lambda t  = 26
2 alpha - beta + 2 gamma = 26
alpha^2 + (alpha - beta + gamma)^2  + gamma^2 = 650
beta^2 - 4 alpha gamma = 624
matrix determinants  = +/-  16562 = 2 * 7^2 * 13^2
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
jagy@phobeusjunior:~$./isotropy_just_ordered 1 50 1000 19 15 -8 24 7 -5 25 4 -3 61 40 -23 67 31 -20 76 7 -5 124 115 -57 163 60 -41 276 157 -95 280 151 -93 328 321 -155 331 15 -8 375 268 -149 433 181 -120 460 123 -89 463 115 -84 483 31 -20 487 184 -125 535 19 -8 604 447 -245 655 379 -228 673 589 -300 700 307 -201 700 631 -317 712 285 -191 760 483 -281 787 60 -41 789 40 -23 811 652 -345 820 393 -251 879 280 -197 915 184 -137 931 492 -305 943 24 -5 951 460 -293 955 223 -164 961 205 -152 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= jagy@phobeusjunior:~$ ./isotropy_binaries_combined 1 50 1000 | sort -n
19     15     -8      < 19, 42, 15 >      1  0
24      7     -5      < 24, 36, 7 >      1  0
25      4     -3      < 25, 32, 4 >      1  0
61     40    -23      < 25, 32, 4 >      1  1
67     31    -20      < 24, 36, 7 >      1  1
76      7     -5      < 19, 42, 15 >      1  1
124    115    -57      < 24, 36, 7 >      1  2
163     60    -41      < 19, 42, 15 >      1  2
276    157    -95      < 25, 32, 4 >      1  3
280    151    -93      < 19, 42, 15 >      1  3
328    321   -155      < 25, 32, 4 >      2  3
331     15     -8      < 24, 36, 7 >      3  1
375    268   -149      < 24, 36, 7 >      2  3
433    181   -120      < 25, 32, 4 >      3  2
460    123    -89      < 24, 36, 7 >      3  2
463    115    -84      < 19, 42, 15 >      2  3
483     31    -20      < 19, 42, 15 >      3  2
487    184   -125      < 19, 42, 15 >      4  1
535     19     -8      < 24, 36, 7 >      4  1
604    447   -245      < 19, 42, 15 >      1  5
655    379   -228      < 24, 36, 7 >      1  5
673    589   -300      < 25, 32, 4 >      3  4
700    307   -201      < 19, 42, 15 >      5  1
700    631   -317      < 24, 36, 7 >      2  5
712    285   -191      < 25, 32, 4 >      1  5
760    483   -281      < 24, 36, 7 >      3  4
787     60    -41      < 24, 36, 7 >      5  1
789     40    -23      < 25, 32, 4 >      5  1
811    652   -345      < 19, 42, 15 >      1  6
820    393   -251      < 25, 32, 4 >      4  3
879    280   -197      < 24, 36, 7 >      4  3
915    184   -137      < 19, 42, 15 >      3  4
931    492   -305      < 24, 36, 7 >      1  6
943     24     -5      < 19, 42, 15 >      4  3
951    460   -293      < 19, 42, 15 >      6  1
955    223   -164      < 19, 42, 15 >      5  2
961    205   -152      < 25, 32, 4 >      5  2
jagy@phobeusjunior:~$ Here's another one I really did prove,$x^2 + y^2 + z^2 - 5(yz+zx+xy)=0.$This one requires just one recipe, $$\left( \begin{array}{c} 5 u^2 + 9 uv + 3 v^2 \\ 3 u^2 - 3 u v - v^2 \\ - u^2 + uv + 5 v^2 \end{array} \right)$$ with the understanding that these are permuted, and possibly all mulitplied by$-1,$to arrange $$x \geq |y| \geq |z|.$$ As with the other problems, we just discard any triples where$\gcd(x,y,z) \neq 1.$That is the whole thing, really, with just one "recipe" we are guaranteed an integer multiple of every primitive integer solution; the question is how to get the primitive ones themselves. jagy@phobeusjunior:~$ ./isotropy 1 5

A = 1       B = 5

5      9      3
3     -3     -1
-1      1      5

end of  A = 1       B = 5

B - 2 A =  3       B - A = 4      B + 2 A =  7

gcd( 4B-4A, B+2A) =  1

lambda =  7  t = 1  lambda t  = 7
2 alpha - beta + 2 gamma = 7
alpha^2 + (alpha - beta + gamma)^2  + gamma^2 = 35
beta^2 - 4 alpha gamma = 21
matrix determinants  = +/-  196 = 2^2 * 7^2
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
jagy@phobeusjunior:~$=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= jagy@phobeusjunior:~$
jagy@phobeusjunior:~$./isotropy_just_ordered 1 5 500 5 3 -1 17 5 -1 41 5 3 59 47 -15 75 17 -1 89 83 -25 101 47 -15 111 17 5 129 125 -37 173 59 -15 185 131 -43 185 167 -51 201 83 -25 215 41 3 227 41 5 237 89 -25 251 215 -67 255 131 -43 293 255 -79 311 125 -37 327 269 -85 335 129 -37 353 75 -1 381 257 -85 383 101 -15 395 167 -51 425 419 -123 453 335 -109 461 75 17 479 257 -85 489 215 -67 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= jagy@phobeusjunior:~$ ./isotropy_binaries_combined 1 5 500 | sort -n
5      3     -1      < 5, 9, 3 >      1  0
17      5     -1      < 5, 9, 3 >      1  1
41      5      3      < 5, 9, 3 >      2  1
59     47    -15      < 5, 9, 3 >      1  3
75     17     -1      < 5, 9, 3 >      3  1
89     83    -25      < 5, 9, 3 >      1  4
101     47    -15      < 5, 9, 3 >      2  3
111     17      5      < 5, 9, 3 >      3  2
129    125    -37      < 5, 9, 3 >      1  5
173     59    -15      < 5, 9, 3 >      5  1
185    131    -43      < 5, 9, 3 >      2  5
185    167    -51      < 5, 9, 3 >      1  6
201     83    -25      < 5, 9, 3 >      3  4
215     41      3      < 5, 9, 3 >      4  3
227     41      5      < 5, 9, 3 >      5  2
237     89    -25      < 5, 9, 3 >      6  1
251    215    -67      < 5, 9, 3 >      1  7
255    131    -43      < 5, 9, 3 >      3  5
293    255    -79      < 5, 9, 3 >      2  7
311    125    -37      < 5, 9, 3 >      7  1
327    269    -85      < 5, 9, 3 >      1  8
335    129    -37      < 5, 9, 3 >      4  5
353     75     -1      < 5, 9, 3 >      5  4
381    257    -85      < 5, 9, 3 >      3  7
383    101    -15      < 5, 9, 3 >      7  2
395    167    -51      < 5, 9, 3 >      8  1
425    419   -123      < 5, 9, 3 >      2  9
453    335   -109      < 5, 9, 3 >      3  8
461     75     17      < 5, 9, 3 >      7  3
479    257    -85      < 5, 9, 3 >      4  7
489    215    -67      < 5, 9, 3 >      9  1
jagy@phobeusjunior:~$ The same formal record. If we look for a parameterization not in 2 and in 3 option the problem can be solved quite simply. For the equation. $$aX^2+bY^2+cZ^2=dXY+eXZ+fYZ$$ If you know any solution$(x,y,z)$of this equation. Then the formula for the solution of the equation can be written immediately. $$X=(dy+ez-ax)p^2+(fz-2by)ps+bxs^2+cxt^2+(fy-2cz)pt-fxst$$ $$Y=ayp^2+(ez-2ax)ps+(dx+fz-by)s^2+cyt^2-eypt+(ex-2cz)st$$ $$Z=azp^2-dzps+bzs^2+(ex+fy-cz)t^2+(dy-2ax)pt+(dx-2by)st$$$p,s,t - $any integers. It is seen that such formulas can be written infinitely many. If so like to use the well-known decision, it is better to write like this. This will allow to solve the equation. $$A(x^2+y^2+z^2)=B(xy+xz+yz)$$ It is easy to see that there are solutions for any$A$. Ask yourself the number$c$. And place into factors. $$c^2+A=ab$$ Then the coefficient is set to$B$us so. $$B=a^2+b^2-2(a+b)c+3c^2$$ Finding all the factors of$c,a,b$you can write a formula for the parameterization of the solution of this equation. $$x=c(ab-c^2)(k^2+s^2)+((a+b)(a^2+b^2)-(4a^2+5ab+4b^2)c+7(a+b)c^2-$$ $$-5c^3)p^2-(a^2+b^2-2(a+b)c+3c^2)cks+(b(b^2-a^2)-c(a^2+3b^2)+$$ $$+(4a+5b)c^2-5c^3)pk+(a(a^2-b^2)-c(b^2+3a^2)+(5a+4b)c^2-5c^3)ps$$ $$y=(a-c)(ab-c^2)(p^2+s^2)+(b^3-(a+2b)bc+(a+3b)c^2-c^3)k^2-$$ $$-(a-c)(a^2+b^2-2(a+b)c+3c^2)ps+(-2ab^2+c(a+b)^2-2ac^2+c^3)ks+$$ $$+(b(b^2+a^2)-(a^2+4ab+3b^2)c+(2a+5b)c^2-c^3)kp$$ $$z=(b-c)(ab-c^2)(p^2+k^2)+(a^3-(b+2a)ac+(3a+b)c^2-c^3)s^2-$$ $$-(b-c)(a^2+b^2-2(a+b)c+3c^2)pk+(a(a^2+b^2)-(3a^2+4ab+b^2)c+$$ $$+(5a+2b)c^2-c^3)ps+(-2ba^2+c(a+b)^2-2bc^2+c^3)ks$$ The transition to 3 parameters$p,s,k - \$ Allows not to use too much, but to write formulas.