# Finding rational solutions of a system of quadratic diophantine equations

I have a system of quadratic diophantine equations $$x^T A_i x = b_i \text{ for all } i \in \{1, \ldots, n\}$$ where $$x \in \mathbb{R}^d$$ is the free variable and $$A_i \in \mathbb{Z}^{d \times d}$$ (symmetric) and $$b_i \in \mathbb{Z}$$ are fixed constants. I already have all the solutions of the system of equations over the integers, in the sense that I have an algorithm that enumerates all of them. I would like to find all the rational solutions to this system of equations. This seems to be equivalent to solving the homogeneous system of quadratic diophantine equations $$x^T A_i x = y^2 b_i \text{ for all } i \in \{1, \ldots, n\}$$ over the variables $$x \in \mathbb{Z}^d$$ and $$y \in \mathbb{Z}$$.

From looking into this topic, it seems that even solving systems of homogeneous quadratic diophantine equations is quite hard in general, in the sense that there is no good way of finding out whether a system has a solution. But what I can't find a direct answer for is whether, once we have a solution (or in this case, many solutions), it is easy to then find all the solutions. I am hoping that someone more familiar with the literature on diophantine equations might know the answer.

Note that if I only had one equation, solving it would be straightforward. If $$x_0$$ is one of my integer solutions above (a vector such that $$x_0^T A x = b$$), then for any direction $$(\Delta_x, \Delta_y) \in \mathbb{Q}^d \times \mathbb{Q}$$, I can set $$x = x_0 + \alpha \Delta_x$$ and $$y = 1 + \alpha \delta_y$$ and solve $$(x_0 + \alpha \Delta_x)^T A (x_0 + \alpha \Delta_x) = (1 + \alpha \Delta_y)^2 b.$$ Expanding out this equation and leveraging the fact that $$x_0^T A x = b$$, $$2 \alpha x_0^T A \Delta_x + \alpha^2 \Delta_x^T A \Delta_x = 2 \alpha \Delta_y b + \alpha^2 \Delta_y^2 b.$$ From here, we can solve for $$\alpha$$, which gives us $$\alpha = \frac{2 x_0^T A \Delta_x - 2 \Delta_y b}{\Delta_y^2 b - \Delta_x^T A \Delta_x},$$ and substituting this back into the original expression gives us a rational solution (and it's not hard to see that this formula will generate all the solutions).

I'm not sure how to do this sort of thing for a system of more than one equation though.

• you ought to show a system of interest; and give some idea of your background in number theory – Will Jagy Feb 4 at 0:05