This is a very interesting problem. Using the notation , here are all the solutions , generated by computer. As you can see, there are only , so they are somewhat rare. No counterexamples under . Does anyone see any helpful patterns?
It's a relief to know that I am not the only one to have been baffled by this intriguing problem. I have spent a lot of time thinking about it, and have made essentially no progress. I started by thinking about the conditions that a counterexample would have to satisfy.
If the equations (where denotes a square, of course) have a solution in which neither x nor y is a square, then there must exist squarefree integers p, q with . Equivalently, the system of Diophantine equations
must have a solution.
I tried looking at the situation where p and q are both prime. A necessary condition for (*) to have a solution in this case is that q and –q should both be quadratic residues mod p. This happens for example if p=13 and q =17. Then you look for solutions to (*) by forming the continued fraction expansion of (using the standard procedure for solving Pell's equation). That leads to the solution for one of the equations in (*). But I could not find a solution for the equation by that method.
Other pairs of plausible primes also fail to produce solutions to (*). Taken together with Media_Man's numerical evidence, this begins to make it look as though (*) has no solutions unless p or q is equal to 1. Maybe someone who knows more about Diophantine equations than me can shed some light on this.
Edit. The x and y in the equations (*) are not the same as in the original equations. That was a bad choice of notation. I just needed four integer variables, and w, x, y, z were the obvious ones to go for, forgetting that x and y appeared in the original problem.
At the expense of answering your original question, havaliza, I am trying to enumerate all the solutions. I have not found a general formula or algorithm, but I have found a subset that is so bizarre it is worth sharing.
Start with the sequence . Incidentally, this is Sloane's A001333, or "numerators of continued fraction convergents to sqrt(2)."
Let , and you have a solution. (No, this is not a notation error, the choices of and can be completely random; they do not have to be consecutive.) Now, is a square trivially, but I could use some help proving is always a square.
Again, this is only a subset of solutions, but it is a pattern I gleaned from my data and for whatever strange reason it seems to work. This also supports Opalg's implication that the problem may be connected to continued fractions, of which I know very little. If we can find a method of producing all solutions, prove the method leaves no solutions out, and that the method always gives x or y a square, this path will lead to an answer to your question. However, I think this question has a lot more depth to it.
UPDATE: Define . These are Sloane's A000129, the Pell Numbers, or "denominators of continued fraction convergents to sqrt(2)." HYPOTHESIS: for all n odd, , and for all n even, . Assuming for the moment this hypothesis is true, . Notice that and . This is enough to prove and are both squares. Again, if the above hypothesis is true linking sequences a,b, then this construction does give a subset of solutions.
This should be fairly obvious, but I'll post it anyway. If for some integer a, then for some integer b.
It follows that
The first equation is trivial, but the second is not. It is unclear whether all solutions would lead to a solution to the original problem. However, writing it this way eliminates m as a necessary variable.
(Further reading: Pell number - Wikipedia, the free encyclopedia)
Here we go. The continued fraction representation of . If you take the nth iteration of this repeated pattern, you get the rational "convergents," namely . These are all of the form , where denotes the nth Pell Number, . This sequence grows similarly to Fibonacci, and a closed formula is , where . It can easily be shown that the numerators, (these are called the Half-companion Pell Numbers). Start by noting the product . Now, . Therefore, .
Back to the problem. Define , and it follows immediately that are both squares. QED
This produces only a subset of solutions here, which we shall call Pell Solutions. Removing these, the rest of the solutions under 10000 are . Conjecture: For all non-Pell Solutions, given any square x, there exists exactly one solution (x,y).
Again, havaliza, I apologize for skirting your question and dragging a lot of advanced number theory into your thread, but I believe this problem is much more complex than it seems at first glance, and deserves much more attention.
UPDATE: For any nonsquare n, denote all solutions to the Pell equation by and all solutions to the negative Pell equation by . Define , for and you can easily see that are squares. The Pell equation is known to always have an infinite number of solutions for any nonsquare n. However, no general solution to the negative Pell equation is currently known. Therefore, the solutions to your question, havaliza, cannot be enumerated wholly using known math. However, that is not to say your question cannot be answered. Extending the umbrella of the term "Pell Solution" to these numerous examples with , your question can still be phrased as "Do there exist any non-Pell Solutions?" I have a feeling the answer is no, but seeing as how I just proved my own earlier conjecture false, I do not know.
UPDATE: WLOG, suppose . Except for the trivial , , so for some squarefree n. Since for , and since for . So, there is a one-to-one correspondence between simultaneous solutions to the Pell equations and and ALL integer solutions to with the constraint that . Therefore, with no need to categorize them, all the solutions I produced fall under the Pell Solutions umbrella. Again, do there exist any non-Pell solutions?
Going back to the original question, I came up with this. Please verify or discredit...
Let . So . Cross-multiplying and expanding, , so . For this to be an integer, the expression under the radical must sum to a perfect square. Since all solutions to can be enumerated by , let . So now, . Therefore, x is a perfect square. QED
This feels like cheating somehow. I think it might be necessary to show that since . Is this a hole? Can it be filled? Are there any other holes? Is this proof even valid?
general form of a pythagorean triple is . If you leave out the k, you don't cover all possible cases. But if you include the k, you end up with the conclusion that or , which of course doesn't prove that x is a perfect square.
I tried to see whether this ingenious idea could be adapted to give a correct proof, but I haven't succeeded in getting anywhere. One snag is that in the original problem it need not be true that x is a square. (It might be y that is the square, as in the example x = 8, y = 49.)
I understand now why my earlier statement was rather nonsensical. However, you can use Media Man's argument to show that x is of the form and y is of the form .
Then you have and .
We can rewrite these as and .
It must be true that either both and are squares or neither of them are.
It must also be true that either both and are squares or neither of them are.
If you suppose that none of is a square and manage to show that this leads to a contradiction, that would be enough for proof of the original statement that at exactly one of x and y is a square, since we have already eliminated the possibility that both of them are.