# Which integers can be written as $x^2+2y^2-3z^2\$?

For which integers $n$ has the diophantine equation $$x^2+2y^2-3z^2=n$$ solutions ?

These theorems

https://en.wikipedia.org/wiki/15_and_290_theorems

do not apply because the given quadratic form is not positive (or negative) definite. It seems that the quadratic form is universal (for every integer $n$ a solution exists) , but I have no idea how this can be proven.

We claim that any $n\in\mathbb{Z}$ can be written as $x^2+2y^2-3z^2$.

Note that any such integer $n$ is $0$ or it is equal to a $4^a\cdot 2^b\cdot d$ where $a$ is a non negative integer, $b\in\{0,1\}$ and $d$ is a signed odd number. Then we consider the following cases.

0) If $n=0$ then let $x=0$, $y=0$ and $z=0$.

1) If $n=d=2k+1$ then let $x=k+1$, $y=k$ and $z=k$: $$x^2+2y^2-3z^2=(k+1)^2-k^2=2k+1=n.$$

2) If $n=2d=2(2k+1)$ then let $x=k$, $y=k+1$ and $z=k$: $$x^2+2y^2-3z^2=2(k+1)^2-2k^2=4k+2=n.$$

3) If $n=4^ak$ and $k$ can be written as $x_k^2+2y_k^2-3z_k^2$ then let $x=2^ax_k$, $y=2^ay_k$ and $z=2^az_k$: $$x^2+2y^2-3z^2=4^a(x_k^2+2y_k^2-3z_k^2)=4^ak=n.$$

• How did you get the idea to consider $n=2^{2a+b}\cdot d$? – MJD Jun 1 '18 at 15:22
• @MJD I first noted 3) then 1). Hence I tried the remaining case 2). – Robert Z Jun 1 '18 at 15:27

The jpegs did not come out well.... in Modern Elementary Theory of Numbers by Leonard Eugene Dickson, (1939) , on the top of page 161, homework exercise 2 is this: given that $C$ is a positive integer, $$x^2 + 2 y^2 - C z^2$$ is universal if and only if $C$ is odd and every prime factor of $C$ is $\; \equiv 1 \; \mbox{or} \; 3 \pmod 8$

Dickson and his students Ross and Oppenheim found all universal indefinite ternary quadratic forms, collected into four types (up to $SL_3 \mathbb Z$ equivalence of forms). Take $M$ any integer and $N$ any odd integer, not necessarily positive in either case. In all four cases it it obvious that they are universal, just experiment a bit with each. In the first, take $(x,1,0)$ for example. $$xy - M z^2$$ $$2xy - N z^2$$ $$2xy + y^2- N z^2$$ $$2xy + y^2- 2 N z^2$$ In the fourth form, (I) for odd numbers $(x,1,0);$ (II) for numbers $2 \pmod 4$ take $(x,2,1);$ (III) for numbers $0 \pmod 4$ take $(x,2,0).$

Notice there is no $x^2$ term in any of these, so that the form evaluated at $(1,0,0)$ comes out to $0. \;$ A fundamental part of this is that a universal (ternary) form must non-trivially represent $0.$ Not true for quaternaries, such as $w^2 - 2 x^2 - 3 y^2 + 6 z^2$

Meanwhile, your $x^2 + 2 y^2 - 3 z^2$ is equivalent to the fourth type listed above, namely $2xy+y^2 + 6 z^2.$ For quadratic forms, we take (half) the Hessian matrix of second partials; forms with such Gram matrices $G,H$ are equivalent when there is an integer matrix $P$ with $\det P = 1$ and $P^T GP = H.$ Notice that this means $Q = P^{-1}$ is also of integers with $\det Q = 1,$ while $Q^T H Q = G.$ I have a program that finds me such matrices $P.$ Equivalent forms integrally represent exactly the same values.

The first matrix identity below reads $$(x+y)^2 + 2 (x+3z)^2 - 3(x+2z)^2 = 2xy+y^2 + 6 z^2$$  $$\left( \begin{array}{ccc} 1&1&1 \\ 1&0&0 \\ 0&3&2 \\ \end{array} \right) \left( \begin{array}{ccc} 1&0&0 \\ 0&2&0 \\ 0&0&-3 \\ \end{array} \right) \left( \begin{array}{ccc} 1&1&0 \\ 1&0&3 \\ 1&0&2 \\ \end{array} \right) = \left( \begin{array}{ccc} 0&1&0 \\ 1&1&0 \\ 0&0&6 \\ \end{array} \right)$$

$$\left( \begin{array}{ccc} 0&1&0 \\ -2&2&1 \\ 3&-3&-1 \\ \end{array} \right) \left( \begin{array}{ccc} 0&1&0 \\ 1&1&0 \\ 0&0&6 \\ \end{array} \right) \left( \begin{array}{ccc} 0&-2&3 \\ 1&2&-3 \\ 0&1&-1 \\ \end{array} \right) \left( \begin{array}{ccc} 1&0&0 \\ 0&2&0 \\ 0&0&-3 \\ \end{array} \right)$$ For the second matrix identity, take $u = -2y+3z, \; v = x + 2 y - 3 z, \; w = y - z, \;$ giving $$2uv+v^2 + 6 w^2 = x^2 + 2 y^2 - 3 z^2$$

Representation of a number we write.

$$aX^2+bY^2=cZ^2+q$$

I think that the only way to record the desired polynomial is to use the solutions of any equation.

$$ax^2+by^2=cz^2$$

Knowing the solutions of this equation and substituting them into the linear Diophantine equation.

$$axs+byp-czk=1$$

$(s;p;k) -$ variables which are solutions of this equation. Then the solution of the first equation can be written as.

$$X=\frac{x}{2}(ck^2-as^2-bp^2+q)+s$$

$$Y=\frac{y}{2}(ck^2-as^2-bp^2+q)+p$$

$$Z=\frac{z}{2}(ck^2-as^2-bp^2+q)+k$$