Math Newsletter number 14;Wednesday, October 27, 2010.
If you send any part of this newsletter to a friend, please
also include this paragraph. To subscribe or unsubscribe,
send a personal email request to kermit@polaris.net
Archive is at

http://www.kermitrose.com/math/NewsLetter/LetterList.html

How do we derive the formula for the sum of two squares being
a square?

The general formula is:

(q**2 - p**2)**2 + (2*p*q)**2 = (q**2 + p**2)**2

What conditions do we need to impose on p and q to make
A = q**2 - p**2
B = 2*p*q
C = q**2 + p**2

into a primitive Pythagorean triple.
A primitive Pythagorean triple is a set of three numbers,
A,B,C, such that

A**2 + B**2 = C**2

and A,B,C have no factors in common.

What conditions on p and q ensure that

q**2 - p**2, 2*p*q, and q**2 + p**2 have no factors in
common?

Suppose

q**2 - p**2 = A
2 p q = B
q**2 + p**2 = C

where A, B, C have no factors in common.


Adding and subtracting equations, we get,

2 q**2 = (C+A)
2 p**2 = (C-A)

If C and A had any factor,m>1, in common, then
m would divide (C+A) and also divide (C-A),
and hence would divide both p and q.

This shows that if

A = q**2 - p**2
B = 2 p q
C = q**2 + p**2

form a primitive Pythagorean triple,
then p and q are also relatively prime.

However, the converse is not true.

If p and q are both odd, then


A = q**2 - p**2
B = 2 p q
C = q**2 + p**2

are all even.

To make the Pythagorean triple primitive,
we require that
p and q be of opposite parity as well as
being relatively prime.


The formula for the Pythagorean triple is derived as follows:

A**2 + B**2 = C**2

A**2 = C**2 - B**2

A**2 = (C-B)*(C+B)

C-B = m**2
C+B = n**2

2*C = (n**2 + m**2)
2*B = (n**2 - m**2)


It is proven in abstract algebra classes that
the sum of two squares is a quadratic multiplicative
form.

This means that if G is the sum of two squares,
and H is the sum of two squares,
then so is G*H the sum of two squares.

The formula that proves this is:

(p1**2 + q1**2)*(p2**2 + q2**2)
= (p1*p2 - q1*q2)**2 + (p1*q2 + q1*p2)**2

2 is the sum of two squares.
2 = 1**2 + 1**2.

2 * (q**2 + p**2)
= (1**2 + 1**2)*(q**2 + p**2)
= (q - p)**2 + (q+p)**2


2*C = (m**2 + n**2)


If we set
C = q**2 + p**2

Then 2C = (q-p)**2 + (q+p)**2

We set

m = q-p
n = q+p

Then n**2 + m**2 = (q+p)**2 + (q-p)**2 = 2*C

This confirms our choice of
C = q**2 + p**2

Recall that we had also derived that

2*B = (n**2 - m**2)

2*B = (q+p)**2 - (q-p)**2

2*B = (q**2 + 2*q*p + p**2) - (q**2 - 2*q*p + p**2)

2*B = 4*q*p

B = 2 * q * p

Recall also that we had set


A**2 = (C-B)*(C+B)

C-B = m**2
C+B = n**2

A**2 = m**2 * n**2

A = m * n


m = q-p
n = q+p

A = (q-p)*(q+p) = q**2 - p**2

We have completed the derivation.

A = q**2 - p**2
B = 2*p*q
C = q**2 + p**2

What about a square being the sum of three squares?


A**2 + B**2 + C**2 = D**2


The general formula is:


(2*(q1*p2 + p1*q2))**2 + (2(q1*q2 - p1*p2 ))
+ (q2**2 + p2**2 - q1**2 - p1**2)**2
= (q2**2 + p2**2 + p1**2 + q1**2)**2


How is this formula derived?
A**2 + B**2 + C**2 = D**2

A**2 + B**2 = D**2 - C**2

Since sum of two squares is a multiplicative form,
set A**2 + B**2 = (n1**2 + m1**2)(n2**2 + m2**2)

A**2 + B**2 = D**2 - C**2 = (D-C)(D+C)

Set

D-C = n1**2 + m1**2
D+C = n2**2 + m2**2

2*D = n2**2 + m2**2 + n1**2 + m1**2
2*C = n2**2 + m2**2 - n1**2 - m2**2

Similarly to before,

we set

n1 = q1+p1
m1 = q1-p1
n2 = q2+p2
m2 = q2-p2


2*D = n2**2 + m2**2 + n1**2 + m1**2
2*D = (q2+p2)**2 + (q2-p2)**2 + (q1+p1)**2 + (q1-p1)**2
2*D = 2* q2**2 + 2 * p2**2 + 2* q1**2 + 2* p1**2

D = q2**2 + p2**2 + p1**2 + q1**2

2*C = n2**2 + m2**2 - n1**2 - m2**2
2*C = (q2+p2)**2 + (q2-p2)**2 - (q1+p1)**2 - (q1-p1)**2
2*C = 2* q2**2 + 2* p2**2 - 2* q1**2 - 2* p1**2

C = q2**2 + p2**2 - q1**2 - p1**2

Recall that
A**2 + B**2 = (n1**2 + m1**2)(n2**2 + m2**2)
A**2 + B**2 = (n1*n2 - m1*m2)**2 + (n1*m2 + m1*n2)**2

A = n1*n2 - m1*m2
B = n1*m2 + m1*n2

A = (q1+p1)*(q2+p2) - (q1-p1)*(q2-p2)
A = 2*(q1*p2 + p1*q2)

B = (q1+p1)*(q2-p2) + (q1-p1)(q2+p2)
B = 2(q1*q2 - p1*p2 )

A**2 + B**2 + C**2 = D**2

(2*(q1*p2 + p1*q2))**2 + (2(q1*q2 - p1*p2 ))
+ (q2**2 + p2**2 - q1**2 - p1**2)**2
= (q2**2 + p2**2 + p1**2 + q1**2)**2


What about the sum of four squares equal to a square?
There is a general formula for this also.
(p**2 - q**2 - r**2 - s**2)**2
+ (2 p q)**2 + (2 p r)**2 + (2 p s)**2
=(p**2 + q**2 + r**2 + s**2)**2

This generalizes to sum of any number of squares.

(p0**2 - p1**2 - p2**2 - ... + p_n**2)
+ (2 p0 p1)**2 + (2 p0 p2)**2 + ... + (2 p0 p_N)**2
=(p0**2 + p1**2 + p2**2 + ... + p_n**2)

The sum of two squares is a multiplicative form.
The sum of three squares is NOT a multiplicative form.
The sum of four squares is a multiplicative form.
In abstract algebra, it has been proven that the only sum of
squares which are multiplicative forms are sum of two squares
and sum of four squares.

The proof that the sum of four squares is a multiplicative
form is the identity,

(p1**2 + q1**2 + r1**2 + s1**2)
*(p2**2 + q2**2 + r2**2 + s2**2)
= (p1*p2 - q1*q2 - r1*r2 - s1*s2)**2
+ (p1*q2 + q1*p2 + r1*s2 - s1*r2)**2
+ (p1*r2 - q1*s2 + r1*p2 + s1*q2)**2
+ (p1*s2 + q1*r2 - r1*q2 + s1*p2)**2