# The Proof of Infinitude of Pythagorean Triples $(x,x+1,z)$

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.

• 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)$ – Peter Apr 21 '18 at 7:43
• Wow, how to know that? – kelvin hong 方 Apr 21 '18 at 7:54
• artofproblemsolving.com/community/c3046h1049346__2 – individ Apr 21 '18 at 8:50
• @individ thanks, but a relevant proof is better. – kelvin hong 方 Apr 21 '18 at 10:33
• 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 :) – Mr Pie Jun 20 '18 at 12:20

## 3 Answers

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.

• 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!!!! – kelvin hong 方 Apr 21 '18 at 10:43

$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.

• Wow, thanks for your solution! – kelvin hong 方 Apr 28 '18 at 2:54

Pythagorean triples where $$|A-B|=1$$ are scarce and get more rare with altitude but they can continue to be found, indefinitely, given arbitrary precision. (There are only $$22$$ of them with $$A,B,C<10.2\text{ quadrillion.})$$ Proof that there are in infinite number of them is shown by the following functions which accept and yield natural numbers without end.

Another way of putting it is that we are eliminating (subtracting) a countably infinite set of triples from another countably infinite set of triples and even when you subtract a supposedly larger $$\aleph_0$$ set from a smaller $$\aleph_0$$ set (odd numbers minus natural numbers) the results are still infinite because they can be mapped. Here we have all triples minus extraneous triples.

To find them in a timely manner, we can use the following function to find the right combination of $$(m,n)$$ to use in Euclid's formula. The $$\pm$$ is used because the triples alternate: $$A>B$$ and $$A. $$\text{With infinite integers input }(n=\sqrt{2*m^2\pm1}-m)\text{ will always output an integer for some }m.$$ For all $$M\in\mathbb{N}$$, whenever this function yields an integer $$>0$$, we have the $$(m,n)$$ we need for a triple. The following $$19$$ were generated (in $$4$$ seconds) in a loop of $$m=1\text{ to }16,000,000$$ and $$f(m,n)$$ shows the variable values needed to generate each triple using Euclid's formula. The $$g(n,k)$$ shows the values (generated in $$1$$ second) for an alternate set of functions in a loop of $$m=1\text{ to }5,000,000$$. $$A=m^2-n^2\qquad B=2mn\qquad C=M^2+n^2$$ $$f(2,1)=g(1,1)=(3,4,5)$$ $$f(5,2)=g(2,2)=(21,20,29)$$ $$f(12,5)=g(4,5)=(119,120,169)$$ $$f(29,12)=g(9,12)=(697,696,985)$$ $$f(70,29)=g(21,29)=(4059,4060,5741)$$ $$f(169,70)=g(50,70)=(23661,23660,33461)$$ $$f(408,169)=g(120,169)=(137903,137904,195025)$$ $$f(985,408)=g(289,408)=(803761,803760,1136689)$$ $$f(2378,985)=g(697,985)=(4684659,4684660,6625109)$$ $$f(5741,2378)=g(1682,2378)=(27304197,27304196,38613965)$$ $$f(13860,5741)=g(4060,5741)=(159140519,159140520,225058681)$$ $$f(33461,13860)=g(9801,13860)=(927538921,927538920,1311738121)$$ $$f(80782,33461)=g(23661,33461)=(5406093003,5406093004,7645370045)$$ $$f(195025,80782)=g(57122,80782)=(31509019101,31509019100,44560482149)$$ $$f(470832,195025)=g(137904,195025)=(183648021599,183648021600,259717522849)$$ $$f(1136689,470832)=g(332929,470832)=(1070379110497,1070379110496,1513744654945)$$ $$f(2744210,1136689)=g(803761,1136689)=(6238626641379,6238626641380,8822750406821)$$ $$f(6625109,2744210)=g(1940450,2744210)=(36361380737781,36361380737780,51422757785981)$$ $$f(15994428,6625109)=g(4684660,6625109)=(211929657785303,211929657785304,299713796309065)$$

The alternate formula mentioned above is slightly faster since it deals only with the subset of triples where $$GCD(A,B,C)=(2m-1)^2,m\in\mathbb{N}$$. We have the needed $$(n,k)$$ values whenever the following yields a positive integer.

$$k=\sqrt{\frac{(2n-1)^2\pm1}{2}}$$ Having found a needed $$(n,k)$$ the following will generate a needed triple. $$A=(2n-1)^2+2(2n-1)k\qquad B=2(2n-1)k+2k^2\qquad C=(2n-1)^2+2(2n-1)k+2k^2$$