# When $Ax^2+By^2=z^2$ has a solution in integers?

Consider the Diophantine equation $Ax^2+By^2=z^2$, with positive integer parameters $A$ and $B$ (not necessarily square-free or co-prime). When does this equation have a non-trivial solution? Can one give a comprehensible necessary and sufficient condition that $A$ and $B$ must satisfy?

I am aware of the Legendre theorem, but it assumes that $A$ and $B$ be co-prime and square-free; can one somehow get around this assumption?

• why would you want to remove Legendre's hypotheses? If you start with $10 x^2 + 15 y^2 = z^2,$ it just turns into $2 x^2 + 3 y^2 = 5 w^2.$ Furthermore, each such problem has a slightly different reduction to the Legendre theorem. – Will Jagy Nov 1 '14 at 21:53
• @Will Jagy: your reduction from $10x^2+15y^2=z^2$ to $2x^2+3y^2=5z^2$ is based on the fact that $5$ is a prime. In my case, the coefficients $A$ and $B$ depend on more parameters and I cannot find explicitly their prime factorization. – W-t-P Nov 2 '14 at 6:45