Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Pythagorean Triple
(3, 4, 5)
a² + b² = c²
Leg a 3
Leg b 4
Hypotenuse c 5
Used m, n m = 2, n = 1

What is a Pythagorean Triple?

A Pythagorean triple is a set of three positive integers (a, b, c) that satisfy the Pythagorean theorem \(a^2 + b^2 = c^2\). The most familiar example is (3, 4, 5), since \(9 + 16 = 25\). This calculator generates such triples automatically from two seed integers using the classical Euclid formula.

Right triangle with legs a and b and hypotenuse c forming a Pythagorean triple
A Pythagorean triple describes the side lengths of a right triangle, where \(a^2 + b^2 = c^2\).

How to Use the Generator

Enter two whole numbers m and n with m greater than n (both at least 1, and m at least 2). Press calculate and the tool returns the triple (a, b, c) along with the values of m and n used. The legs are sorted so the shorter leg is shown first.

The Formula Explained

Euclid formula states that for any integers \(m > n > 0\), the values $$\left(a,\,b,\,c\right) = \left(\text{m}^2 - \text{n}^2,\ \ 2\,\text{m}\,\text{n},\ \ \text{m}^2 + \text{n}^2\right)$$ always form a Pythagorean triple. When m and n are coprime and not both odd, the result is a primitive triple (one that cannot be reduced by a common factor). Otherwise the triple is a scaled multiple of a primitive one.

Diagram showing inputs m and n mapping to triple a, b, c via Euclid formula
Euclid's formula maps two integers m and n to the triple \(a = \text{m}^2 - \text{n}^2\), \(b = 2\,\text{m}\,\text{n}\), \(c = \text{m}^2 + \text{n}^2\).

Worked Example

Take m = 2 and n = 1. Then $$a = 4 - 1 = 3, \quad b = 2 \times 2 \times 1 = 4, \quad c = 4 + 1 = 5.$$ The result is (3, 4, 5). Check: \(3^2 + 4^2 = 9 + 16 = 25 = 5^2\). Choosing m = 3, n = 2 gives \(a = 5\), \(b = 12\), \(c = 13\) — the well-known (5, 12, 13) triple.

FAQ

Why must m be greater than n? If \(n \geq m\) the leg \(a = \text{m}^2 - \text{n}^2\) would be zero or negative, which is not a valid side length.

Does this give every triple? Euclid formula generates every primitive triple exactly once (with coprime m, n of opposite parity), and all triples appear as scaled versions.

Is (a, b, c) the same as (b, a, c)? The two legs are interchangeable; this tool simply lists the smaller leg first for consistency.

Last updated: