Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pythagorean triple
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Generating a triple== {{main|Formulas for generating Pythagorean triples}} [[Image:PrimitivePythagoreanTriplesRev08.svg|thumb|300px|alt=Primitive Pythagorean triples shown as triangles on a graph|The primitive Pythagorean triples. The odd leg {{math|''a''}} is plotted on the horizontal axis, the even leg {{math|''b''}} on the vertical. The curvilinear grid is composed of curves of constant {{math|''m'' − ''n''}} and of constant {{math|''m'' + ''n''}} in Euclid's formula.]] [[Image:Pythagorean Triples from Grapher.png|300px|thumb|A plot of triples generated by Euclid's formula maps out part of the {{math|1=''z''{{sup|2}} = ''x''{{sup|2}} + ''y''{{sup|2}}}} cone. A constant {{math|''m''}} or {{math|''n''}} traces out part of a [[Conic section|parabola]] on the cone.]] '''Euclid's formula'''<ref>{{citation |date=June 1997 |last=Joyce |first=D. E.|author-link=David E. Joyce (mathematician) |chapter-url= https://mathcs.clarku.edu/~djoyce/java/elements/bookX/propX29.html |title=Euclid's Elements |chapter=Book X, Proposition XXIX |publisher=Clark University}}</ref> is a fundamental formula for generating Pythagorean triples given an arbitrary pair of integers {{math|''m''}} and {{math|''n''}} with {{math|''m'' > ''n'' > 0}}. The formula states that the integers :<math> a = m^2 - n^2 ,\ \, b = 2mn ,\ \, c = m^2 + n^2 </math> form a Pythagorean triple. For example, given :<math> m = 2 ,\ \, n = 1 </math> generate the primitive triple (3,4,5): :<math> a = 2^2 - 1^2 = 3 ,\ \, b = 2 \times 2 \times 1 = 4 ,\ \, c = 2^2 + 1^2 = 5. </math> The triple generated by [[Euclid]]'s formula is primitive if and only if {{math|''m''}} and {{math|''n''}} are [[coprime]] and exactly one of them is even. When both {{math|''m''}} and {{math|''n''}} are odd, then {{math|''a''}}, {{math|''b''}}, and {{math|''c''}} will be even, and the triple will not be primitive; however, dividing {{math|''a''}}, {{math|''b''}}, and {{math|''c''}} by 2 will yield a primitive triple when {{math|''m''}} and {{math|''n''}} are coprime.<ref>{{citation |first=Douglas W. |last=Mitchell |title=An Alternative Characterisation of All Primitive Pythagorean Triples |journal=The Mathematical Gazette |volume=85 |issue=503 |pages=273–5 |date=July 2001 |jstor=3622017 |doi=10.2307/3622017|s2cid=126059099 }}</ref> ''Every'' primitive triple arises (after the exchange of {{math|''a''}} and {{math|''b''}}, if {{math|''a''}} is even) from a ''unique pair'' of coprime numbers {{math|''m''}}, {{math|''n''}}, one of which is even. It follows that there are infinitely many primitive Pythagorean triples. This relationship of {{math|''a''}}, {{math|''b''}} and {{math|''c''}} to {{math|''m''}} and {{math|''n''}} from Euclid's formula is referenced throughout the rest of this article. Despite generating all primitive triples, Euclid's formula does not produce all triples—for example, (9, 12, 15) cannot be generated using integer {{math|''m''}} and {{math|''n''}}. This can be remedied by inserting an additional parameter {{math|''k''}} to the formula. The following will generate all Pythagorean triples uniquely: :<math> a = k\cdot(m^2 - n^2) ,\ \, b = k\cdot(2mn) ,\ \, c = k\cdot(m^2 + n^2)</math> where {{math|''m''}}, {{math|''n''}}, and {{math|''k''}} are positive integers with {{math|''m'' > ''n''}}, and with {{math|''m''}} and {{math|''n''}} coprime and not both odd. That these formulas generate Pythagorean triples can be verified by expanding {{math|''a''{{sup|2}} + ''b''{{sup|2}}}} using [[elementary algebra]] and verifying that the result equals {{math|''c''{{sup|2}}}}. Since every Pythagorean triple can be divided through by some integer {{math|''k''}} to obtain a primitive triple, every triple can be generated uniquely by using the formula with {{math|''m''}} and {{math|''n''}} to generate its primitive counterpart and then multiplying through by {{math|''k''}} as in the last equation. Choosing {{math|''m''}} and {{math|''n''}} from certain integer sequences gives interesting results. For example, if {{math|''m''}} and {{math|''n''}} are consecutive [[Pell number]]s, {{math|''a''}} and {{math|''b''}} will differ by 1.<ref>{{Cite OEIS|A000129|Pell numbers|mode=cs2}}</ref> Many formulas for generating triples with particular properties have been developed since the time of Euclid. ===Proof of Euclid's formula=== That satisfaction of Euclid's formula by ''a, b, c'' is [[Necessary and sufficient condition|sufficient]] for the triangle to be Pythagorean is apparent from the fact that for positive integers {{math|''m''}} and {{math|''n''}}, {{math|''m'' > ''n''}}, the {{math|''a''}}, {{math|''b''}}, and {{math|''c''}} given by the formula are all positive integers, and from the fact that :<math> a^2+b^2 = (m^2 - n^2)^2 + (2mn)^2 = (m^2 + n^2)^2 = c^2. </math> A proof of the ''necessity'' that ''a, b, c'' be expressed by Euclid's formula for any primitive Pythagorean triple is as follows.<ref>{{citation |last1=Beauregard |first1=Raymond A. |last2=Suryanarayan |first2=E. R. |chapter=Parametric representation of primitive Pythagorean triples |editor-first=Roger B. |editor-last=Nelsen |title=Proofs Without Words: More Exercises in Visual Thinking |year=2000 |publisher=[[Mathematical Association of America]] |isbn=978-0-88385-721-2 |volume=II |oclc=807785075 |page=[https://archive.org/details/proofswithoutwor0000nels/page/120 120] |chapter-url=https://archive.org/details/proofswithoutwor0000nels/page/120 }}</ref> All such primitive triples can be written as {{math|(''a'', ''b'', ''c'')}} where {{math|1=''a''{{sup|2}} + ''b''{{sup|2}} = ''c''{{sup|2}}}} and {{math|''a''}}, {{math|''b''}}, {{math|''c''}} are [[coprime]]. Thus {{math|''a''}}, {{math|''b''}}, {{math|''c''}} are [[pairwise coprime]] (if a prime number divided two of them, it would be forced also to divide the third one). As {{math|''a''}} and {{math|''b''}} are coprime, at least one of them is odd. If we suppose that {{math|''a''}} is odd, then {{math|''b''}} is even and {{math|''c''}} is odd (if both {{math|''a''}} and {{math|''b''}} were odd, {{math|''c''}} would be even, and {{math|''c''{{sup|2}}}} would be a multiple of 4, while {{math|''a''{{sup|2}} + ''b''{{sup|2}}}} would be [[modular arithmetic|congruent to 2 modulo 4]], as an odd square is congruent to 1 modulo 4). From <math>a^2+b^2=c^2,</math> assume {{math|''a''}} is odd. We obtain <math>c^2-a^2=b^2</math> and hence <math>(c-a)(c+a)=b^2.</math> Then <math>\tfrac{(c+a)}{b}=\tfrac{b}{(c-a)}.</math> Since <math>\tfrac{(c+a)}{b}</math> is rational, we set it equal to <math>\tfrac{m}{n}</math> in lowest terms. Thus <math>\tfrac{(c-a)}{b}=\tfrac{n}{m},</math> being the reciprocal of <math>\tfrac{(c+a)}{b}.</math> Then solving :<math>\frac{c}{b}+\frac{a}{b}=\frac{m}{n}, \quad \quad \frac{c}{b}-\frac{a}{b}=\frac{n}{m}</math> for <math>\tfrac{c}{b}</math> and <math>\tfrac{a}{b}</math> gives :<math>\frac{c}{b}=\frac{1}{2}\left(\frac{m}{n}+\frac{n}{m}\right)=\frac{m^2+n^2}{2mn}, \quad \quad \frac{a}{b}=\frac{1}{2}\left(\frac{m}{n}-\frac{n}{m}\right)=\frac{m^2-n^2}{2mn}.</math> As <math>\tfrac{m}{n}</math> is fully reduced, {{math|''m''}} and {{math|''n''}} are coprime, and they cannot both be even. If they were both odd, the numerator of <math>\tfrac{m^2-n^2}{2mn}</math> would be a multiple of 4 (because an odd square is congruent to 1 modulo 4), and the denominator 2''mn'' would not be a multiple of 4. Since 4 would be the minimum possible even factor in the numerator and 2 would be the maximum possible even factor in the denominator, this would imply {{math|''a''}} to be even despite defining it as odd. Thus one of {{math|''m''}} and {{math|''n''}} is odd and the other is even, and the numerators of the two fractions with denominator 2''mn'' are odd. Thus these fractions are fully reduced (an odd prime dividing this denominator divides one of {{math|''m''}} and {{math|''n''}} but not the other; thus it does not divide {{math|''m''{{sup|2}} ± ''n''{{sup|2}}}}). One may thus equate numerators with numerators and denominators with denominators, giving Euclid's formula :<math> a = m^2 - n^2 ,\ \, b = 2mn ,\ \, c = m^2 + n^2</math> with {{math|''m''}} and {{math|''n''}} coprime and of opposite parities. A longer but more commonplace proof is given in Maor (2007)<ref>[[Eli Maor|Maor, Eli]], ''The Pythagorean Theorem'', Princeton University Press, 2007: Appendix B.</ref> and Sierpiński (2003).<ref name=Sierpinski>{{citation |author-link=Waclaw Sierpinski |first=Wacław |last=Sierpiński |title=Pythagorean Triangles|title-link=Pythagorean Triangles |at=[https://books.google.com/books?id=6vOfpjmCd7sC&pg=PR4 pp. iv–vii] |year=2003 |publisher=Dover |isbn=978-0-486-43278-6 }}</ref> Another proof is given in {{slink|Diophantine equation|Example of Pythagorean triples}}, as an instance of a general method that applies to every [[homogeneous polynomial|homogeneous]] Diophantine equation of degree two. ===Interpretation of parameters in Euclid's formula=== Suppose the sides of a Pythagorean triangle have lengths {{math|''m''{{sup|2}} − ''n''{{sup|2}}}}, {{math|2''mn''}}, and {{math|''m''{{sup|2}} + ''n''{{sup|2}}}}, and suppose the angle between the leg of length {{math|''m''{{sup|2}} − ''n''{{sup|2}}}} and the [[hypotenuse]] of length {{math|''m''{{sup|2}} + ''n''{{sup|2}}}} is denoted as {{math|''β''}}. Then <math>\tan{\tfrac{\beta}{2}}=\tfrac{n}{m}</math> and the full-angle trigonometric values are <math>\sin{\beta}=\tfrac{2mn}{m^2+n^2}</math>, <math>\cos{\beta}=\tfrac{m^2-n^2}{m^2+n^2}</math>, and {{tmath|1=\tan{\beta}=\tfrac{2mn}{m^2-n^2} }}.<ref>{{citation |editor-first=Roger B. |editor-last=Nelsen |title=Proofs Without Words: Exercises in Visual Thinking |chapter-url=https://books.google.com/books?id=cyyhZr-SffcC |year=1993 |publisher=Mathematical Association of America |isbn=978-0-88385-700-7 |oclc=29664480 |last=Houston |first=David |chapter=Pythagorean triples via double-angle formulas |page=141}}</ref> ===A variant=== The following variant of Euclid's formula is sometimes more convenient, as being more symmetric in {{math|''m''}} and {{math|''n''}} (same parity condition on {{mvar|m}} and {{mvar|n}}). If {{math|''m''}} and {{math|''n''}} are two odd integers such that {{math|''m'' > ''n''}}, then :<math> a = mn ,\quad b =\frac {m^2 - n^2}{2} ,\quad c = \frac{m^2 + n^2}{2} </math> are three integers that form a Pythagorean triple, which is primitive if and only if {{math|''m''}} and {{math|''n''}} are coprime. Conversely, every primitive Pythagorean triple arises (after the exchange of {{math|''a''}} and {{math|''b''}}, if {{math|''a''}} is even) from a unique pair {{math|''m'' > ''n'' > 0}} of coprime odd integers.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)