Prove that the equation $x^2 − y^2 = 2002$ has no integer solution.

If I had the equation $x^3 - 7y = 3$ I would easily conclude that for it to have any integer solution then $$x^2\equiv3\pmod 7$$ must be true.

Applying the same logic here, I know that $x² = y^2 +2002$ so I can conclude that for it to have any integer solution then $$x^2\equiv2002\pmod y$$ must be true.

Is this conclusion correct?

From that congruence I can prove that the equation hasn't any integer solution without much trouble but I am not sure if that congruence is valid.

  • 2
    $\begingroup$ $x^2\equiv2002\pmod y$ follows from the equation, but it doesn't appear to get you closer to a solution. $\endgroup$
    – Joffan
    Commented Mar 17, 2017 at 17:51
  • $\begingroup$ @Joffan for any x $$x\equiv0,1,...,y-1\pmod y$$ so $$x²\equiv2002\pmod y$$ is equivalent to $$(y-1)²\equiv2002\pmod y$$ which must be true if there are any integer solutions. $$(y-1)²\equiv y²+1-2y\pmod y\equiv 1\pmod y$$ 1 is different than 2002 so the equation doesn't have any integer solution. Am I thinking correctly? $\endgroup$ Commented Mar 17, 2017 at 18:17
  • 2
    $\begingroup$ No your inference of $(y-1)²\equiv2002\pmod y$ doesn't follow from the previous. $\endgroup$
    – Joffan
    Commented Mar 17, 2017 at 18:56
  • 3
    $\begingroup$ Well, you can do that, but it doesn't eliminate the possibility that there are other values of $y$ that will work. $\endgroup$
    – Joffan
    Commented Mar 17, 2017 at 19:25
  • 1
    $\begingroup$ @Joffan Oh, yes you are absolutely right. Thank you very much. $\endgroup$ Commented Mar 17, 2017 at 19:32

5 Answers 5


One way to solve this is to look at $x^2-y^2=(x+y)(x-y)$. Then for integer $x,y$, since $2002$ is even, one of $(x+y),(x-y)$ must be even, but since $2002/2=1001$, the other must be odd. That would mean $(x+y)+(x-y)=2x$ is also odd, which contradicts the existence of integer solutions.

  • 3
    $\begingroup$ In fact if one of $x+y$, $x-y$ is even, then both of them are, but then their product would be a multiple of $4$, which $2002$ is not. $\endgroup$
    – Jack M
    Commented Mar 22, 2017 at 20:40
  • $\begingroup$ You can take it either way around. I went for the contradiction. $\endgroup$
    – Joffan
    Commented Mar 22, 2017 at 20:40


$a\equiv0,1,2,3\pmod4, a^2\equiv0,1$


$x+y+(x-y)$ is even, $x+y, x-y$ have the same parity

  • $\begingroup$ I know why the mod 4 works but what about mod y? $$x\equiv0, 1, ..., (y-1)\pmod y$$ $\endgroup$ Commented Mar 17, 2017 at 17:31
  • $\begingroup$ @Cat_astrophic I think lab bhattacharjee's point is that, although your result in the question is true, it's still going to be a lot of work for you to attempt to prove that no solutions exist. If you consider things mod 4, there are a small integer number of cases to disprove (i.e you can actually do it in two). $\endgroup$
    – origimbo
    Commented Mar 17, 2017 at 17:52
  • $\begingroup$ @tatan, if the sum of two numbers is even, either both are odd, or both even $\endgroup$ Commented Nov 1, 2018 at 14:47

Answering this requires no advanced math knowledge at all.

1     4     9     16     25  
   3     5     7      9

The difference between every square is an odd number, and since 2002 is even, then y must be an even number less than x. Therefore for there to be an integer solution we have to express 2002 as the sum of an even number of consecutive odd numbers.

3 + 5                   = 8            
3 + 5 + 7 + 9           = 24
    5 + 7               = 12     
    5 + 7 + 9 + 11      = 32
        7 + 9           = 16           
        7 + 9 + 11 + 13 = 40 

These sequences.of sums can be Written as 4n+4 and 8n+16 respectively which we can then write as 4 (n+1) and 4(2n+4)

And so on. The sequence of the sum of 6 and 8 and every other number of consecutive odd numbers will also be able to be Written as 4(kn+k^2) where k is half the number of consecutive odd numbers you are adding up. 2002 is not divisible by 4, So either k or n must not be an integer number, which means that there is no integer solutions.


All even numbers not divisible by 4 cannot be Written as the difference between two squares


Given that n, a, and b are elements of N, let n = a*b. (If n is prime, then n may be written as n*1 = 1*n; if n is non-prime, then by definition n has at least two divisors.)

n = ab

n = 0 + 4ab/4 + 0

0 = (a^2-a^2)/4 and 0 = (b^2-b^2)/4

n = (a^2-a^2)/4 +(2ab+2ab)/4 + (b^2-b^2)/4

n = (a^2 - a^2 + 2ab + 2ab + b^2 + b^2 - b^2)/4

rearranging and regrouping, we get n = (a^2 + 2ab + b^2)/4 - (a^2 - 2ab + b^2)/4

simplifying, we get n = ((a+b)/2)^2 - ((a-b)/2)^2

n = c^2 - d^2

n may be written as the difference of two numbers c and d. Both c and d are members of the natural numbers when a and b are odd or when both a and b are even. When n is divisible by 2 but not by 4. c^2 and d^2 must have the form (4m+2)/4 and thus cannot be members of N.

In this specific case, the divisors of 2002 are 2, 7, 11, and 13. Any possible solutions of a and b must be made with a combination of these primes. Since 2002 is divisible by 2 and not by 4, the solutions of a and b must be of the form SQRT[(4m+2)/4] which equals SQRT[m + .5], which, sadly, is not an element of N.


Your equation is $$ x^2-y^2=2002\textrm{, }x,y\textrm{ integers. }\tag 1 $$ Hence your equation can be viewed as restricted case of a more general case of equations $$ x^2-y^2=n\textrm{, }n>0.\tag 2 $$ I will show that


1) If $n$ is positive integer, then the number of representations of $n$ in the form $x^2-y^2$ is $$ r(n)=\sum_{d|n}\textrm{abs}\left((-1)^d+(-1)^{n/d}\right).\tag 3 $$ 2) If $n=2P$, with $(2,P)=1$ , then (2) is imposible.


For this assume that $r(n)$ are the number of representations of any positive integer $n$ in the form (2), with $x,y\in\textbf{Z}$. We can write $x^2-y^2=(x-y)(x+y)$ and setting $A=x-y$, $B=x+y$, we have such representations iff $x=\frac{A+B}{2}$ and $y=\frac{A-B}{2}$ i.e that is iff $AB=n$ and $A,B$ both even or both odd. Hence we can write that, for any positive integer $n\neq 0$, the number of solutions of (2) is $$ r(n)=2\sum_{ \begin{array}{cc} 1\leq A,B\leq n\\ AB=n\\ \frac{A+B}{2}=\textrm{integer}\\ \frac{A-B}{2}=\textrm{integer} \end{array} }1=2\sum_{d|n}\left|\frac{(-1)^d+(-1)^{n/d}}{2}\right|. $$ Hence finaly $$ r(n)=\sum_{d|n}\textrm{abs}\left((-1)^d+(-1)^{n/d}\right).\tag 3 $$ Moreover about the theorem we have: When $n$ is even with the prime decomposition $n=2p_1^{a_1}p_2^{a_2}\ldots p_s^{a_s}$, $p_1<p_2<\ldots<p_s$, $p_1,p_2,\ldots,p_s-$primes, then in each $d|n$, we have $d=$even and $n/d=$odd or $d=$odd and $n/d=$even. Hence all $\textrm{abs}\left((-1)^d+(-1)^{n/d}\right)=0$ and $r(n)=0$. QED

Now your equation (1) is a special case of Theorem 1 with $n=2002$, i.e. $n=2\cdot 7\cdot 11\cdot 13$. Hence $$ r(2002)=0.\tag 4 $$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .