Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Obviously,the equation $x^2-3 y^2=2 z^2$ doesn't have positive integer solutions.

I tried

Exists[{x, y, z}, x > 0 && y > 0 && z > 0 && x^2 - 3 y^2 == 2 z^2]
Resolve[%, Integers]


Exists[{x, y, z}, Element[{x, y, z}, Integers], 
 x > 0 && y > 0 && z > 0 && x^2 - 3 y^2 == 2 z^2]

but I don't get any useful result. Am I using these functions incorrectly?

share|improve this question
up vote 3 down vote accepted

Why obviously? In principle, if you want to solve diophantine equations, FindInstance with option Integers is what you need but (as the warning message below says) it can be insufficient in proving such solutions don't exist which seems to be what you want.

FindInstance[x^2 - 3 y^2 == 2 z^2 && z > 0, {x, y, z}, Integers]
share|improve this answer
The lack of any solution might not be "obvious," but Fermat's method of descent works well here. If we start with a primitive solution $(x,y,z)$ and reduce it mod $3$, we see easily that $x$ and $z$ are multiples of $3$: Solve[x^2 - 3 y^2 == 2 z^2, {x, y, z}, Modulus -> 3]. Dividing out by $3$ and reducing the new equation mod $3$ shows that $y$ also is a multiple of $3$: Solve[3 xp^2 - y^2 == 6 zp^2, {xp, y, zp}, Modulus -> 3]. This contradicts the assumption that we had a primitive solution, whence there can be no solutions. – whuber Mar 4 '13 at 17:20
Thanks! I think your comment makes for a perfectly credible answer then. – gpap Mar 4 '13 at 17:54
I don't believe my comment answers the question stated, which is whether Exists and Resolve have been "incorrectly" used. The question does explicitly presume the lack of all solutions, and your answer does challenge the basis of that presumption--which I think is a valid thing to do--so I commented only in order to address that tangential issue. – whuber Mar 4 '13 at 17:58
@whuber The problem is how to state a "primitive" solution in such a way Mma can use it – Dr. belisarius Mar 4 '13 at 22:20
@belisarius I'm afraid I don't understand what you mean by "state" a solution. The question I read here is "Am I using these functions incorrectly?" (BTW, if by the use of quotations you mean to suggest our use of "primitive" may be unusual or idiosyncratic, please be assured that is not the case: it is a standard, well-known term.) – whuber Mar 4 '13 at 22:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.