The Pythagorean Theorem: Proofs, Triples and Applications

Updated 18 min read Beginner to intermediate Baca dalam Bahasa Indonesia

Geometry Proof Numbers Computing

Quick answer

The Pythagorean theorem says that in a right triangle the square of the hypotenuse equals the sum of the squares of the two legs: a^2+b^2=c^2. In pictures, the square built on the longest side has the same area as the two squares on the other sides together. It gives a missing side as c=√(a^2+b^2), shows that three sides form a right angle exactly when a^2+b^2=c^2, and, with whole numbers such as 3,4,5, produces the Pythagorean triples.

Key takeaways

  • In a right triangle with legs a,b and hypotenuse c: a^2+b^2=c^2; the missing hypotenuse is √(a^2+b^2) and a missing leg is √(c^2-a^2), with a subtraction under the root.
  • The theorem can be proved by rearranging areas, by similar triangles, by shearing squares (Euclid) or by the area of a trapezoid (Garfield); each takes only a few lines.
  • The converse is true: if a^2+b^2=c^2 the angle opposite c is a right angle, which is the idea behind squaring a corner with a 3–4–5 rope.
  • Euclid's formula (m^2-n^2, 2mn, m^2+n^2) builds every primitive triple; they grow in a tree from (3,4,5), and one leg is always a multiple of 3, one of 4 and one number of 5.
  • The distance between two points is √(\Delta x^2+\Delta y^2), and the diagonal of a box is √(l^2+w^2+h^2): the theorem used once in the plane and twice in space.
  • Generalizations: the law of cosines for any triangle, areas of similar shapes on the sides, the distance formula in any dimension, and Fermat's Last Theorem for higher powers.

What is the Pythagorean theorem?

In a right triangle with legs a and b and hypotenuse c, the Pythagorean theorem states that a^2+b^2=c^2. The legs are the two sides that meet at the right angle; the hypotenuse is the side opposite it, which is always the longest (see right triangles).

The equation is about area. The square built on the hypotenuse has exactly the same area as the two squares built on the legs added together, which is the picture in the tool below. The name honors Pythagoras of Samos (about 570–495 BCE), but the relation was known in Babylonia, India and China long before him; the history is at the end.

Two things follow at once:

  • A missing hypotenuse: c=√(a^2+b^2). For legs 3 and 4 it is √(9+16)=5. For two legs of 1 it is √2, which is irrational, and for legs 6 and 4 it is √(52)=2√(13) once you simplify the radical.
  • A missing leg: b=√(c^2-a^2), with a subtraction under the root, because the hypotenuse is the big one. For c=13 and a=5 it is √(169-25)=12.

Keep every length in the same unit, and keep the square root as a root, or in simplified form, until the final step. The theorem needs a right angle: for other triangles see the law of cosines in the section on generalizations below.

Try it: give two sides and get the third, exactly, with a square drawn on every side.

Interactive: find the missing side

Give two sides of a right triangle and get the third exactly, as a whole number or a root, with a square drawn on every side so you can see a² + b² = c².

How do you prove the Pythagorean theorem?

There are hundreds of proofs, and four of the clearest rearrange areas, use similar triangles, shear squares into rectangles, or add up a trapezoid; each takes only a few lines. Here they are, starting with the one in the tool below.

1. Rearranging four triangles. Take four copies of the right triangle, each of area \frac12ab, and fit them inside a square of side a+b. Two arrangements are possible. In the first, the triangles leave a tilted square of side c in the middle. In the second, the same triangles leave two squares, one of side a and one of side b. The big square has the same area both times, and so do the four triangles, so what is left over must be equal: c^2=(a+b)^2-4·\tfrac12ab=a^2+b^2. This is the diagram of the Chinese Zhoubi Suanjing. Slide a and b and switch the arrangement below.

Interactive: a proof by rearranging

Slide the legs a and b and switch between a tilted square on four triangles and two squares on the same four triangles: the empty area is c² or a² + b².

The altitude from the right angle C to the hypotenuse AB splits the triangle into two smaller triangles that are similar to the whole one, and splits the hypotenuse into two parts p and q.

2. Similar triangles. Draw the altitude from the right angle to the hypotenuse. It cuts the hypotenuse c into two pieces p and q with p+q=c, and cuts the triangle into two smaller ones, each similar to the whole by AA, as in similar triangles. Comparing the ratios of corresponding sides gives a/c=p/a and b/c=q/b, that is, a^2=cp and b^2=cq. Add them: a^2+b^2=c(p+q)=c· c=c^2.

3. Euclid's proof (Elements I.47). The same two equations say that if the altitude is extended through the square on the hypotenuse, it splits that square into two rectangles, one of area cp=a^2 and one of area cq=b^2. Euclid showed this without ratios, by shearing: a square and a rectangle on the same base and between the same parallels, cut in half by a diagonal, give triangles of equal area, so each square on a leg equals one rectangle of the big square.

4. Garfield's trapezoid (1876). Put two copies of the right triangle side by side so that the hypotenuses form a right angle; with a third right triangle of legs c and c in between, the figure is a trapezoid with parallel sides a and b and height a+b. Its area is \frac12(a+b)(a+b), and also the sum of the three triangles, \frac12ab+\frac12ab+\frac12c^2. So \frac12(a+b)^2=ab+\frac12c^2, which becomes a^2+2ab+b^2=2ab+c^2 and again a^2+b^2=c^2. James Garfield found it while he was a member of the US House of Representatives, and he became the 20th president five years later.

A collection by Elisha Loomis, in its 1940 edition, gathers about 370 proofs of the theorem.

How do you use the converse to check for a right angle?

If the three sides of a triangle satisfy a^2+b^2=c^2, the angle opposite c is a right angle; this converse is how builders square a corner with a 3–4–5 rope.

Why the converse is true. Suppose a triangle has sides a, b, c with a^2+b^2=c^2. Build a right triangle with legs a and b. By the theorem its hypotenuse is √(a^2+b^2)=c, so it has the same three sides as the given triangle. Two triangles with three equal sides are congruent (SSS), so the given triangle has a right angle too. Euclid proves it as proposition I.48, the last of Book I.

The 3–4–5 rope. Tie a loop of rope with 12 equal spaces marked by knots. Hold the knots 3 apart and 4 apart and pull the loop tight into a triangle: the sides are 3, 4 and 5, and 9+16=25, so the corner between the sides 3 and 4 is exactly square. Surveyors and builders have done this for thousands of years. Any multiple works equally well, such as 6–8–10 for a large room.

The diagonal check. A frame 2.4 m by 1.8 m is a rectangle only if its diagonals are 3.0 m, because 1.8^2+2.4^2=3.24+5.76=9.00=3.0^2. If a diagonal is longer or shorter, the frame is leaning.

What if the test fails? Then the angle is not a right angle, and the size of c^2 against a^2+b^2 tells which way it goes: a larger c^2 means an obtuse angle, a smaller one an acute angle, as set out under the types of triangles. The sides 5, 7, 9 give 25+49=74<81, so the biggest angle is obtuse.

What are Pythagorean triples and how do you find them?

A Pythagorean triple is a set of three positive whole numbers a,b,c with a^2+b^2=c^2, and Euclid's formula (m^2-n^2, 2mn, m^2+n^2) produces every primitive one. The triple (3,4,5) is the smallest; (5,12,13) and (8,15,17) follow. A multiple of a triple is a triple ((6,8,10) is twice (3,4,5)), so the interesting ones are the primitive triples, with no common factor, as in the greatest common divisor.

Euclid's formula. For whole numbers m>n>0 the triple (m^2-n^2, 2mn, m^2+n^2) works, because (m^2-n^2)^2+(2mn)^2=m^4-2m^2n^2+n^4+4m^2n^2=(m^2+n^2)^2. It is primitive exactly when m and n are coprime and one of them is even, and then it gives every primitive triple once.

mnPrimitive triple
213,4,5
325,12,13
418,15,17
437,24,25
5220,21,29
549,40,41
6112,35,37
7228,45,53

There are 16 primitive triples with hypotenuse at most 100, and 52 triples in all once the multiples are counted.

Patterns in every triple. In a primitive triple exactly one leg is even and the hypotenuse is odd. Among a,b,c one leg is a multiple of 3, one leg is a multiple of 4, and one of the three numbers is a multiple of 5, so abc is always divisible by 60 (see divisibility). The area \frac12ab is always a whole number.

All triangles with a given leg. Write a^2=c^2-b^2=(c-b)(c+b) and list the ways to factor a^2 into two numbers of the same parity. For a=12, a^2=144=2·72=4·36=6·24=8·18, giving (c,b)=(37,35),(20,16),(15,9),(13,5): four right triangles with a leg of 12.

Explore the lists below, then walk the tree.

Interactive: Pythagorean triples

List every triple up to a hypotenuse, find all whole-number right triangles that share a leg, or build a triple from m and n with Euclid's formula.

The tree of primitive triples. In 1934 the Swedish mathematician Berggren found that all primitive triples fit in one tree. The root is (3,4,5) and every triple has exactly three children, found with three fixed linear rules, so each primitive triple appears exactly once. With the odd leg first, (3,4,5) has the children (5,12,13), (21,20,29) and (15,8,17).

The triples are not just curiosities: \left(\frac35,\frac45\right) is a point of the unit circle because 3^2+4^2=5^2, and every triple gives such a point, as in the equation of a circle.

Interactive: the tree of primitive triples

Start at (3, 4, 5) and walk down Berggren's tree, where every primitive Pythagorean triple appears exactly once and each triple has three children.

How does the theorem give distances and diagonals?

The distance between two points is the hypotenuse of a right triangle whose legs are the horizontal and the vertical differences, so d=√((x_2-x_1)^2+(y_2-y_1)^2); one more use of the theorem gives the diagonal of a box in space.

In the plane. From (1,2) to (7,10) the legs are 6 and 8, so the distance is √(36+64)=10. Comparing squared distances needs no square root at all, which is how the quadrilateral tests check equal sides, and the equation (x-h)^2+(y-k)^2=r^2 of a circle is the distance formula saying "the distance to the center is r".

In space. Use the theorem twice. The diagonal of the floor of a box l× w is √(l^2+w^2), and this diagonal and the height h are the legs of a second right triangle whose hypotenuse is the diagonal of the box: d=√(l^2+w^2+h^2). A box 2×3×6 has diagonal √(4+9+36)=7, and the longest rod that fits in a box 3×4×12 is √(9+16+144)=13. A unit cube has diagonal √3. The same pattern, a sum of squared differences under a root, gives the distance in any number of dimensions.

Everyday uses.

  • A ladder 5 m long with its foot 1.4 m from the wall reaches √(25-1.96)=4.8 m up the wall.
  • A shortcut across a field 60 m by 80 m is 100 m, against 140 m along the edges.
  • A screen size is its diagonal. A 55-inch screen with the shape 16:9 has width and height proportional to 16 and 9, and √(16^2+9^2)=√(337), so it is about 47.9 in wide and 27.0 in high, since (55·16)/(√(337))≈47.9 and (55·9)/(√(337))≈27.0.
  • A paved diagonal path across a rectangular garden 30 m by 40 m is 50 m long; at 20 dollars per meter it costs 1,000 dollars.

Can the Pythagorean theorem be generalized?

Yes: the law of cosines extends it to every triangle, any similar shapes drawn on the three sides have areas that add up in the same way, the distance formula carries it into any dimension, and for powers above two the equation has no whole-number solutions at all.

  • The law of cosines. For any triangle, c^2=a^2+b^2-2ab\cos C. At a right angle \cos C=0 and the correction vanishes, which is the Pythagorean theorem; for an acute angle the correction subtracts, for an obtuse angle it adds. See solving a triangle.
  • Other shapes on the sides. Area grows with the square of length, so any similar figures built on the three sides satisfy A_a+A_b=A_c: semicircles, equilateral triangles, even copies of your favorite drawing. With semicircles, Hippocrates of Chios (5th century BCE) drew the two crescents (lunes) outside the hypotenuse's semicircle and showed that, for a right triangle, the two lunes together have exactly the area of the triangle.
  • Vectors and higher dimensions. If two vectors are perpendicular, |u+v|^2=|u|^2+|v|^2; this is the theorem for the triangle they span, and the distance in any number of dimensions is built from it.
  • A curved surface. On a sphere of radius 1, a triangle with a right angle satisfies \cos c=\cos a\cos b instead, with the sides measured along the surface. The plain theorem needs a flat plane.
  • Higher powers. The equation x^2+y^2=z^2 has infinitely many whole-number solutions, the triples above. For x^n+y^n=z^n with n\ge3 there are none in positive whole numbers. Pierre de Fermat wrote this in a margin around 1637, saying that he had a proof too long for the margin; the first proof was found by Andrew Wiles, with a gap closed by Richard Taylor, in 1995. This is Fermat's Last Theorem.

How do you use the Pythagorean theorem in code?

Use math.hypot for lengths, and integers with math.isqrt for exact tests. The square root of a float is rounded, so a right angle is best tested with whole numbers, and a huge or tiny length is best computed with hypot, which cannot overflow.

Python
from math import hypot, dist, isqrt, sqrt, gcd

def is_triple(a, b, c):
    return a * a + b * b == c * c                 # exact for whole numbers

def hyp_exact(a, b):                              # (isqrt, True) when the hypotenuse is whole
    s = a * a + b * b
    c = isqrt(s)
    return c, c * c == s

def primitive_triples(limit):                     # Euclid's formula
    out = []
    m = 2
    while m * m + 1 <= limit:
        for n in range(1, m):
            if (m - n) % 2 and gcd(m, n) == 1 and m * m + n * n <= limit:
                a, b = sorted((m * m - n * n, 2 * m * n))
                out.append((a, b, m * m + n * n))
        m += 1
    return sorted(out, key=lambda t: t[2])

>>> is_triple(5, 12, 13), is_triple(4, 5, 6)
(True, False)
>>> hyp_exact(8, 15), hyp_exact(1, 1)
((17, True), (1, False))
>>> primitive_triples(30)
[(3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), (20, 21, 29)]
>>> len(primitive_triples(100))
16
>>> hypot(3, 4), dist((1, 2), (7, 10)), hypot(2, 3, 6)   # 2D, between points, 3D
(5.0, 10.0, 7.0)
>>> sqrt(1.2 ** 2 + 3.5 ** 2) == 3.7                 # should be True: 1.2, 3.5, 3.7 is a triple
False
>>> hypot(1.2, 3.5) == 3.7
True
>>> sqrt(1e200 ** 2 + 1e200 ** 2)                    # squaring overflows
OverflowError: (34, 'Result too large')
>>> hypot(1e200, 1e200)
1.414213562373095e+200
JavaScript
Math.hypot(3, 4)                                   // 5
Math.hypot(1, 2, 2)                                // 3: the diagonal of a 1 by 2 by 2 box
const isTriple = (a, b, c) => a * a + b * b === c * c   // exact for whole numbers
isTriple(20, 21, 29)                               // true
Math.sqrt(1.2 ** 2 + 3.5 ** 2) === 3.7             // false: the float sum rounds, as in Python
C++
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

bool isTriple(int a, int b, int c) { return a * a + b * b == c * c; }   // exact for whole numbers

int isqrt(int n) { int r = 0; while ((r + 1) * (r + 1) <= n) r++; return r; }

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }

int main() {
  cout << isTriple(5, 12, 13) << " " << isTriple(4, 5, 6) << endl;      // 1 0
  int s = 8 * 8 + 15 * 15, c = isqrt(s);
  cout << c << " " << (c * c == s) << endl;                              // 17 1: the hypotenuse is whole

  for (int h = 1; h <= 30; h++)                                          // primitive triples up to 30
    for (int a = 1; a < h; a++)
      for (int b = a + 1; b < h; b++)
        if (isTriple(a, b, h) && gcd(a, b) == 1) cout << "(" << a << "," << b << "," << h << ") ";
  cout << endl;

  int count = 0;                                                         // Euclid's formula up to 100
  for (int m = 2; m * m + 1 <= 100; m++)
    for (int n = 1; n < m; n++)
      if ((m - n) % 2 == 1 && gcd(m, n) == 1 && m * m + n * n <= 100) count++;
  cout << count << endl;

  printf("%.1f %.1f\n", sqrt(3.0 * 3 + 4 * 4), sqrt(2.0 * 2 + 3 * 3 + 6 * 6));   // 2D and 3D lengths
  cout << (sqrt(1.2 * 1.2 + 3.5 * 3.5) == 3.7) << endl;                  // 0: the float sum rounds
  double big = 1e200;
  cout << (big * big > 1e308) << endl;                                   // 1: squaring overflows to inf
  return 0;
}

/* output:
1 0
17 1
(3,4,5) (5,12,13) (8,15,17) (7,24,25) (20,21,29)
16
5.0 7.0
0
1
*/

The pitfalls, in order of how often they bite:

PitfallWhat happensWhat to do
Testing a right angle with a float rootsqrt(1.2**2 + 3.5**2) == 3.7 is falsecompare whole numbers aa + bb == c*c, use Fraction as in real numbers in code, or math.isclose
Squaring a huge or tiny length1e200 ** 2 overflows, 1e-200 ** 2 becomes 0use math.hypot
int(sqrt(n)) for a big whole numberthe float root loses digits and the integer is off by oneuse math.isqrt
^ for a squareit is XOR, not a poweruse ** or multiply
Squaring a sum(a + b) ** 2 is not a**2 + b**2expand it: aa + 2ab + bb
Mixed units3 ft and 40 in give nonsenseconvert to one unit first

Who discovered the Pythagorean theorem?

No single person discovered it: the relation was used in Babylonia, India and China long before Pythagoras, and the first proofs we can read come from Euclid.

  • c. 1800 BCE. The Babylonian clay tablet Plimpton 322 lists what appear to be Pythagorean triples, such as (119,120,169), so the relation was in use a thousand years before Greek geometry.
  • c. 800–500 BCE. The Indian Sulba Sutras, rules for building altars, state that the rope along the diagonal of a rectangle produces the area of the squares on both sides together.
  • c. 570–495 BCE. Pythagoras of Samos, in southern Italy, founded the school that bears his name. Nothing he wrote survives, and the credit for the theorem comes from writers centuries later.
  • Before the 1st century BCE. The Chinese Zhoubi Suanjing explains the 3–4–5 triangle and a diagram with a tilted square, the gougu (leg-and-leg) theorem.
  • c. 300 BCE. Euclid's Elements proves the theorem as I.47 and its converse as I.48.
  • 12th century. Bhaskara II draws the rearrangement diagram with the single word "Behold!".
  • 1876. Garfield's trapezoid proof appears in print.
  • 1995. Wiles proves Fermat's Last Theorem, the answer to the question of whether the Pythagorean equation works with exponent three or more.

A popular story says that the Greeks were shaken by the discovery that the diagonal of a square is not a ratio of whole numbers, the first irrational number, which the theorem makes unavoidable: see the proof that the square root of 2 is irrational.

What mistakes do people make with the Pythagorean theorem?

The most common mistakes with the theorem are the nine below, each with the correct statement.

MistakeCorrect
❌ (a+b)^2=a^2+b^2(a+b)^2=a^2+2ab+b^2; the missing 2ab is exactly what the proof by rearranging accounts for.
❌ c=a+bc=√(a^2+b^2) is shorter than a+b: the hypotenuse is a shortcut.
❌ c^2=25, so c=25Take the square root: c=5.
❌ A missing leg is √(c^2+a^2)Subtract: b=√(c^2-a^2).
❌ √(a^2+b^2)=√(a^2)+√(b^2)A root of a sum is not the sum of the roots: √(9+16)=5, but √9+√(16)=7.
❌ Rounding early: c^2=2 so c=1.41√2 is irrational; keep √2 until the last step.
❌ Every right triangle has whole-number sidesLegs 1 and 1 give √2; whole-number sides are the special case of triples.
❌ The theorem tells whether a triangle looks right-angledIt only decides when the numbers match exactly; test with a^2+b^2=c^2, not by eye.
❌ Mixing unitsConvert first: legs of 3 ft and 40 in need one common unit.

Practice: test your understanding

These questions mix everything above. A wrong answer costs nothing here: read the hint and try again.

True or false?

Decide whether each statement is True or False.

  • In a right triangle, the square of the hypotenuse equals the sum of the squares of the legs.
  • The theorem holds for every triangle.
  • (a+b)^2=a^2+b^2.
  • (6,8,10) is a Pythagorean triple.
  • If a^2+b^2=c^2, the angle opposite c is a right angle.
  • A triangle with sides 4, 5 and 6 has a right angle.

Select all that apply

Choose all the Pythagorean triples.

  • (5,12,13)
  • (8,15,17)
  • (7,24,26)
  • (20,21,29)
  • (9,12,16)

The hypotenuse

The legs of a right triangle are 8 and 15. Find the hypotenuse.

A missing leg

The hypotenuse is 26 and one leg is 10. Find the other leg.

A square root left alone

The legs of a right triangle are 2 and 3. What is c^2?

A ladder

A 5 m ladder stands with its foot 3 m from a wall. How high up the wall does it reach, in meters?

A distance

Find the distance between (1,2) and (7,10).

A box

A box is 1 by 4 by 8. How long is its space diagonal?

The converse

Which triangle has a right angle?

  • sides 6,7,9
  • sides 7,24,25
  • sides 5,6,8
  • sides 4,5,7

Euclid's formula

Euclid's formula with m=4 and n=3 gives which triple?

  • (7,24,25)
  • (8,6,10)
  • (15,8,17)
  • (12,5,13)

A diagonal path

A rectangular garden is 24 m by 32 m. A paved path along the diagonal costs 30 dollars per meter. What does the path cost?

  • 1,200 dollars
  • 1,680 dollars
  • 840 dollars
  • 2,400 dollars

Higher powers

Which of these equations has solutions in positive whole numbers?

  • x^2+y^2=z^2
  • x^3+y^3=z^3
  • x^4+y^4=z^4
  • x^5+y^5=z^5

Summary: the Pythagorean theorem at a glance

  • Statement: right triangle with legs a,b and hypotenuse c: a^2+b^2=c^2; c=√(a^2+b^2), a leg is √(c^2-a^2).
  • Proofs: rearranging four triangles in an (a+b) square; similar triangles (a^2=cp, b^2=cq); Euclid's shearing; Garfield's trapezoid.
  • Converse: a^2+b^2=c^2⇒ right angle; the 3–4–5 rope, the diagonal check.
  • Triples: (m^2-n^2,2mn,m^2+n^2); primitive when \gcd(m,n)=1 and opposite parity; 60| abc; Berggren tree from (3,4,5).
  • Distance: √(\Delta x^2+\Delta y^2); box diagonal √(l^2+w^2+h^2).
  • Generalizations: law of cosines, similar shapes on the sides, any dimension, spheres (\cos c=\cos a\cos b), Fermat's Last Theorem.
  • Code: math.hypot, whole-number tests with isqrt, never float equality.

Glossary: key terms

Pythagorean theorem
The rule that in a right triangle the square of the hypotenuse equals the sum of the squares of the two legs.
Legs of a right triangle
The two sides of a right triangle that meet at the right angle, as opposed to the hypotenuse.
Converse of the Pythagorean theorem
The statement that a triangle whose sides satisfy a squared plus b squared equals c squared has a right angle opposite the side c.
Pythagorean triple
Three positive whole numbers a, b and c with a squared plus b squared equal to c squared, such as 3, 4 and 5.
Primitive Pythagorean triple
A Pythagorean triple whose three numbers have no common factor greater than 1, so it is not a multiple of a smaller triple.
Euclid's formula
The rule that for whole numbers m greater than n the numbers m squared minus n squared, 2mn and m squared plus n squared form a Pythagorean triple.
Berggren tree
The tree that starts at the triple 3, 4, 5 and gives every primitive Pythagorean triple exactly once through three rules that produce three children.
Distance formula
The formula that gives the distance between two points as the square root of the sum of the squared coordinate differences, found with the Pythagorean theorem.
Fermat's Last Theorem
The theorem that x to the power n plus y to the power n equals z to the power n has no solution in positive whole numbers when n is greater than 2.

Frequently asked questions

What is the Pythagorean theorem?

In a right triangle the square of the hypotenuse equals the sum of the squares of the two legs, written a squared plus b squared equals c squared. For legs 3 and 4 the hypotenuse is 5. It only holds for triangles with a right angle.

What is the formula for the Pythagorean theorem?

The formula is a squared plus b squared equals c squared, where c is the hypotenuse. The hypotenuse is the square root of a squared plus b squared, and a missing leg is the square root of c squared minus a squared.

Who discovered the Pythagorean theorem?

No single person did. Babylonian tablets from about 1800 BCE list triples, Indian and Chinese texts state the rule, and Euclid gave the first proofs that survive. It is named after Pythagoras of Samos, but nothing he wrote has survived.

How do you prove the Pythagorean theorem?

One proof puts four copies of the triangle inside a square of side a plus b. They leave either a tilted square of side c or two squares of sides a and b, so c squared equals a squared plus b squared. There are hundreds of other proofs.

What is the converse of the Pythagorean theorem?

If the sides of a triangle satisfy a squared plus b squared equals c squared, the angle opposite c is a right angle. It follows because a right triangle with legs a and b has the same three sides, so the two triangles are congruent.

What is the 3-4-5 rule?

It is a builder's method to make a right angle. Mark 3 units on one line and 4 units on the other from the corner; if the distance between the marks is exactly 5 units, the corner is square, because 3 squared plus 4 squared is 5 squared.

What are Pythagorean triples?

They are sets of three positive whole numbers a, b and c with a squared plus b squared equal to c squared, such as 3, 4, 5 and 5, 12, 13. A primitive triple has no common factor, and every other triple is a multiple of one.

How do you generate Pythagorean triples?

Use Euclid's formula: for whole numbers m greater than n, the numbers m squared minus n squared, 2mn and m squared plus n squared form a triple. With m 2 and n 1 it gives 3, 4, 5; with m 3 and n 2 it gives 5, 12, 13.

How does the Pythagorean theorem give the distance formula?

The segment between two points is the hypotenuse of a right triangle whose legs are the differences of the x and y coordinates. So the distance is the square root of the squared x difference plus the squared y difference.

How do you find the diagonal of a box?

Apply the theorem twice: the diagonal is the square root of length squared plus width squared plus height squared. A box 2 by 3 by 6 has a diagonal of the square root of 49, which is 7.

Does the Pythagorean theorem work for triangles that are not right triangles?

Not as stated. For any triangle use the law of cosines, c squared equals a squared plus b squared minus 2ab times the cosine of the angle between a and b. For a right angle the cosine is zero and it becomes the Pythagorean theorem.

Is there a Pythagorean theorem for cubes and higher powers?

There is no such equation with whole-number solutions. Fermat's Last Theorem says that x to the n plus y to the n equals z to the n has no positive whole-number solution for n greater than 2, and Andrew Wiles proved it in 1995.

How do you use the Pythagorean theorem in Python?

Use math.hypot for lengths, because it avoids overflow, and math.dist for the distance between points. To test a right angle compare whole numbers, a times a plus b times b equal to c times c, not float square roots, which round.

References

  1. Thomas L. Heath (translator) (1908). The Thirteen Books of Euclid's Elements (2nd ed.), Book I, propositions 47 and 48. Cambridge University Press.
  2. Eli Maor (2007). The Pythagorean Theorem: A 4,000-Year History. Princeton University Press.
  3. Elisha Scott Loomis (1940). The Pythagorean Proposition. National Council of Teachers of Mathematics.
  4. Otto Neugebauer and Abraham Sachs (1945). Mathematical Cuneiform Texts (the tablet Plimpton 322). American Oriental Society.
  5. James A. Garfield (1876). A new proof of the Pythagorean theorem. New-England Journal of Education, 3(14), 161.
  6. Python Software Foundation. The Python Standard Library: math (hypot, dist and isqrt). docs.python.org. https://docs.python.org/3/library/math.html.