# Second degree Diophantine equations

About algorithm: There **is** an algorithm that will determine, given any quadratic $Q(x_1,\dots,x_n)$ as input, whether or not the Diophantine equation $Q(x_1,\dots,x_n)=0$ **has** a solution. This is something that I (and others) observed quite a long time ago. I have no knowledge about a *nice* algorithm.

Set one machine $M_1$ to search systematically for solutions. Another machine $M_2$ simultaneously checks whether there is a real solution (easy) and then checks systematically for every modulus $m$ whether there is a solution modulo $m$.

By the Hasse Principle (which in this case is a theorem), if our equation has "local" solutions (real and modulo $m$ for every $m$) then it has an integer solution. So either $M_1$ will bump into a solution or $M_2$ will find a local obstruction to a solution. Thus the algorithm terminates.

The corresponding question for cubics is unsolved. The same question for quartics (in arbitrarily many variables) is equivalent to the general problem of testing a Diophantine equation for solvability, so is recursively unsolvable.

**Added:** I think that the details are written out in the book *Logical Number Theory I* by Craig Smorynski. Very nice book, by the way.

There is an algorithm for deciding whether a single degree 2 multivariable polynomial equation has a solution in integers, due to Siegel, Zur Theorie der quadratischen Formen, *Nachr. Akad. Wiss. Göttingen Math.-Phys. Kl. II* 1972, 21-46. See also Grunewald and Sigel, On the integer solutions of quadratic equations, *J. Reine Angew. Math.* **569** (2004), 13-45.

But the Hasse principle by itself does not give an algorithm: it holds only for rational solutions, not for integer solutions.