# When does a binary quadratic form represent 1 or -1

Let $a,b,c$ be integers. Is there a reasonably concise condition on $(a,b,c)$ which ensures that $$ax^2+bxy+cy^2=\pm 1$$ has a solution in integers $x,y$?

In addition to direct answers I would also appreciate references to the literature. Thanks.

-

## 2 Answers

A form represents 1 if it is equivalent to the principal form. There are algorithms for deciding this going back to Lagrange and Gauss, and which can be found e.g in Cohen's books on agorithmic number theory. If (a,b,c) represents -1, then (-a,-b,-c) represents 1.

-

A way to decide whether $ax^2+bxy+cy^2=d$ has (integral) solutions is described in the ch. 1 of Conway's (excellent!) book «The Sensual (Quadratic) Form».

-