Proof that there exists infinity positive integers triple $x^2+y^2=z^2$ that $x,y$ are consecutive integers, then exhibit five of them.

This is a question in my number theory textbook, the given hint is that
"If $x,x+1,z$ is a Pythagorean triple, then so does the triple $3x+2z+1,3x+2z+2, 4x+3z+2$"
I wondered how someone come up with this idea.

My solution is letting $x=2st, y=s^2-t^2, z=s^2+t^2$ by $s>t, \gcd(s,t)=1$.then consider two cases: $y=x+1$ and $y=x-1$
Case 1: $y=x+1$
Gives me $(s-t)^2-2t^2=1$ then I found this is the form of Pell's equation, I then found $$\begin{align}s&=5,29,169,985,5741\\t&=2,12,20,408,2378\end{align}$$then yields five triples $$(20,21,29),(696,697,985),(23660,23661,33461),(803760,803761,1136689),(27304196,27304197,38613965)$$ Case 2:$y=x-1$
Using the same method, I come up with Pell's equation $(s+t)^2-2s^2=1$, after solve that I also get five triples: $$(4,3,5),(120,119,169),(4060,4059,5741),(137904,137903,195025),(4684660,4684659,6625109)$$

I have wondered why the gaps between my solution are quite big, with my curiosity, I start using question's hint and exhibit ten of the triples:$$(3,4,5),(20,21,29),(119,120,169),(696,697,985),(4059,4060,5741),(23660,23661,33461),(137903,137904,195025),(803760,803761,1136689),(4684659,4684660,6625109),(27304196,27304197,38613965)$$ These are actually the same as using solutions alternatively from both cases. But I don't know is this true after these ten triples

Basically the problem was solved, but I would glad to see if someone provide me a procedure to come up with the statement
"If $x,x+1,z$ is a Pythagorean triple, then so does the triple $3x+2z+1,3x+2z+2, 4x+3z+2$", and prove that there are no missing triplet between it.

--After edit--

Thanks to @Dr Peter McGowan !, by the matrix
$$ \begin{bmatrix} 1 & 2 & 2 \\ 2 & 1 & 2\\ 2 & 2 & 3 \end{bmatrix} \begin{bmatrix} x\\x+1\\z \end{bmatrix} = \begin{bmatrix} 3x+2z+2\\3x+2z+1\\4x+3z+2 \end{bmatrix}$$ gives me the hinted statement.

  • 4
    $\begingroup$ Hint : If $(a/b)$ is a solution of the Pell-equation $a^2-2b^2=-1$ , then the next solution is $(3a+4b/2a+3b)$ $\endgroup$
    – Peter
    Apr 21, 2018 at 7:43
  • $\begingroup$ Wow, how to know that? $\endgroup$ Apr 21, 2018 at 7:54
  • $\begingroup$ artofproblemsolving.com/community/c3046h1049346__2 $\endgroup$
    – individ
    Apr 21, 2018 at 8:50
  • $\begingroup$ @individ thanks, but a relevant proof is better. $\endgroup$ Apr 21, 2018 at 10:33
  • 1
    $\begingroup$ Go here. It will take you to a question of mine where I prove the infinitude of Pythagorean Triples... but not using Pell equations, however. Nonetheless, this post might serve more use if $z=x+1$ as opposed to $y$, since I show that $$(2v^2+2v)^2+(2v+1)^2=(2v^2+2v+1)^2\;\forall v.$$ Still, it might increase your understanding on Pythagorean Triples :) $\endgroup$
    – Mr Pie
    Jun 20, 2018 at 12:20

3 Answers 3


$x,x+1,z$ is a Pythagorean triple iff $(2x+1)^2+1=2z^2$.

Let $u=2x+1$. Then $u^2-2z^2=-1$, a negative Pell equation whose solution lies in considering the units of $\mathbb Z[\sqrt 2]$ of norm $-1$.

It is clear that $\omega=1+\sqrt 2$ is a fundamental unit with norm $-1$. Therefore, all the other solutions of $u^2-2z^2=-1$ come from odd powers of $\omega$.

Thus, if $(u_k,z_k)$ is a solution of $u^2-2z^2=-1$, then the next one is given by

$$\begin{align} u_{k+1}+z_{k+1}\sqrt 2&=(u_k+z_k\sqrt 2)\omega^2 \\ &=(u_k+z_k\sqrt 2)(3+2\sqrt 2) \\ &=(3u_k+4z_k)+(2u_k+3z_k)\sqrt 2 \end{align}$$ So, $u_{k+1}= 3u_k+4z_k$ and $z_{k+1}=2u_k+3z_k$.

Now let $u_{k+1}=2x_{k+1}+1$.

Then $$x_{k+1}=\frac{u_{k+1}-1}{2}=\frac{(3u_k+4z_k)-1}{2}=\frac{3(2x_k+1)+4z_k-1}{2}=3x_k+2z_k+1$$ and $$z_{k+1}=4x_k+3z_k+2$$ as claimed.

  • $\begingroup$ Wow, thanks for your solution! $\endgroup$ Apr 28, 2018 at 2:54

You are on the right track. The simplest solution is to recall that all irreducible Pythagorean triples for a rooted ternary tree beginning with $(3, 4, 5) $ triangle. B Berggren discovered that all others can be derived from this most primitive triple. F J M Barning set these out as three matrices that when pre-multiplied by a "vector" of a Pythagorean triple produces another. For the case of consecutive legs we have, starting with $(x_1, y_1, z_1) $, we may calculate the next triple as follows:

$$\begin {align} x_2&=x_1+2y_1+2z_1 \\ y_2&=2x_1+y_1+2z_1 \\ z_2&=2x_1+2y_1+3z_1 \end {align} $$

The hint you were given is a variation on the above more general formula specific for consecutive leg lengths. It is an easy proof by induction to show that the formulas are correct. The first few are:

$(3, 4, 5); (20, 21, 29); (119, 120, 169); (696, 697, 985); (4059, 4060, 5741); (23660, 23661, 33461)$; etc. Obviously, this can be continued indefinitely.

The sequence rises geometrically. A simple explicit formula is available for these solutions that are (as you have already guessed) alternating solutions to Pell's equation.

  • $\begingroup$ Wow, although I have seen that matrix before but don't realize it can be so useful! I have found the related matrix and actually come out with the desired result.Thanks a lot!!!! $\endgroup$ Apr 21, 2018 at 10:43

By the nature of the formulas below, we can see that there are infinite Pythagorean triples where $A-B=\pm1$.

We can generate these triples sequentially with a formula that starts with a seed of $A_0,B_0,C_0=0,0,1$: $$A_{n}=3A_{n-1}+2C_{n-1}+1\quad B_{n}=3A_{n-1}+2C_{n-1}+2\quad C_{n}=4A_{n-1}+3C_{n-1}+2$$

or we can generate the $(m,n)$s for Euclid's formula using Pell numbers to find $x^{th}$ triple directly:

$$m_x=\frac{(1+\sqrt{2})^{x+1}-(1-\sqrt{2})^{x+1}}{2\sqrt{2}}\quad n_x=\frac{(1+\sqrt{2})^{x}-(1-\sqrt{2})^{x}}{2\sqrt{2}}$$

$$A=m^2-n^2\qquad B=2mn\qquad C=M^2+n^2$$ $$f(2,1)=(3,4,5)$$ $$f(5,2)=(21,20,29)$$ $$f(12,5)=(119,120,169)$$ $$f(29,12)=(697,696,985)$$ $$f(29,12)=(4059,4060,5741)$$ $$f(169,70)=(23661,23660,33461)$$ $$f(408,169)=(137903,137904,195025)$$ $$f(985,408)=(803761,803760,1136689)$$ $$f(2378,985)=(4684659,4684660,6625109)$$ $$f(5741,2378)=(27304197,27304196,38613965)$$ $$f(13860,5741)=(159140519,159140520,225058681)$$ $$f(33461,13860)=(927538921,927538920,1311738121)$$ $$f(80782,33461)=(5406093003,5406093004,7645370045)$$ $$f(195025,80782)=(31509019101,31509019100,44560482149)$$ $$f(470832,195025)=(183648021599,183648021600,259717522849)$$ $$f(1136689,470832)=(1070379110497,1070379110496,1513744654945)$$ $$f(2744210,1136689)=(6238626641379,6238626641380,8822750406821)$$ $$f(6625109,2744210)=(36361380737781,36361380737780,51422757785981)$$ $$f(15994428,6625109)=(211929657785303,211929657785304,299713796309065)$$


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.