Complex Extensions, Sum of Squares

Sum of Squares

If n is a2+b2 then n is divisible by a+bi. Conversely, each a+bi leads to a representation of n as a sum of squares. We're not interested in associates or conjugates of a+bi, which simply change signs or swap variables. Count the unique factors a+bi, disregarding associates, then divide by two to get rid of the conjugates.

If p prime divides n, and p = 3 mod 4, p doesn't split into complex primes. It has to divide a+bi, hence p2 divides n. All the primes in n that are 3 mod 4 must appear in even powers, or n is not the sum of squares at all.

If n is even, let a+bi hold all the instances of 1+i, and put the conjugates, the powers of 1-i, in a-bi. Since 1+i and 1-i are associates, it really doesn't matter how we divide them up.

Let pk divide n, where p is an integer prime that is 1 mod 4. Select anywhere from 0 to k instances of the prime u+vi lying over p and fold them into a+bi. If j instances are selected, then k-j instances of u-vi are folded into a+bi. We have k+1 options. do this for all the other primes mod 4. The number of representations is the product of ki+1, where n contains ki factors of pi, and pi is 1 mod 4.

Actually we must divide this combinatorial product by 2, to compensate for the double counting of conjugates. This makes sense when the product is even, but when the product is odd, and every ki is even, it is possible to choose half and half for each prime p in n. In this one case, a+bi acts as its own conjugate. We don't want to throw this one away, so round the product up to the nearest even number, then divide by 2.

At this point an example is desperately needed. Consider 23×54×72×372. Since 7 is 3 mod 4, it has to be squared, and it is. Combine 7 with 3 instances of 1+i to get -14+14i. The exponents on the remaining primes are 4 and 2, so the number of representations is 5×3 or 15, rounded up to 16, and divided by 2, yields 8. These are summarized below, in no particular order, except that the last entry is the odd one, that acts as its own conjugate, and was not double-counted in the 15 combinations. Verify that each pair of numbers below, when squared, yields 335405000.

3122, 18046
16310, 8330
16450, 8050
3430, 17990
12334, 13538
8806, 16058
18130, 2590
12950, 12950

The combinatorics are easier if you don't care about signs, or the order of the variables. No need to add one (as a fudge factor) or divide by 2. Take the product over ki+1, and multiply by 4, for the 4 units in the ufd.