TITLE: Deciding a quadratic diophantine equation
QUESTION [8 upvotes]: Given $a,b\in\Bbb Q_+$, is there an easy way to decide if $$S_{a,b}=\{(x,y)\in\Bbb Z^2:ax^2 + by^2=1\}=\emptyset?$$
I am more interested in seeing if there is a quick way to test for case when solutions do not exist.

REPLY [2 votes]: I thinks pari/gp can solve this via bnfisintnorm.
For integers, $a,b,c$, you are solving $ax^2+by^2=c$ with $ab$>0.
Solving symbolically:
$$ x= \pm {\frac {\sqrt {-a \left( b{y}^{2}-c \right) }}{a}} $$.
The denominator is integer, so the numerator must be integer divisble
by $a$.
Squaring the numerator we get:
$$ X^2+aby^2=ac \qquad(1) $$
Since $ab>0$, (1) has finitely many solutions and it is Pell-like since
it is monic in $X$.
There are no units in the the number field with defining polynomial
$X^2+ab$, so pari's bnfisintnorm(K,ac) will give solutions and you
must find those $X$ divisible by $a$.

Prototype pari implementation
 {
 solveabc(a,b,c)=
 /*
 pari/gp implementation for solving
 ax^2+by^2=c

 https://mathoverflow.net/questions/202037/deciding-a-quadratic-diophantine-equation

 sample usage:

 ? \r solveabc.gp

 ? a=7;b=5;T=solveabc(a,b,a*2^2+b*3^2)
 %64 = [[2, 3], [2, -3]]

 */
 if(!issquarefree(a*b),print("ab is not squarefree, likely will fail"););
 K=bnfinit('x^2+a*b,1);
 no=bnfisintnorm(K,a*c);
 if(no==[],print(" a is not norm, no solutions");return([]));
 r=[];
 for(i=1,#no,
 v=lift(no[i]);
 X=polcoeff(v,0)/a;
 Y=polcoeff(v,1);
 r=concat(r,[[X,Y]]);
 );
 return(r);
 }