# Is there a name for this form of Pythagorean triplet?

**URL:** <https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518>\
**Category:** Factual Questions\
**Created:** [March 28, 2005, 12:00am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518 "2005-03-28T00:00:46Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![chukhung](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@chukhung](https://boards.straightdope.com/u/chukhung)\
**Post date:** [March 28, 2005, 12:00am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/1 "2005-03-28T00:00:46Z")

</div>

A Pythagorean triplet is, of course, a set {_a, b, c_} of three integers such that  
_a_[Sup]2[/sup] + _b_[Sup]2[/Sup] = _c_[Sup]2[/Sup]  
Is there a name for Pythagorean triplets where the difference between _a_ and _b_ is exactly 1? For example, {3, 4, 5} or {20, 21, 29}.

Is there an “easy” way to generate triplets of this form?

---

<div class="post-metadata">

**Author:** ![spingears](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@spingears](https://boards.straightdope.com/u/spingears)\
**Post date:** [March 28, 2005, 1:14am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/2 "2005-03-28T01:14:14Z")

</div>

> [@chukhung](#):
>
> A Pythagorean triplet is, of course, a set {_a, b, c_} of three integers such that  
> _a_[Sup]2[/sup] + _b_[Sup]2[/Sup] = _c_[Sup]2[/Sup]  
> Is there a name for Pythagorean triplets where the difference between _a_ and _b_ is exactly 1? For example, {3, 4, 5} or {20, 21, 29}.

Don’t know.

> [@](#):
>
> Is there an “easy” way to generate triplets of this form?

\*\* Y E S \*\*

**[How to generate TPT’s](http://www.faust.fr.bw.schule.de/mhb/pythagen.htm)**

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [March 28, 2005, 2:15am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/3 "2005-03-28T02:15:05Z")

</div>

> [@chukhung](#):
>
> Is there an “easy” way to generate triplets of this form?

Easy in what sense? It’s really easy to code: give me an upper bound k, and for every integer i in [0, k - 1], I’ll see if i[sup]2[/sup] + (i + 1)[sup]2[/sup] is a perfect square. It’s not real fast, but it’s a simple algorithm.

---

<div class="post-metadata">

**Author:** ![A.I.Wintermute](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@A.I.Wintermute](https://boards.straightdope.com/u/A.I.Wintermute)\
**Post date:** [March 28, 2005, 5:27am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/4 "2005-03-28T05:27:24Z")

</div>

In playing around with numbers a bit while bored in high school math classes, I happened across a simple method to, for a given number, find a pythagorean triple containing that number. It was pretty easy to identify a pattern for odd numbers just from examples I knew such as (3,4,5) and (7,24,25). Square the given number, divide it in half, and round up and down to find the other two numbers. This does only find triples for which the given number is the smallest of the three, but they do satisfy your condition of two of the numbers differing by 1.

I found I could extend this pattern to even numbers by dividing the square of the number by 4 rather than 2, and then taking plus or minus one rather than one half. This results in the larger two numbers in the triple differing by two, however, so they will not work.

Yeah, I know… I was bored. And I had to at least pretend I was paying attention, so it had to be stuff I could do in my head. I was pretty good at squaring numbers in my head, it was my parlor trick in 8th grade. Despite the obvious uselessness of my little discoveries, I was curious enough to spend some time outside of class (when I don’t have to worry about paying no attention to my surroundings) working out the algebra behind it.

For a given positive odd integer n:  
(n[sup]2[/sup]/2 - 1/2)[sup]2[/sup] - (n[sup]2[/sup]/2 + 1/2)[sup]2[/sup] --\> (n[sup]4[/sup]/4 + n[sup]2[/sup]/2 + 1/4) - (n[sup]4[/sup]/4 - n[sup]2[/sup]/2 + 1/4) --\> n[sup]2[/sup]  
So, we have a set of three numbers [n, (n[sup]2[/sup]/2 - 1/2), (n[sup]2[/sup]/2 + 1/2)] that obeys the Pythagorean Theorem and whose two largest elements differ by one.

I see no way to extend this little trick to find triples such as your example, in which the smaller two values differ by one, or to find triples containing a given even number. But if you just need a way to find an indefinite number of such triples rather than all such triples, then I guess this math-class occupation wasn’t quite so useless as I thought it was back then.

---

<div class="post-metadata">

**Author:** ![A.I.Wintermute](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@A.I.Wintermute](https://boards.straightdope.com/u/A.I.Wintermute)\
**Post date:** [March 28, 2005, 5:33am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/5 "2005-03-28T05:33:05Z")

</div>

Hmm, all that proofreading and I didn’t bother to check my equations :smack: . In the little algebra bit I did I reversed the two terms I was subtracting. So for all two of you who didn’t skip right past the poorly formatted math, subtract those in the other direction, please.

---

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [March 28, 2005, 6:18am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/6 "2005-03-28T06:18:01Z")

</div>

Finding Pythagorean triples whose legs differ by one, n[sup]2[/sup]+(n+1)[sup]2[/sup]=m[sup]2[/sup], is closely related to a family of Diophantine equations sometimes called _Pell’s equation_ (which has general form a[sup]2[/sup]-Db[sup]2[/sup]=c, though often it’s called Pell’s equation only for c=1). You can see this by rewriting the equation as (2n+1)[sup]2[/sup]+1=2m[sup]2[/sup], which is of the generalized Pell form with a=2n+1, b=m, D=2, c=-1.

For c=+/-1, as is the case here, a relatively straightforward algorithm exists to find solutions. By further rewriting the equation as ((2n+1)/m)[sup]2[/sup] = 2 - 1/m[sup]2[/sup] you can see that the values (2n+1)/m are good rational approximations to sqrt(2). In fact they are among the best rational approximations possible (among all rationals with positive denominators less than or equal to m), a result known as _Hurwitz’s Theorem_. All of these good rational approximations are easy to find efficiently, as the convergents to the continued fraction expansion of sqrt(2). (There are simple recursion relations for computing these convergents, but I won’t state them here in case you want to try to find them.) Not every convergent gives a solution of the form you’re looking for (the convergent 17/12, for example, gives n=8, m=12, but 8[sup]2[/sup]+9[sup]2[/sup]=145 --close but not quite). But you can generate as many of these convergents as you like (and test each one). This is substantially quicker than a brute-force search.

As in most Diophantine analysis, solutions involve a lot more number theory than you might expect on first glance.

---

<div class="post-metadata">

**Author:** ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)\
**Post date:** [March 28, 2005, 1:58pm UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/7 "2005-03-28T13:58:13Z")

</div>

As in **Wintermute’s** case, I screwed around with Pythagoras’ theorem, and found that you could easily find triples in which the _longer_ leg and the hypoteneuse differ by one (not what you’re asking, I know). In that case the legs had the equations **2n + 1** , **2n^2 + 2n** and **2n^2 + 2n + 1**. In iother words, every odd integer is the short leg in such a triplet, since **n** can take on all integral values. Furthermore, **n** is the radius of the circle inscribed in such a triangle, and the place where it touches each side separates that side into portions of integral length.

Using the ruile that you can generate Pythagorean triples using **2mn** , **m^2-n^2** and **m^2+n^2** , yopu can calculate that you can generate such pair by chooising values of **n** that generate integral values of **m** in((2n+1)+(4n+1)^(1/2))/2 or ((2n+1)-(4n+1)^(1/2))/2.

---

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [March 28, 2005, 8:32pm UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/8 "2005-03-28T20:32:30Z")

</div>

Looking at my results a little more closely, I can prove that every even continued-fraction convergent to sqrt(2) (but none of the odd ones) generates such a Pythagorean triple (numbering the convergents (1/1, 3/2, 7/5, 17/12, 41/29, 99/70, …) starting with 0). Because only the convergents can generate such triples (by Hurwitz’ theorem), this now provides a convenient form for generating all such triples. Using the closed form for the 2kth convergent to r=sqrt(2) gives the closed form (spoiled for your mathematical puzzling pleasure!)n[sub]2k[/sub]=((1+r)[sup]2k+1[/sup]+(1-r)[sup]2k+1[/sup]-2) / 4  
m[sub]2k[/sub]=((1+r)[sup]2k+1[/sup]-(1-r)[sup]2k+1[/sup]) / 2rfor the kth triple (n,n+1;m) satisfying n[sup]2[/sup]+(n+1)[sup]2[/sup]=m[sup]2[/sup].

---

<div class="post-metadata">

**Author:** ![Meeko](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Meeko](https://boards.straightdope.com/u/Meeko)\
**Post date:** [March 28, 2005, 10:21pm UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/9 "2005-03-28T22:21:44Z")

</div>

We didn’t even call them triplets… Just 3-4-5 triangle or 5-12-13 etc.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [March 30, 2005, 12:56am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/10 "2005-03-30T00:56:11Z")

</div>

> [@](#):
>
> Furthermore, n is the radius of the circle inscribed in such a triangle, and the place where it touches each side separates that side into portions of integral length.

I think that this last bit is true for all Pythagorean triplets: That is to say, given a right triangle with all three sides integers, the inscribed circle will divide each side into integral lengths. At least, that’s what I think I remember proving once upon a time.

---

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [March 30, 2005, 2:08am UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/11 "2005-03-30T02:08:40Z")

</div>

> [@Chronos](#):
>
> I think that this last bit is true for all Pythagorean triplets: That is to say, given a right triangle with all three sides integers, the inscribed circle will divide each side into integral lengths. At least, that’s what I think I remember proving once upon a time.

Yes, and even the restriction to a right triangle is hardly necessary: for any triangle with all sides integers, the inscribed circle will divide the sides into either all integral lengths or all half-integral lengths (but in the non-right case, the incircle’s radius will not generally be rational).

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [March 30, 2005, 9:35pm UTC](https://boards.straightdope.com/t/is-there-a-name-for-this-form-of-pythagorean-triplet/296518/12 "2005-03-30T21:35:04Z")

</div>

> [@](#):
>
> for any triangle with all sides integers, the inscribed circle will divide the sides into either all integral lengths or all half-integral lengths

Come to think of it, this is fairly simple to prove, but one has to jump through a few hoops to show that they’re always integers (as opposed to half-integers) for the right triangle case.
