Pythagorean Triple Generator

a² + b² = c²

CalculatorsFreeNo Signup
4.7(376 reviews)
All Tools

Loading tool...

About Pythagorean Triple Generator

A Pythagorean triple generator using Euclid's formula: a=m²−n², b=2mn, c=m²+n² with m>n>0, gcd(m,n)=1, opposite parity. Generates primitive and non-primitive triples, checks given triples, and shows tree structure. Client-side.

Pythagorean Triple Generator Features

  • Triple check
  • Euclid's formula
  • Primitive triples
  • Generation
  • Tree structure
Pythagorean triple: (a,b,c) with a²+b²=c². Primitive: gcd(a,b,c)=1. Euclid's formula: a=m²−n², b=2mn, c=m²+n² for m>n>0, coprime, opposite parity. First: (3,4,5), (5,12,13), (8,15,17), (7,24,25)... Infinitely many exist.

How to Use

Enter m and n (or check a triple):

  • Generate: Via Euclid's formula
  • Check: Verify a²+b²=c²
  • Primitive?: gcd=1 check

Euclid's Formula

For coprime m>n>0 with m−n odd: a=m²−n², b=2mn, c=m²+n² gives ALL primitive triples. Non-primitive: multiply by k. This parametrizes the entire set of Pythagorean triples.

Triple Tree

Berggren (1934): all primitive triples form a ternary tree rooted at (3,4,5). Three matrix transformations generate all children. Every primitive triple appears exactly once.

Step-by-Step Instructions

  1. 1Enter m and n.
  2. 2Generate triple.
  3. 3Check primitive.
  4. 4List multiples.
  5. 5Explore tree.

Pythagorean Triple Generator — Frequently Asked Questions

Does Euclid's formula give ALL triples?+

All primitive triples, yes. For non-primitive: multiply a primitive triple by any positive integer k. Together, this gives every Pythagorean triple exactly once. Euclid described this around 300 BCE.

How many primitive triples exist up to c?+

About c/(2π). More precisely, the number of primitive triples with hypotenuse ≤ N is asymptotically N/(2π). Including non-primitive: N²/(2π²). So they become relatively rare.

What about Fermat's Last Theorem?+

a²+b²=c² has infinitely many solutions. But aⁿ+bⁿ=cⁿ for n≥3 has NONE (Wiles, 1995). Pythagorean triples are the unique case where the sum of powers equals a power.

Share this tool: