I am currently working on a problem with Diophantine equations

I need to prove (if it is true, which seems to be the case) the following :

Let $x,y \in \mathbb{N}$ be natural numbers, and $n \in \mathbb{N}$.

Let E be the following equation $$x^2-y^2=n \;(E)$$

then the couple $(x,y)=(\frac{n+1}{2};\frac{n-1}{2})$ is the unique solution iff $n$ is both an odd and prime number

What I managed to prove so far :

E has at least one solution iff $n=pq$ with $p \& q $ both odd or both even.

From there, I also proved that if $n$ is odd, then E has at least one solution.

Is it possible to prove what I need from this point ? Any help will be appreciated !


  • 1
    $\begingroup$ What is the relevance of $n$ being prime? Surely there are solutions with $n$ an odd composite, eg $(\frac{15+1}{2})^2-(\frac{15-1}{2})^2=8^2-7^2=15$? $\endgroup$ – Adam Bailey Oct 28 '19 at 22:41
  • $\begingroup$ @AdamBailey I have a program that uses odd prime numbers to do some deciphering. This could be of use to check the key provided by the user. $\endgroup$ – T.D. Oct 29 '19 at 7:41
  • $\begingroup$ @AdamBailey But the solution is not unique in this case, we can also write $15=4^2-1^2$. $\endgroup$ – Peter Nov 4 '19 at 10:55
  • Suppose , $\ n\ $ is an odd prime number. $$x^2-y^2=n$$ means $$(x-y)(x+y)=n$$

Since $\ x-y\le x+y\ $ holds, we can conclude that $$x-y=1$$ $$x+y=n$$ implying $\ x=\frac{n+1}{2}\ $ , $\ y=\frac{n-1}{2}\ $, which is the unique solution

  • Suppose , we have the given solution. If we define $\ k:=\frac{n-1}{2}\ $, we have the solution $(k,k+1)$. Since $\ (k+1)^2-k^2=2k+1\ $ is odd , we can conclude that $\ n\ $ is odd. If $n$ is odd and composite, there are odd numbers $(a,b)$ with $\ 1<a\le b $ and $\ ab=n\ $. Solving the system $$x+y=b$$ $$x-y=a$$ gives then a solution different from the given one, namely $$x=\frac{b+a}{2}$$ $$y=\frac{b-a}{2}$$ which differs from the given solution because $\ 1<a\le b<n\ $ implies $\ b-a<n-1\ $.

Hence the solution is not unique.

  • $\begingroup$ Note that for the criterion it is necessary that $0$ belongs to the natural numbers, otherwise $9$ would be a counterexample. $\endgroup$ – Peter Nov 4 '19 at 11:16
  • $\begingroup$ Thanks I understand most of it , however why would the last system give a solution different from the given one? $\endgroup$ – T.D. Nov 4 '19 at 18:29
  • $\begingroup$ Please add it to your answer ;) $\endgroup$ – T.D. Nov 5 '19 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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