math.wiki
Number theory › Quadratic residues and beyond › Pythagorean triples and Fermat's last theorem for n = 4
Sign in

Pythagorean triples and Fermat's last theorem for n = 4

One formula lists every right triangle with whole-number sides. Can both legs of such a triangle be perfect squares, and what does the answer say about x^4 + y^4 = z^4?

Where you are 5 in Quadratic residues and beyond

Why this exists

Every Pythagorean triple is a multiple of one from Euclid’s formula \left(m^2 - n^2,\ 2mn,\ m^2 + n^2\right), as Pythagorean triples proves. So x^2 + y^2 = z^2 has infinitely many solutions in positive integers, and a complete list of them.

Fermat wrote in the margin of his copy of Diophantus’s Arithmetica that x^n + y^n = z^n has no solution in positive integers for n \ge 3, and that the margin was too small for his proof. No proof of that claim by him is known. What does survive, in another note in the same book, is an argument by descent that the area of a right triangle with whole-number sides is never a square.

This lesson settles the exponent 4 in that spirit. The triple formula, used twice, turns a supposed solution of x^4 + y^4 = z^2 into a smaller one, and positive integers cannot shrink forever.

Definition

A Pythagorean triple is a triple (a, b, c) of positive integers with a^2 + b^2 = c^2. It is primitive when \gcd(a, b, c) = 1. A prime dividing two of a, b, c divides the third (Pythagorean triples), so a triple is primitive exactly when \gcd(a, b) = 1.

For a prime p and a positive integer n, v_p(n) is the exponent of p in the prime factorization of n (0 when p \nmid n). By Every number has exactly one prime factorization it is well defined, n = \prod_p p^{v_p(n)}, and v_p(st) = v_p(s) + v_p(t). So for k \ge 1, n is the kth power of a positive integer exactly when k \mid v_p(n) for every prime p: if so, n = \left(\prod_p p^{v_p(n)/k}\right)^k, and conversely n = w^k gives v_p(n) = k\,v_p(w).

Infinite descent proves that an equation has no solution in positive integers. Attach to each solution a positive integer, its size, and show that every solution produces one of strictly smaller size. By the well-ordering principle (Strong induction and well-ordering, which uses descent on x^3 = 2y^3), a solution of least size would exist, and the smaller one built from it is a contradiction.

Intuition

A solution of x^4 + y^4 = z^2 is a Pythagorean triple (x^2, y^2, z) whose legs are both perfect squares. Euclid’s formula opens that triangle into its parameters m and n, and they satisfy x^2 + n^2 = m^2: a second triangle, (x, n, m). Open that one too. Its parameters, and m, are forced to be squares u^2, v^2, w^2 with u^4 + v^4 = w^2: a triangle of the first kind again, with hypotenuse w smaller than z. Figure 1 shows one round.

x^2
y^2
z
a solution
x
n
m
its parameters
u^2
v^2
w
a smaller solution
Figure 1One step of the descent. A solution of x^4 + y^4 = z^2 is a triangle with square legs; its parameters form a second triangle, whose parameters are squares that make a third triangle of the first kind, with w < z.

The equation has z^2, not z^4, on purpose. The new w has no reason to be a square, so a descent for x^4 + y^4 = z^4 alone would not close up. The stronger statement is the one that lands back in itself.

Results

Lemma 1 (coprime factors of a power). Let k \ge 2, and let u_1, \dots, u_r be pairwise coprime positive integers whose product is the kth power of a positive integer. Then each u_i is the kth power of a positive integer.

Theorem 2 (Euclid’s formula). Let (a, b, c) be a primitive triple with b even. Then a and c are odd, and there are unique coprime positive integers m > n, one even and one odd, with

a = m^2 - n^2, \quad b = 2mn, \quad c = m^2 + n^2.

Conversely, every such pair gives a primitive triple. In every primitive triple exactly one leg is even.

Theorem 3 (Fermat). There are no positive integers x, y, z with x^4 + y^4 = z^2.

Corollary 4 (Fermat’s last theorem for multiples of 4). If 4 \mid n, there are no positive integers x, y, z with x^n + y^n = z^n. In particular x^4 + y^4 = z^4 has none.

Theorem 5. There are no positive integers x, y, z with x^4 - y^4 = z^2.

Corollary 6 (Fermat’s right triangle theorem). (a) No Pythagorean triple has both legs perfect squares, and none has a leg and the hypotenuse both perfect squares. (b) The area ab/2 of a Pythagorean triple (a, b, c) is never a perfect square.

Why it is true

Lemma 1. Write u_1 \cdots u_r = w^k and fix a prime p. Since the u_i are pairwise coprime, p divides at most one of them. If it divides u_j, then v_p(u_j) = v_p(u_1 \cdots u_r) = k\,v_p(w) and every other v_p(u_i) is 0; if it divides none, all are 0. So k \mid v_p(u_i) for every i and p, and each u_i is a kth power.

Theorem 2 is proved in Pythagorean triples: with a odd, (c + a)/2 and (c - a)/2 are coprime with product (b/2)^2, so Lemma 1 with k = 2 makes them m^2 and n^2.

Theorem 3. Suppose solutions exist, and choose one with z as small as possible.

Step 1: \gcd(x, y) = 1. If a prime p divides x and y, then p^4 \mid z^2, so 2v_p(z) \ge 4 and p^2 \mid z, and (x/p,\ y/p,\ z/p^2) is a solution with smaller third entry.

Step 2: the first triangle. Now (x^2, y^2, z) is a triple, primitive because a prime dividing x^2 and y^2 divides x and y. Exactly one leg is even; by symmetry take y even, x odd. Theorem 2 gives coprime m > n > 0 of opposite parity with

x^2 = m^2 - n^2, \quad y^2 = 2mn, \quad z = m^2 + n^2.

Step 3: the second triangle. If m were even and n odd, then x^2 \equiv 0 - 1 \equiv 3 \pmod 4, but squares are 0 or 1 \pmod 4. So m is odd and n even. Then x^2 + n^2 = m^2 makes (x, n, m) a triple, primitive since \gcd(n, m) = 1, with even leg n. Theorem 2 gives coprime r > s > 0 with

x = r^2 - s^2, \quad n = 2rs, \quad m = r^2 + s^2.

Step 4: three squares. Since y is even, (y/2)^2 = mn/2 = mrs. The numbers m, r, s are pairwise coprime: \gcd(r, s) = 1, and a prime dividing m and r divides m - r^2 = s^2, hence s; likewise for m and s. Lemma 1 gives positive integers u, v, w with r = u^2, s = v^2, m = w^2.

Step 5: the smaller solution. Then m = r^2 + s^2 reads u^4 + v^4 = w^2, and w \le w^2 = m \le m^2 < m^2 + n^2 = z. This contradicts the choice of z.

Corollary 4. If n = 4k and x^n + y^n = z^n, then \left(x^k\right)^4 + \left(y^k\right)^4 = \left(z^{2k}\right)^2, against Theorem 3.

Theorem 5. Choose a solution with x as small as possible. As in Step 1, a common prime factor p of x and y gives the smaller solution (x/p,\ y/p,\ z/p^2), so \gcd(x, y) = 1, and z^2 + (y^2)^2 = (x^2)^2 is a primitive triple with hypotenuse x^2.

Case 1: y odd. Theorem 2 gives y^2 = m^2 - n^2, z = 2mn, x^2 = m^2 + n^2. Then m^4 - n^4 = (m^2 - n^2)(m^2 + n^2) = (xy)^2, a positive solution with m^2 < x^2, so m < x.

Case 2: y even. Now y^2 = 2mn, x^2 = m^2 + n^2, z = m^2 - n^2. Since \gcd(m, n) = 1, (m, n, x) is a primitive triple; call its even leg e and odd leg o. Theorem 2 gives coprime r > s > 0 of opposite parity with e = 2rs, o = r^2 - s^2, x = r^2 + s^2, so

\left(\frac{y}{2}\right)^2 = \frac{eo}{2} = rs(r - s)(r + s).

These four positive factors are pairwise coprime. A prime dividing r or s and also r \pm s divides both r and s. A prime dividing r + s and r - s divides 2r and 2s, and it is odd because r \pm s are odd, so again it divides r and s. By Lemma 1, r = a^2, s = b^2, r + s = c^2, r - s = d^2, and a^4 - b^4 = r^2 - s^2 = (cd)^2, a positive solution with a \le a^2 = r < r^2 + s^2 = x. Both cases contradict the choice of x.

Corollary 6. (a) Legs x^2 and y^2 with hypotenuse c give x^4 + y^4 = c^2, against Theorem 3. A leg y^2, hypotenuse x^2 and other leg b give x^4 - y^4 = b^2, against Theorem 5.

(b) A triple is k times a primitive one, with k^2 times the area, so take it primitive. By Theorem 2 its area is \tfrac12 (m^2 - n^2)(2mn) = mn(m - n)(m + n), and these four factors are pairwise coprime by the argument of Case 2. A square product would give m = e^2, n = f^2, m + n = g^2, m - n = h^2 by Lemma 1, and then e^4 - f^4 = (gh)^2, against Theorem 5.

Worked examples

Example 1

Tracing the descent on a near miss

The triple (25, 312, 313) has its odd leg 25 = 5^2 a square. Run the proof of Theorem 3 on it, as if 312 were y^2, and find where the chain breaks.

Solution

The triple is primitive, because 313 is prime and divides neither leg. With x = 5, Theorem 2 recovers the parameters:

\begin{aligned} m^2 &= \frac{313 + 25}{2} = 169, \\ n^2 &= \frac{313 - 25}{2} = 144, \end{aligned}

so m = 13 and n = 12, and indeed 2mn = 312. As Step 3 predicts, m is odd and n even, and 25 + 144 = 169 gives the second triangle (5, 12, 13). Its parameters are r^2 = (13 + 5)/2 = 9 and s^2 = (13 - 5)/2 = 4, so r = 3 and s = 2.

Step 4 needs (y/2)^2 = mrs = 13 \cdot 3 \cdot 2 = 78. The three factors are pairwise coprime, as the proof says, but none is a square, so 312 = 4 \cdot 78 is not a square; it lies between 17^2 = 289 and 18^2 = 324. One square leg is easy to get, and Theorem 3 says the second never comes with it.

Example 2

Which exponents are settled

Prove that if x^d + y^d = z^d has no solution in positive integers for d = 4 and for every odd prime d, then it has none for any exponent n \ge 3. Then say which case covers n = 12, n = 6 and n = 2026.

Solution

Let n \ge 3. If n has an odd prime factor p, set d = p. Otherwise n is a power of 2 with n \ge 4, so d = 4 divides n. Either way n = de, and a solution of x^n + y^n = z^n gives

\left(x^e\right)^d + \left(y^e\right)^d = \left(z^e\right)^d,

a solution for the exponent d.

For n = 12, 4 \mid 12 and Corollary 4 settles it. For n = 6 there is no factor 4, so it reduces to the exponent 3. For n = 2026 = 2 \cdot 1013, with 1013 prime, it reduces to the exponent 1013. Odd prime exponents need tools beyond this lesson.

Example 3

Another quadratic equation, the same tools

Find every solution of x^2 + 2y^2 = z^2 in positive integers with \gcd(x, y) = 1, and list the three with the smallest z.

Solution

First, x is odd: otherwise y is odd and z^2 \equiv 0 + 2 \pmod 4, which no square is. Then z is odd too, and

2y^2 = (z - x)(z + x).

Both factors are even. Put z - x = 2u and z + x = 2v with 0 < u < v; then y^2 = 2uv, so y is even, and y = 2t gives uv = 2t^2. A common divisor of u and v divides v + u = z and v - u = x, and a prime dividing x and z divides 2y^2, is odd, and so divides y. Hence \gcd(u, v) = 1.

Lemma 1 adapts to uv = 2t^2. Exactly one of u, v is even, and v_2(uv) = 1 + 2v_2(t) is odd, so that one has odd v_2. For an odd prime p, v_p(u) + v_p(v) = 2v_p(t) with one term 0, so both are even. So the odd one is r^2 and the even one 2s^2, with r odd and \gcd(r, s) = 1. Then t^2 = uv/2 = r^2 s^2, and

x = \left|2s^2 - r^2\right|, \quad y = 2rs, \quad z = r^2 + 2s^2.

Conversely, every odd r and positive s with \gcd(r, s) = 1 give a solution, since (r^2 - 2s^2)^2 + 2(2rs)^2 = (r^2 + 2s^2)^2; and \gcd(x, y) = 1, because x is odd and an odd prime dividing x and one of r, s divides the other. The smallest z are 3, 9, 11:

rs(x, y, z)check
11(1, 2, 3)1 + 8 = 9
12(7, 4, 9)49 + 32 = 81
31(7, 6, 11)49 + 72 = 121
Example 4

Congruent numbers

A positive integer N is congruent when it is the area of a right triangle with rational sides. Show that 7 is congruent using the legs 24/5 and 35/12, and turn that triangle into a Pythagorean triple whose area is 7 times a square. Then prove that 1 is not congruent.

Solution

The hypotenuse is rational:

\begin{aligned} \left(\frac{24}{5}\right)^2 + \left(\frac{35}{12}\right)^2 &= \frac{82{,}944 + 30{,}625}{3600} \\ &= \frac{113{,}569}{3600} = \left(\frac{337}{60}\right)^2. \end{aligned}

The area is \tfrac12 \cdot \tfrac{24}{5} \cdot \tfrac{35}{12} = \tfrac{840}{120} = 7. Multiplying the sides by the common denominator 60 gives the triple (288, 175, 337), with area \tfrac12 \cdot 288 \cdot 175 = 25{,}200 = 7 \cdot 60^2. It is primitive, from (m, n) = (16, 9).

In general, a rational right triangle of area N with sides over a common denominator D becomes a triple of area ND^2, and a triple of area Nk^2, divided by k, is a rational triangle of area N. So N is congruent exactly when some Pythagorean triple has area N times a square. For N = 1 that area would be a square, which Corollary 6(b) rules out.

Example 5

Awnings with a given area

Yuna makes right-triangle awnings. Malik asks for one with an area of 65 square feet; Amara asks for one whose area is a perfect square number of square feet. Which orders can Yuna fill with whole-foot sides, and which with sides in fractions of a foot?

Solution

Whole-foot sides form a Pythagorean triple. In every triple one leg is a multiple of 3 and one a multiple of 4 (Pythagorean triples), so 12 \mid ab and the area ab/2 is a multiple of 6. Since 6 \nmid 65, Malik’s awning cannot have whole-foot sides.

Fractions help. The pair (m, n) = (9, 4) gives the triple (65, 72, 97), with area \tfrac12 \cdot 65 \cdot 72 = 2340 = 65 \cdot 6^2. Dividing by 6 gives legs 65/6 and 12 feet and hypotenuse 97/6 feet, area 65: in feet and inches, 10 ft 10 in, 12 ft and 16 ft 2 in.

Amara’s order fails in whole feet, by Corollary 6(b). It fails in fractions too: a rational triangle of area k^2, shrunk by the factor k, would have area 1, and 1 is not congruent (Example 4).

Boundaries

Lemma 1 needs both hypotheses. Without coprimality it fails: 12 \cdot 27 = 18^2, and neither factor is a square. Among integers of either sign it fails too: (-1)(-9) = 3^2.

One square leg is common. Theorem 3 forbids two square legs, not one, as (25, 312, 313) shows. And x^2 + y^2 = z^4 has infinitely many solutions with \gcd(x, y) = 1 (Exercise 17).

The odd exponents need other ideas. Example 2 reduces Fermat’s last theorem to the exponent 4 and the odd primes, and this descent reaches no odd prime. The exponent 3 yields to factoring in the larger ring \mathbb{Z}[\omega], \displaystyle \omega = \frac{-1 + \sqrt{-3}}{2}, which is Euclidean (Euclidean domains and principal ideal domains) and so has unique factorization (Unique factorization domains); there Lemma 1 holds up to units. The full theorem was proved by Andrew Wiles, with a step completed jointly with Richard Taylor, in work published in 1995, by methods far beyond this course. It is stated here, not proved.

Which numbers are congruent. 5, 6 and 7 are congruent; 1 is not, nor is any square (Exercise 18). That 2 and 3 are not congruent is stated here without proof. No complete test is proved: a criterion of Tunnell (1983) is known to be necessary, and its sufficiency rests on the unproved Birch and Swinnerton-Dyer conjecture.

Where this goes next

The hypotenuse m^2 + n^2 of a primitive triple is a sum of two squares, and Sums of two squares decides which integers are such sums, with another descent. Pell's equation and continued fractions treats x^2 - dy^2 = 1, an equation in integers with infinitely many solutions for a different reason. Lemma 1 is the step that breaks in rings without unique factorization, which is why the Fermat problem pushed the study of factorization in larger rings (Unique factorization domains).

Exercises

Coprime factors

  1. List every ordered pair (u, v) of coprime positive integers with uv = 3600, and check that each u is a perfect square.
  2. List every pair (u, v) of coprime positive integers with u < v and uv = 27{,}000, and check that both are perfect cubes.
  3. The product 8 \cdot 18 is a perfect square. Compute it, the gcd of the factors, and v_2 of each factor, and say where the proof of Lemma 1 breaks.

Parametrizations

  1. Use the formula of Example 3 with (r, s) = (5, 2) and with (r, s) = (5, 3), and check each solution of x^2 + 2y^2 = z^2.
  2. Find (r, s) for the solution (x, y, z) = (23, 10, 27) of x^2 + 2y^2 = z^2.
  3. Find every solution of x^2 + 2y^2 = z^2 in positive integers with \gcd(x, y) = 1 and y = 12.
  4. Show that if (a, b, c) is a Pythagorean triple then x = a + b, y = |a - b|, z = c solve x^2 + y^2 = 2z^2, and find the solution that comes from (36, 77, 85).

The descent and its consequences

  1. The triple (49, 1200, 1201) has odd leg 7^2. Run the proof of Theorem 3 on it, as in Example 1: find m, n, r, s, and say which of m, r, s fail to be squares.
  2. Compute the area mn(m - n)(m + n) of the primitive triple from every qualifying pair (m, n) with m \le 6. Confirm that none is a square, and find the two that share an area.
  3. Check that the right triangle with legs 3/2 and 20/3 has a rational hypotenuse and area 5, scale it to a Pythagorean triple, and write that triple’s area as 5 times a square.
  4. The triple (44, 117, 125) has area 2574. Write 2574 = Nk^2 with N squarefree, and give a right triangle with rational sides and area N.
  5. For each of n = 20, 18, 64, 99, say which exponents d from Example 2 (d = 4 or an odd prime) divide n, and whether Corollary 4 settles x^n + y^n = z^n.
  6. Find every solution of x^2 + y^2 = z^4 with x < y, \gcd(x, y) = 1 and z = 5; then with z = 13.

Proofs

  1. Prove that x^4 + 4y^4 = z^2 has no solution in positive integers, so no Pythagorean triangle has legs x^2 and 2y^2.
  2. Prove that x^4 + y^4 = z^4 has no solution in nonzero rational numbers.
  3. Prove that if u and v are coprime positive integers and uv = 3w^2 for an integer w, then one of u, v is a square and the other is 3 times a square.
  4. Prove that x^2 + y^2 = z^4 has infinitely many solutions in positive integers with \gcd(x, y) = 1.
  5. Prove that for positive integers N and k, N is congruent exactly when Nk^2 is, and deduce that no perfect square is congruent.
Answers
  1. Eight pairs, with u = 1, 16, 9, 25, 144, 400, 225, 3600 and v = 3600/u. Since 3600 = 2^4 \cdot 3^2 \cdot 5^2 and each prime power goes wholly to u or to v, u is a product of squares.
  2. (1, 27{,}000), (8, 3375), (27, 1000), (125, 216), since 27{,}000 = 2^3 \cdot 3^3 \cdot 5^3; the cube roots are 1, 30; 2, 15; 3, 10; 5, 6.
  3. 8 \cdot 18 = 144 = 12^2, \gcd(8, 18) = 2, v_2(8) = 3, v_2(18) = 1. The prime 2 divides both factors, so its exponent 4 splits as 3 + 1, both odd. The proof assumed each prime sits in one factor.
  4. (5, 2) gives (17, 20, 33): 289 + 800 = 1089 = 33^2. (5, 3) gives (7, 30, 43): 49 + 1800 = 1849 = 43^2.
  5. (r, s) = (5, 1). From 2rs = 10 with r odd, (r, s) is (5, 1) or (1, 5), and r^2 + 2s^2 = 27 picks (5, 1).
  6. (71, 12, 73) and (1, 12, 17). Here rs = 6 with r odd and \gcd(r, s) = 1, so (r, s) = (1, 6) or (3, 2). Checks: 5041 + 288 = 73^2 and 1 + 288 = 17^2.
  7. (a + b)^2 + (a - b)^2 = 2a^2 + 2b^2 = 2c^2. From (36, 77, 85): (x, y, z) = (113, 41, 85), and 12{,}769 + 1681 = 14{,}450 = 2 \cdot 85^2.
  8. m^2 = (1201 + 49)/2 = 625 and n^2 = (1201 - 49)/2 = 576, so m = 25, n = 24. The second triangle is (7, 24, 25), so r = 4, s = 3, and 1200 = 4mrs = 4 \cdot 300. Here m = 5^2 and r = 2^2 are squares; only s = 3 fails.
  9. The pairs (2, 1), (3, 2), (4, 1), (4, 3), (5, 2), (5, 4), (6, 1), (6, 5) give areas 6, 30, 60, 84, 210, 180, 210, 330. None is a square. The pairs (5, 2) and (6, 1) share area 210: the triples (20, 21, 29) and (12, 35, 37).
  10. \tfrac94 + \tfrac{400}{9} = \tfrac{1681}{36} = \left(\tfrac{41}{6}\right)^2, and the area is \tfrac12 \cdot \tfrac32 \cdot \tfrac{20}{3} = 5. Scaling by 6 gives (9, 40, 41), with area 180 = 5 \cdot 6^2.
  11. 2574 = 2 \cdot 3^2 \cdot 11 \cdot 13, so N = 286 and k = 3. Dividing by 3 gives legs 44/3 and 39 and hypotenuse 125/3, with area \tfrac12 \cdot \tfrac{44}{3} \cdot 39 = 286.
  12. 20: 4 and 5; settled. 18: only 3; not settled here. 64: only 4; settled. 99: 3 and 11; not settled here.
  13. For z = 5: (7, 24). For z = 13: (119, 120). Here (x, y, z^2) is primitive, so z^2 = m^2 + n^2, and 25 = 4^2 + 3^2, 169 = 12^2 + 5^2 are the only such sums.
  14. Dividing out a common prime p of x, y (then p^2 \mid z), assume \gcd(x, y) = 1. If x is even, y is odd, and x = 2x_1, z = 2z_1 give y^4 + 4x_1^4 = z_1^2; so assume x odd. Then (x^2, 2y^2, z) is primitive with even leg 2y^2, and Theorem 2 gives x^2 = m^2 - n^2, y^2 = mn. Lemma 1 makes m = a^2, n = b^2, so a^4 - b^4 = x^2, against Theorem 5.
  15. Let D be a positive common denominator. Then |Dx|, |Dy|, |Dz| are positive integers with |Dx|^4 + |Dy|^4 = |Dz|^4, against Corollary 4.
  16. v_3(uv) = 1 + 2v_3(w) is odd, so 3 divides exactly one factor, say u, with v_3(u) odd. For p \ne 3, v_p(u) + v_p(v) = 2v_p(w) with one term 0, so both are even. So v is a square, and u/3 has every exponent even, so it is a square.
  17. A primitive triple (a, b, c) has a, b coprime of opposite parity, so Theorem 2 with m = \max(a, b), n = \min(a, b) gives the primitive triple (|a^2 - b^2|,\ 2ab,\ c^2), a solution of x^2 + y^2 = c^4. The pairs (k + 1, k) give primitive triples with the distinct hypotenuses 2k^2 + 2k + 1, so there are infinitely many.
  18. Multiplying a rational triangle’s sides by k multiplies its area by k^2, and dividing reverses it, so N and Nk^2 are congruent together. So k^2 is congruent exactly when 1 is, and 1 is not (Example 4).
math.wiki · updated 2026-11-18 · CC-BY-SA-4.0