002: Pythagorean Triples and more

Part 2. Sums of Squares
I. Sums of two squares


  1. x2+y2 = zk

    a.  (a+1/a)2 + (b+1/b)2 = c2

    b.  (a-1/a)2 + (b-1/b)2 = c2

    c.  (a2+b2)2 + (c2+d2)2 = e2

    d.  a2 + (a+n)2 = b2

    e.  a2 + b2 = (b+n)2

    f.  (2ab)2 + (2cd)2 = (a2+b2-c2-d2)2

    g.  (ac+bd)2 + (ad-bc)2 = (a2+b2)2

  2. x2+ny2 = zk;  2b. ax2+by2 = cz2
  3. ad-bc = ±1
  4. x2+y2 = z2+1
  5. x2+y2 = z2-1
  6. x2+y2 = z2+nt2
  7. x2+y2 = z2+ntk
  8. x2+y2 = mz2+nt2
  9. c1(x2+ny2) = c2(z2+nt2)
  10. mx2+ny2 = mz2+nt2
  11. x2+y2 = zk+tk

1. Form: x2+y2 = zk


A.  Introduction
While integers a,b,c that satisfy a2+b2 = c2 are called Pythagorean triples, the ancient Babylonians already knew there were triangles whose sides satisfy that relationship more than a thousand years earlier.  The famous tablet Plimpton 322 (pre-1500 BC, now kept in Columbia University) contains pairs of numbers in sexigesimal which can be seen as part of a Pythagorean triple.  The largest pair is (18541, 12709) and a quick calculation shows that the difference of their squares is also a square, 185412-127092 = 135002.  Quick for us using a calculator but the size of this example shows the Babylonians must have known of a method to generate solutions other than randomly scribbling figures in the sand.  The smallest primitive solns (where a,b,c have no common factor) are: {3, 4, 5}, {5, 12, 13}, {7, 24, 25}, {8, 15, 17}, etc.


Theorem:  “For primitive triples a2+b2 = c2, exactly,


1) one of a,b is odd, and c is always odd.

2) one of a,b is divisible by 3 and/or 4. 

3) one of a,b,c is divisible by 5.”


which shows the importance of the triple {3,4,5}.  Note:  It is possible the divisibility by 3,4,5 is contained in just one term, such as in the first term of,
(60v)2 + (900v2-1)2 = (900v2+1)2
Theorem:  “One soln can lead to another, or if a2+b2 = c2, then (a+2b+2c)2 + (2a+b+2c)2 = (2a+2b+3c)2 is another triple.”


Starting with {a, b, c} = {±3, ±4, 5}, one can iteratively generate all primitive Pythagorean triples. (Barning, 1963; Roberts, 1977)


Theorem: “All odd numbers > 1, as well as multiples of 4, appear in a primitive Pythagorean triple.”  Proof:  Use the identities:


(2m+1)2 + n2 = (n+1)2,  where n = 2(m2+m)

(4m)2 + n2 = (n+2)2,  where n = 4m2-1


Theorem: The complete non-trivial soln to x12+x22 = y12, with a scaling factor t, is given by,


((a2-b2)t)2 + (2abt)2 = ((a2+b2)t)2


Proof:  For any where x1xy1 0, one can always find rational {a,b,t} using the formulas:  {a,b,t} = {x1+y1, x2, 1/(2(x1+y1))}.  In general, one can completely solve x12+x22+...+ xn2  = y12.  See Sums of Three Squares
Update (7/2/09):  Adam Bailey gave a variant of the complete soln to a2+b2 = c2 as,
(p+2)2r2 + (2/p+2)2r2 = (p+2/p+2)2r2
where r is a scaling factor, since for any {a,b,c} > 0, one can always find rational {p,r} using the formulas {p,r} = {-(a+b-c)/(a-c),  2/(a+b-c).  Thus, this shows that the complete soln to a2+b2 = c2, as well as Binet's complete one for a3+b3+c= d3, is expressible (with a scaling factor) in just n-1 parameters, where n is the degree of the equation.  (End note).
Pythagorean triples were already known by the classical Greek mathematicians.  But the Babylonians and Greeks didn’t know about complex numbers which makes it easy for us to identically solve the more general equation x2+y2 = zk for any positive integer k, though for k > 2, it is not necessarily the complete soln.  For example, when k = 3, the method yields, with a rational scaling factor u,


(a3-3ab2)2u6 + (3a2b-b3)2u6 = (a2+b2)3u6
but does not always cover the alternative soln with scaling factor v,
(a3+ab2)2v6 + (a2b+b3)2v6 = (a2+b2)3v6

This will be discussed more in Sums of Two Squares, as well as the similar equation a2+b2 = cn+dn.  More generally for other k, given the expansion of the complex number (a+bi)k = A+Bi where {A,B} are polynomials in terms of {a,b}, and i = Ö-1, then,


A2+B2 = (a2+b2)k


Similarly, for the case of four squares equal to an nth power, one can use quaternions.  Given the expansion of the quaternion (a+bi+cj+dk)n = A+Bi+Cj+Dk, then,


A2+B2+C2+D2 = (a2+b2+c2+d2)n


though there is an easier method to be discussed later.  One can also solve the equation A2+B2 = (a2+b2)k by factoring over Ö-1 to get,


(A+Bi)(A-Bi) = (a+bi)k(a-bi)k


Equating factors yields a system of two equations in two unknowns A,B which, being only linear, can then easily be solved for. This yields,


A = (pk+qk)/2,  B = -(pk-qk)i/2,


where {p,q} = {a+bi, a-bi} and B, after simplification, is a real value. This technique of equating factors will prove useful for similar equations. 
Update (6/17/09):  Pythagorean triples {a,b,c} = {x2-1, 2x, x2+1} can be used in the form,
ak+bk+ck = 2(x8+14x4+1)k/4,  for k = 4,8
The expression x8+14x4+1 is no ordinary polynomial.  Equated to zero, it is one of the octahedral equations, involved in the projective geometry of the octahedron.  It also appears in a formula for the beautiful j-function j(τ) in terms of the Dedekind eta function η(τ) as,
j(τ) = 16(x8+14x4+1)3/(x5-x)4
where x = 2η2(τ) η4(4τ) / η6(2τ)
If you have Mathematica, you can easily verify this.  For ex, choosing the particular value d = (1+Sqrt[-163])/2 which conveniently yields an integer,  
j(d) = N[16(x8+14x4+1)3/(x5-x)4 /. x → 2*DedekindEta[d]2 DedekindEta[4d]4 / DedekindEta[2d]6 /. d → (1+Sqrt[-163])/2, 100] = -6403203
Furthermore, using -Numerator+1728Denominator of the j-function formula above (note that 1728 = 123), one gets another octahedral equation.  Expressed in terms of the same Pythagorean triples {a,b,c}, this is,
(a4+b4+c4)3 - 54(abc)4 = 8(x12-33x8-33x4+1)2
Why Pythagorean triples, when expressed in a constrained manner, spell out the two octahedral equations, I do not know. (End note.) 
Update (10/11/09):  Pythagorean triples also appear in the equation x2 = -1 where x, instead of the imaginary unit, is to be a quaternion. To recall, given the expansion of (a+bi+cj+dk)n = A+Bi+Cj+Dk, then,


A2+B2+C2+D2 = (a2+b2+c2+d2)  


In a Mathematica add-on package, this object is given as Quaternion[a,b,c,d] and one can use NonCommutativeMultiply to multiply them, and for the case n = 2, we get,


Quaternion[a,b,c,d] ** Quaternion[a,b,c,d] = Quaternion[a2-b2-c2-d2, 2ab, 2ac, 2ad]       (eq.1)


One can see two immediate consequences.  First, as expected, (a2-b2-c2-d2)2 + (2ab)2 + (2ac)2 + (2ad)2 = (a2+b2+c2+d2)2.  Second, while the Fundamental Theorem of Algebra states that an nth degree univariate equation with complex coefficients has n complex roots, this does not apply when the roots are quaternions.  For example, the nth roots of plus/minus unity or, xn = ±1, have n complex solns.  But if x is to be a quaternion, then there can be an infinite number of them.  Let n = 2 and take the negative case:  x2 = -1.  Thus, we wish (eq.1) to become,


Quaternion[a2-b2-c2-d2, 2ab, 2ac, 2ad] = Quaternion[-1,0,0,0]. 


Since {a,b,c,d} are to be real, then a = 0, and {b,c,d} should satisfy,


b2+c2+d2 = 1


which have an infinite number of rational solns, a subset of which is d = 0 and {b,c} as rationalized Pythagorean triples.  (If c = d = 0, then the only soln is b = ±1 in which case the quaternion reduces to the imaginary unit.)  This will also be discussed in the section on Sums of Three Squares.  Of course, the most general setting for solving x2 = -1 would be x as the octonions, where the coefficients of the non-real part would have to satisfy the sum of seven squares,


y12+y22+y32+y42+y52+y62+y72 = 1


(End update.) 

B.  Special Forms
1. (a+1/a)2 + (b+1/b)2 = c2
2. (a-1/a)2 + (b-1/b)2 = c2
3. (a2+b2)2 + (c2+d2)2 = e2
4. a2 + (a+n)2 = b2
5. a2 + b2 = (b+n)2
6. (2ab)2 + (2cd)2 = (a2+b2-c2-d2)2
7. (ac+bd)2 + (ad-bc)2 = (a2+b2)2
If you know of any other form and its soln, pls submit them. 
Form 1:  (a+1/a)2 + (b+1/b)2 = c2


(x+1/x)2 + (y+1/y)2 = z2


{x,y} =  {4p/(p2-1),  (3p2+1)/(p3+3p)}

Form 2:  (a-1/a)2 + (b-1/b)2 = c2

(x-1/x)2 + (y-1/y)2 = z2
or equivalently,

x2(y2-1)2 + y2(x2-1)2 = z2


{x,y} = {4p/(p2+1),  (3p2-1)/(p3-3p)}


with a very similar soln to the previous and which is useful in making {x2+y2, x2+z2, y2+z2} all squares, or the Euler Brick Problem, to be discussed more in the section on Simultaneous Polynomials.
Form 3:  (a2+b2)2 + (c2+d2)2 = e2 


(a2+b2)2 + (b2+d2)2 = (b2+8c2+d2)2,  where d = (b2+3c2)/(2c), and a2-b2 = 10c2


This can be generalized as, let {p,q} = {2n2, n2-1}, then,


(a2+b2)2 + (b2+d2)2 = (b2+pc2+d2)2,  where d = (b2+qc2)/(2c), and a2-(n-1)b2 = n(n2+1)c2 


for any n, with Euler’s as the case n = 2.  Another approach is to use the parametrization for Pythagorean triples in the form,


(a2+b2)2 + (c2+d2)2 = (p2+q2)2


where {a,b,p,q}= {u2-v2-w2, 2uv, u2+v2+w2, 2uw}, and conditional eqn, c2+d2 = 4uw(u2+v2+w2) .


One soln to the conditional eqn is to let {v,w} = {e/(2u), u}, and it becomes c2+d2 = e2+8u4 which can easily solved as discussed in the Section on x2+y2 = z2+ntkQ: Any others for (a2+b2)2 + (c2+d2)2 = e2?


Update (6/20/09):  After this author posted the question in sci.mathDave Rusin gave a very elegant five-parameter soln.  He notes that one way to approach the problem is to treat the legs (each of which are sums of two squares) as the product of two sums of two squares since we know that,
(x1x3+x2x4)2 + (x1x4-x2x3)2 = (x12+x22)(x32+x42)

Thus we get, 


((x12+x22)(x32+x42))2 + (2(y12+y22)(y32+y42))2 = ((y12+y22)2 + (y32+y42)2)2


and, after some clever manipulation of some eqns describing a 5-dimensional projective variety over Q, gave the soln as,


{x1, x2, x3, x4} = {2d,  1+z,  1-z,  2(a2+b2-c2)}

{y1, y2, y3, y4} = {4ac,  4bc,  1-z,  2(a2+b2+c2)}


where z = (a2+b2)2+6(a2+b2)c2+c4-d2 for four free parameters {a,b,c,d}.  NoteIncidentally, the related form,


((u12-u22)(u32-u42))2 + (2(v12-v22)(v32-v42))2 = ((v12-v22)2 + (v32-v42)2)2




{u1, u2, u3, u4} = {2d,  1-z2,  1+z2,  2(a2-b2-c2)}

{v1, v2, v3, v4} = {4ac,  4bc,  1+z2,  2(a2-b2+c2)}

where z2 = (a2-b2)2+6(a2-b2)c2+c4-d2 with parameters {a,b,c,d}. (End update.
Form 4:  a2 + (a+n)2 = b2
Given a triangle with legs as consecutive integers {p, p+1}, then a second can be found,  


Theorem: “If p2 + (p+1)2 = r2, then q2 + (q+1)2 = (p+q+r+1)2, where q = 3p+2r+1.”  (Fermat)
(Update, 6/24/09):  Maurice Mischler pointed out that all integer solns to the triple (p, p+1, r) is given by,
((x-1)/2)2 + ((x+1)/2)2 = y2
where {x,y} satisfy the Pell equation x2-2y2 = -1. Since x is always odd, then terms are integers. (End note).
(Update, 12/25/09):  Given the co-prime triple {a,b,c}, the difference between the hypotenuse and a leg, or c-a = n, can assume any non-zero value n.  In contrast, the difference between the two legs, or b-a = n, is only IF the prime factors of n is of form 8m ±1 which is sequence n = {1, 7, 17, 23, 31,...} in the OEIS.  These triples can be completely parameterized by the form,
((x-n)/2)2 + ((x+n)/2)2 = y2
where {x,y} are co-prime solns of the Pell-like equation x2-2y2 = -n2.  Thus, x2-2y2 = -72 has {x,y} = {1,5}, etc, and it is easily shown that if there is one co-prime soln, then there is an infinite number of them by generalizing Fermat's result as,
Theorem: “If p2 + (p+n)2 = r2, then q2 + (q+n)2 = (p+q+r+n)2, where q = 3p+2r+n.”   (End update.)

(Update, 12/30/09):  Given the first four primitive Pythagorean triples, {3,4,5}, {5,12,13}, {7,24,25}, {8,15,17}, it can be noticed that the sum of their legs, {3+4, 5+12, 7+24, 8+15} = {7, 17, 31, 23} are primes of the form 8n±1.  The relevant theorem is this:


Theorem: “For every prime p = 8n±1, there is one and only one primitive and positive Pythagorean triple {a,b,c} such that a+b = p.”


Thus, no matter how many two-part positive partitions {a,b} of p there may be, there is one and only one such that a2+b2 = c2 for some integer c.


Proof:  (Andrew Usher)  Using the complete parameterization of primitive Pythagorean triples as {m2-n2, 2mn, m2+n2} where m > n > 0, the sum p of its two legs can be expressed as the Pell-like equation,


(m2-n2) + (2mn) = (m+n)2 -2n2 = x2-2y2 = p      (eq.1)


If solvable, eq.1 has an infinite number of integer solns, but it can be shown that,


a) For p a prime, eq.1 has only one fundamental soln {x0, y0} from which all others can be derived via a recursion.

b) The recursion can show that {x0, y0} will be the only one with m > n > 0.


If p is not a prime, then (a) will not be true.  For example p = 7(23) = 161 has two, leading to two primitive triples {17, 144, 145} and {44, 117, 125} with the sum of their legs as 17+144 = 44+117 = 7(23) = 161.  (End update

Form 5:  a2 + b2 = (b+n)2
When a leg and the hypotenuse differ by a constant n, a general formula is,
(nx)2 + y2 = (y+n)2 
where 2y = n(x2-1), for arbitrary {n,x}.  (Of course, for y to be integral, then either n should be even, or x is odd.)
(Update, 12/24/09)  Form 6:  (2ab)2 + (2cd)2 = (a2+b2-c2-d2)2

A parametric solution is {a,b,c,d} = {p+q,  -p+q,  2q, 2r} where p2+3q2 = r2. The smallest is then {3, 5, 8, 14}. Also, if {a,b} = {p+q,  -p+q}, and c2+nd2 = 4p2 for some n, then the problem is reduced to an elliptic curve

Euler observed that the form,
2(p2v4+x4+y4+z4) = (pv2+x2+y2+z2)2      (eq.1)


(with p inserted by this author) is equivalent to the triplet of simultaneous eqns,


p(2vx)2 + (2yz)2 = (pv2+x2-y2-z2)2

p(2vy)2 + (2xz)2 = (pv2-x2+y2-z2)2

p(2vz)2 + (2xy)2 = (pv2-x2-y2+z2)2


When p = ±1, this is a special case of Descartes’ Circle Theorem, and the triplet are Pythagorean triples.  




Let p = -1.  If a4+b4 = c4+d4, then one soln to (eq.1) is, 


{v,x,y,z} = {2(ab-cd)(ab+cd),  (a2+b2+c2+d2)(a2-b2+c2-d2),  2(ac-bd)(a2+c2),  2(ac-bd)(b2+d2)}  


This is discussed more in Form 18 here.  (End update.)

Form 7:  (ac+bd)2 + (ad-bc)2 = (a2+b2)2
One can also find solutions to x2+y2 = z2 using the equation p2+q2 = r2+s2 and vice-versa,


(ad+be)2 + (ae-bd)2 = (dc)2 + (ec)2,  if a2+b2 = c2
Conversely, if a2+b2 = c2+d2, then,
P. Volpicelli 
(ac+bd)2 + (ad-bc)2 = (a2+b2)2   
A. Fleck 
(a2c-b2c+2abd)2 + (a2d-b2d-2abc)2 = (a2+b2)3   
The solns by Volpicelli and Fleck suggest a generalization can be found for all positive integer k. Using a variation of the technique introduced earlier, assume,


A2+B2 = (a2+b2)g(c2+d2)h


and equating factors,


A+Bi = (a+bi)g(c+di)h,   A-Bi = (a-bi)g(c-di)h


call this as System 1, then solving for A,B can give a soln to,


A2+B2 = (a2+b2)g+h


where A,B are polynomials in {a,b,c,d} with the constraint a2+b2 = c2+d2  (call this eq.1).   Thus, for k = g+h = 4,


(ac3-3bc2d-3acd2+bd3)2 + (bc3+3ac2d-3bcd2-ad3)2 = (a2+b2)4,   if a2+b2 = c2+d2


which continues Volpicelli's and Fleck's identities, and so on for all kIn Volpicelli’s soln, if we let {c,d} = {a, ±b}, then we get either the usual formula for Pythagorean triples or, after removing common factors, a tautology.  But if we solve for {a,b,c,d} in eq.1 using Euler’s complete soln,


(pr+qs)2 + (ps-qr)2 = (pr-qs)2 + (ps+qr)2


plus the fact that for non-negative integers {g,h} there are k+1 ways to get the sum g+h = k, this gives the more general result:


Theorem: “Let F := (p2+q2)(r2+s2).  Then Fk for k > 0 is identically the sum of two squares in k+1 ways.”


Proof:  It is well known Fk for k = 1 is a sum of two squares via the Brahmagupta-Fibonacci Two-Squares Identity.  In fact, Euler’s soln for (eq.1) is just this in disguise since,


(pr+qs)2 + (ps-qr)2 = (pr-qs)2 + (ps+qr)2 = (p2+q2)(r2+s2)


thus easily proving that for k = 1, there are indeed two ways to express Fk as the sum of two squares.  However, for k >1, there are not just one, but k+1 corresponding identities.  To prove this, since one is to solve,


A2+B2 = (a2+b2)g(c2+d2)h


where A,B are polynomials in {a,b,c,d}, the solns are dependent on the particular values of the exponents {g,h} chosen.  And there are k+1 ways such that g+h = k.  Since a2+b2 = c2+d2, then,


A2+B2 = (a2+b2)g+h


By Euler’s soln {a,b} = {pr+qs,  ps-qr}, so


A2+B2 = ((p2+q2)(r2+s2))g+h = Fk


in k+1 ways. (End proof.)  For example, for F3, let exponents {g,h} of the factors be in turn {0,3}, {1,2}, {2,1}, {3,0}.  Solving for A,B in System 1, these yield the four identities,


{A1, B1} = {c(c2-3d2),  d(3c2-d2)}

{A2, B2} = {ac2-2bcd-ad2,  bc2+2acd-bd2}

{A3, B3} = {a2c-2abd-b2c,  a2d+2abc-b2d}

{A4, B4} = {a(a2-3b2),  b(3a2-b2)}


where {a,b,c,d} = {pr+qs,  ps-qr,  pr-qs,  ps+qr}.  To give a random numerical example, let {p,q,r,s} = {1, 2, -2, 3} so (p2+q2)(r2+s2) = 65.  These then yield {Ai, Bi} as {488, 191}, {140, 505}, {320, 415}, {524, 7} such that A2+B2 = 653.  And so on for other k, for arbitrary {p,q,r,s}. 
An interesting variant to Pythagorean triples is x2+y3 = z4:


H. Mathieu


(q2(p2-2))2 + (2q2)3 = (pq)4,  if p2-2q2 = 1


((p4-p2)/2)2 + p6 = (pq)4,  if p2-2q2 = -1


Solns can be given by the nth triangular number (n2+n)/2 that is also a square and depends on solving the above Pell equation.  Note that solving n in (n2+n)/2 = y2 for rational n entails making its discriminant a square 1+8y2 = x2, or equivalently, x2-2(2y)2 = 1.  More generally though,




(4q2d4(p2-2))2 + (4q2d3)3 = (2pqd2)4,  if p2-dq2 = 1


(4p2d3(p2-1))2 + (2pd)6 = (2pqd2)4,   if p2-dq2 = -1


thus it is not just limited to triangular numbers.  Another variant is x4+y3 = z2:


K. Brown


p4 + (q2-1)3 = (q3+3q)2,  if p2-3q2 = 1


(See Brown’s Miscellaneous Diophantine Equations”.)


More generally,


p4 + (dq2-1)3 = d(dq3+3q)2,  if p2-3dq2 = 1
Note:  As pointed out by Michael Somos, the above equation is also true if p2+3dq2 = -1. (Even for negative integer d, this is not solvable for integer {p,q}, but is easily solvable in the rationals for any d.) 
Previous Page        Next Page