Let

The second equation implies is odd. Hence is even (if were odd, then which is not possible because perfect squares cannot be congruent to 5 modulo 8). So is odd.

Subtracting the equations gives Since and are both even, is divisible by 4. In fact, one of and must be divisible by 4. For, suppose is not divisible by 4. Then and (since is odd) and so Hence is divisible by 8.

It remains to show that is divisible by 7. There may be a simple way but the only way I can do it is by contradiction. Now, by checking in turn, observe that a perfect square cannot be congruent to 5 or 6 modulo 7. If then one of and would be congruent to 5 or 6 mod 7, so we can eliminate these. We are left with In this case, one of and is divisible by 7, and so their product is divisible by 7 and must be a perfect square. Hence

for some integer divisible by 7. The discriminant of this quadratic in must be a perfect square; this is But if is divisible by 7, then which is impossible. Thus must be divisible by 7.