Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

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

Has it been shown whether there is a finite or infinite number of Pythagorean triples whose smallest two numbers differ by 1?

In either case I’d appreciate a link to the proof.

Edit: thank you all for your answers. Would it also be possible to determine for which triples the smallest number is prime?

share|cite|improve this question
Have you heard of Pell's equation? – JimmyK4542 Aug 10 '14 at 18:48
Yes. I'm asking for solutions to the equation x^2+(x+1)^2=y^2 – Matheo Aug 10 '14 at 18:50
My answer now replies to the edited question, too. – Jack D'Aurizio Aug 10 '14 at 19:36
up vote 17 down vote accepted

There is an infinite number of such pythagorean triples. Any primitive pythagorean triple $(a,b,c)$ with $a^2+b^2=c^2$ (are we are looking for primitive triples since we want $a$ and $b$ consecutive) is of the form: $$ a=p^2-q^2,\qquad b=2pq,\qquad c=p^2+q^2 $$ with $p$ and $q$ coprime and not both odd. So we are looking for integer solutions of: $$ p^2-2pq-q^2 =\pm 1,$$ or: $$ (p-q)^2 - 2q^2 = \pm 1.$$ However we know that the Pell equation $A^2-nB^2=1$ has an infinite number of integer solutions $(A,B)$ for every $n$ that is not a square, hence we can find "consecutive" pythagorean triples from the solutions of $$ A^2 - 2B^2 = 1,\tag{1}$$ for istance. $(A,B)=(3,2)$ is the minimal solution of $(1)$, giving $(p,q)=(5,2)$, hence the triple $(20,21,29)$. The next solution can be found by expanding: $$ (3+2\sqrt{2})^2 = 17+12\sqrt{12},$$ hence $(p,q)=(29,12)$ gives the triple $(696,697,985)$ and so on.

In general, we can see that all the solutions depends on the convergents of the continued fraction of $\sqrt{2}$, i.e. on the Pell sequence: $$ (p,q) = (P_n,P_{n+1}),$$ from which:

$$ (a_n,b_n) = (2P_nP_{n+1},P_{n+1}^2-P_{n}^2) = (2P_n P_{n+1},2P_nP_{n+1}+(-1)^n),$$


$$P_n = \frac{1}{2\sqrt{2}}\left((1+\sqrt{2})^n-(1-\sqrt{2})^n\right).$$

Since neither $2P_n P_{n+1}$ or $P_{n+1}^2-P_{n}^2$ may be primes if $n> 1$, the only "consecutive" pythagorean triple with the smallest element being a prime is $(3,4,5)$.

share|cite|improve this answer
Of course, $(3,4,5)$ with $(A,B)=(1,0), (p,q)=(2,1)$ is truly the "minimum" solution of $(1)$, unless $B$ must be among the positive integers... – abiessu Oct 9 '14 at 17:11

Let's suppose $(x,x+1,y)$ is a Pythagorean triple. Then:

$x^2+(x+1)^2 = y^2$

$2x^2+2x+1 = y^2$

$4x^2+4x+2 = 2y^2$

$(2x+1)^2 + 1 = 2y^2$

$(2x+1)^2 - 2y^2 = -1$

This is now a negative Pell's Equation for which there are infinitely many solutions. See this question for details.

share|cite|improve this answer

Cheap version: we get triples $(x,y,z)$ such that $y=x+1$ and $x^2 + y^2 = z^2,$ with $$ (3 ,4,5 ) $$ $$ (20 ,21,29 ) $$ $$ ( 119,120, 169 ) $$ $$ (696 ,697, 985 ) $$ $$ (4059 , 4060,5741 ) $$ $$ (23660 ,23661,33461 ) $$ $$ (137903 ,137904,195025 ) $$

That is, $(x_n, y_n,z_n)$ such that $$ x_{n+2} = 6 x_{n+1} - x_n +2, $$ but $$ y_{n+2} = 6 y_{n+1} - y_n -2, $$ and $$ z_{n+2} = 6 z_{n+1} - z_n . $$

If you put them the way I had them at first, odd first and even second, you get a $4 (-1)^n$ addend that I thought was a bit too much work.

share|cite|improve this answer

Pythagorean triplets are of the form:

$$c = k(m^2+n^2) \hspace{1cm} b = 2kmn \hspace{1cm} a = k(m^2-n^2)$$

Where $k,m,n \in \mathbb{Z}^+$ so that:

$$c^2 = a^2 + b^2$$

You want $|a-b| = 1$ or equivalently, that: $k·|m^2-n^2-2mn| = 1$. So $k=1$ and $(m-n)^2-2n^2 = \pm 1$

Let $x = (m-n)$ and $y = n$. Then you have the equation $x^2-2y^2 =\pm 1$.

This is an example of what is called Pell's Equation and it has infinitely many positive integer solutions, so yes. There are infinitely many pythagorean triplets the sides of wich differ by a unit.

share|cite|improve this answer
You could trivially extend this to say that there are infinite number of triples that differ by $k$ units by simply multiplying each solution from this Pell's Equation by $k$, right? – corsiKa Aug 10 '14 at 19:44

Such a triple will be primitive. Thus there exist relatively prime integers $r$ and $s$, of opposite parity, such that the triple is given by $(r^2-s^2,2rs,r^2+s^2)$.

So we want $2rs-(r^2-s^2)=\pm 1$. This can be rewritten as $$(r+s)^2-2r^2=\pm 1.$$ Each of these Pell equations has infinitely many solutions.

Wikipedia has a reasonable discussion of Pell equations. One can give a recurrence that will generate all solutions. One can even give an explicit but not very useful "closed form" formula that will yield all solutions.

share|cite|improve this answer

DISCLAIMER: This answers the different question of having any two sides differ by $1$. This solution has the hypotenuse and one leg differing by $1$. It is nice in its own right, though.

There is a particularly simple family of solutions:

Choose any odd integer $a>1$. Then define $b=(a^2-1)/2$ and $c=(a^2+1)/2$. Then we have $$ \begin{align} a^2+b^2&=a^2+\frac{a^4-2a^2+1}{4}\\ &=\frac{a^4+2a^2+1}{4}\\ &=c^2 \end{align} $$ as desired. For instance this produces $a=5,b=12,c=13$ and so on.

share|cite|improve this answer
This is for the big number and one of the smallest to differ by one. – Darth Geek Aug 10 '14 at 18:59
@DarthGeek: You are right, sorry! – String Aug 10 '14 at 19:00

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.