# The set of differences of square rationals

At first, we observe that $$A:=\{ p^2-m^2 : p,m\in \Bbb{Z}\}=\mathbb{Z}\setminus (4\mathbb{Z}+2)$$ (because an integer $$a$$ can be written as the form $$a=p^2-m^2$$ if and only if $$a\neq 4k+2$$, for every integer $$k$$) and so $$A^c=4\mathbb{Z}+2$$. Hence, $$B:=\left\{ p^2-m^2 : p,m\in \Bbb{Z}\setminus \{0\}\right\}=A\setminus \left\{\pm k^2: k\in \Bbb{Z} \mbox{ and } k^2\neq s^2-t^2, \mbox{ for all } s,t\in \Bbb{Z}\right \}$$

Now, put $$D:=\left\{ \frac{p^2}{q^2}-\frac{m^2}{n^2}: p,q,m,n\in \Bbb{Z}\setminus \{0\} \text{ and} \gcd(p,q)= \gcd(m,n) =1\right\}$$ We would like to determine this set and its complement $$D^c$$ in $$\Bbb{Q}$$ exactly.

It is clear that $$B\subseteq D$$. Is it true that $$D\neq \Bbb{Q}$$?

• You don't need the gcd conditions in your definition of $D$. – TonyK Dec 13 '19 at 12:54

We have $$4m = (m+1)^2-(m-1)^2$$ for all $$m \in \mathbb Z$$. Therefore, $$\frac{a}{b} = \frac{4ab}{4b^2} = \frac{(ab+1)^2-(ab-1)^2}{(2b)^2} = \left(\frac{a b + 1}{2 b}\right)^2 - \left(\frac{a b - 1}{2 b}\right)^2$$ When $$ab=\pm 1$$, one of the terms is zero. In this case, $$\frac{a}{b}=\pm1$$ and we can use $$1 = \left(\frac{5}{3}\right)^2 - \left(\frac{4}{3}\right)^2, \quad -1 = \left(\frac{4}{3}\right)^2 - \left(\frac{5}{3}\right)^2$$ Thus, all rationals are the difference of two nonzero rational squares.
If I understood you correctly, $$D=\mathbb Q$$ since $$\left(\frac{a b + 1}{2 b}\right)^2 - \left(\frac{a b - 1}{2 b}\right)^2 = \frac{a}{b}$$
• Thanks for your answer. What about the cases $ab=\pm 1$? – M.H.Hooshmand Dec 13 '19 at 11:31
The non degenerate quadratic form $$X^2-Y^2$$ obviously represents $$0$$ in $$\mathbf Q$$, i.e. the equation $$x^2-y^2=0$$ admits solutions $$(x,y)\neq (0,0)$$. But a non degenerate quadratic form $$q(X)= \sum a_{ij}X_iX_j$$ in $$n$$ variables with rational coefficients which represents $$0$$ represents all rationals. Indeed, $$q(tX+Y)= t^2Q(X)+tb(X,Y)+f(Y)$$, where $$b(X,Y)$$ is the bilinear form associated to the quadratic form $$q(X)$$. If $$q(x)=0$$ for a certain $$x\neq (0,...,0)$$, the non degeneracy of $$q$$ implies the existence of $$y\in {\mathbf Q}^n$$ s.t. $$b(x,y)\neq 0$$, so that $$q(tx+y)$$ is a non constant linear function of $$t$$ which takes all values in $$\mathbf Q$$ when $$t$$ runs through $$\mathbf Q$$. Note that the main property remains valid over any field of characteristic $$\neq 0$$.