# Modulus

Peter Martinson

Before Karl Gauss moved to attend Göttingen University in October 1795, and before he was able to investigate the works of other famous mathematicians, such as that turncoat Leonhard Euler and his progeny, Napoleon admirer Joseph Louis Lagrange, he made a striking discovery whose elaboration gripped him for an entire year, and whose implications shaped the entirety of his life.

"Since I considered it so beautiful in itself and since I suspected its connection with even more profound results, I concentrated on it all my efforts in order to understand the principles on which it depended and to obtain a rigorous proof. When I succeeded in this I was so attracted by these questions that I could not let them be."1

In this pedagogical, we will uncover what Gauss' discovery was. The reader should be warned that, though the steps we will take to reach this goal might not be precisely what Gauss did, they are necessary to clear away some of the mess that infests most minds today. In order to get the full idea, and perhaps open the door to further fruitful discoveries, the reader is mightily encouraged to work through each example on his or her own. We shall start by looking at what Gauss said he discovered, and then move on to get a deeper sense of how he must have thought.

## What Gauss Said He Discovered

Gauss begins his book on arithmetic thus:
1. If a number a divides the difference of the numbers b and c, b and c are said to be congruent relative to a; if not, b and c are noncongruent. The number a is called the modulus. If the numbers b and c are congruent, each of them is called a residue of the other. If they are noncongruent they are called nonresidues.
We will see a bit later a more intuitive viewpoint from which to look at the modulus and its congruences, but for now, let us see exactly what Gauss presented to his contemporaries.
Let's take two numbers, -9 and +16. Their difference is 25. Since 5 divides 25 evenly, -9 is congruent to +16 relative to 5, the modulus. Similarly, -7 is a residue of +15 relative to 11, which divides their difference, 22. But, -7 is a nonresidue of +15 relative to 3, since 3 does not divide 22. Most of us have run into this kind of thing in school, when learning about division. What Gauss called the residue, we usually call the remainder. In fact, since the remainder must remain between 0 and the modulus, it is a special type of residue, called the least residue. So, if we divide 13 by 5, we get 2 with a remainder of 3. Therefore, in this case, 3 is a residue of 13, since their difference is evenly divisible by 5, and, in fact, 3 is the least residue.
Gauss has a shorthand for this. "b is congruent to c relative to modulus a" is written:
 b º c  (mod a)
So, in the above examples, -9 º +16  (mod 5) and -7 º +15  (mod 11).
Try several more numbers. Count up to 100. Now, pick a number as modulus, and divide all the numbers from 1 to 100 by it, to find the remainders. We will get something like this:
 Modulus 7 The top row of numbers are the counting numbers, and the bottom row are the remainders after division by 7. Notice the repeating pattern. We can easily see what the least residues of all the numbers are, and we can also see quickly which numbers are congruent to each other relative to our modulus, 7. So, for example, 2 is the least residue of 9, and 3 is the least residue of 10.
We can also continue the pattern in the other direction, into the negatives:
 Modulus 7 Thus, we see that the difference between -2 and 5 is divisible by 7, and they have the same least residue.
Try adding and subtracting different numbers, and see what happens with their least residues. You will find that, should you subtract a number congruent to 4 from a number congruent to 7, you will get the same result if you subtracted any number congruent to 4 from any number congruent to 7. This property holds for all arithmetic.
Now, let's quickly switch gears, and look at the characteristics of individual numbers. Gauss notes that we can divide all the prime numbers into two classes: those that can be divided evenly by four when reduced by 1, and those that must be reduced by 3 to be divisible by four. For example, 17=4·4 + 1, and 19=4·4 + 3. As a shorthand, 17 is called a 4n+1 number, and 19 is called a 4n+3 number. Every prime number can be expressed in these two ways, so we can categorize them: One last step, and we can state Gauss's fateful discovery. Look back at our table of least residues. In the list of numbers from 1 to 100, circle all those that are square numbers, such as 4, 9, 16, etc. What are their least residues? For 7, we see that the least residues of the squares are 1, 2, and 4. You will find that every square number is congruent to one of these three residues. The other three (not counting the modulus itself, or 0) will never be congruent to a square. In fact, if we call the modulus p, only [1/2] (p-1) of the least residues will be congruent to a square number. You might need to go way past 100 to see that, for some moduli! These least residues are called quadratic least residues, and those other, non-square numbers congruent to the squares, are simply called quadratic residues. We use the word quadratic, because a square has four sides (not two, as the exponent x2 might fool some of today's university mathematicians).
OK, now we can discuss Gauss's discovery. -1 is a quadratic residue for all prime number moduli that are expressible in the form 4n + 1, but not a quadratic residue for prime number moduli expressible in the form 4n + 3. That's it! For example, 17 is 4·4 + 1, and -1 is congruent to 16=42 relative to 17. But, relative to 19=4·4 + 3, there will never be a square congruent to -1.
This might seem like just a neat (or confusing) math trick, but remember that Gauss' method relies on the principle of inversion. You can always find out if -1 is a quadratic residue of a modulus or not, but what is the principle which determines for which moduli -1 is a prime number? Gauss has it solved completely: -1 is a square number, if and only if the modulus is a 4n+1 number. Now, how did he discover this? He did not know of any of the other work done on the subject, so we need some way to get into his young head.

## Gauss and Power

Gauss says that the demonstration of this discovery was first shown by Euler. In fact, the majority of the discoveries Gauss published in his arithmetic text were first made by either Euler, or others, such as Lagrange, Lambert, Legendre, or Fermat. As he said in a letter to his former teacher, E. A. W. von Zimmermann, when he showed up at the Göttingen University library, "I cannot deny, that I found it very unpleasant that most of my beautiful discoveries in indefinite analysis were not original. What consoles me is this. All of Euler's discoveries that I have so far found, I have made also, and still more so. I have found a more general, and, I think, more natural viewpoint; yet I still see an immeasurable field before me..."2 So, we must wade some more in what Gauss presents, but with the suspicion that he might not be telling the whole story.
Let us look more at the residues of powers. We need to build up a small body of experimental evidence, so we can begin to see some patterns. We will use two moduli for the examples: 7 and 17. First, find the least residues, relative to the two moduli, of all the powers of 2.

 Modulus 7 The top row are the regular counting numbers, the numbers in the second and third rows are equal to the powers of 2, and the numbers of the third row are the least residues of those powers of 2, relative to 7. Here is 17:

 Modulus 17 As before, in looking at the least residues of the counting numbers relative to modulus 5, notice that the least residues repeat. Last time, the length of the cycle was equal to the modulus, so the least residues repeated every 5 steps. Now, in looking at the residues of powers of 2, the repeating occurs more often. Let's try the powers of 3 (note that we left out the actual powers of 3, since they get pretty big. The reader is encouraged to calculate them, though!)

 Modulus 7 Modulus 17 Here, we see that neither of the sets of powers repeats until the modulus cycle has completed itself. And also notice that we do not reach 1 until the number just before the modulus. Thus, for modulus 17, 3(17-1) is congruent to 1, while for 7, 3(7-1) is congruent to 1. Now, let's do this for the rest of the powers.  For these two charts, each number represents the least residue of the number in the leftmost column of the same row, raised to the power of the number in the top row of the same column. For example, in modulus 7, 35 º 5  (mod 7), and in modulus 17, 35 is also º 5  (mod 17).
Take a moment to admire the patterns. First, notice that every row of residues repeats after they reach 1. For example, in modulus 7, the powers of 2 and 4 repeat after they get to the third power, but 3 and 5 don't repeat until after the sixth. 6 repeats immediately. In modulus 17, there's more variety. Here, 4 and 13 repeat after the fourth power; 12, 8, 9, and 15 repeat after the eighth power; and 3, 5, 6, 7, 10, 11, 12, and 14 repeat after the sixteenth power.
Focus a bit more on where the 1s pop up in modulus 17. The rows of the powers of 3, 5, 6, 7, 10, 11, 12, and 14 do not reach 1 until the 16th power. But, the rows of powers of 1, 2, 4, 8, 9, 13, 15, and 16 all repeat before the 16th power. Notice that there are eight rows of each type. Gauss called the first type, which doesn't repeat until the 16th power, primitive roots.
Look at how long it takes for the non-primitive roots to reach 1. All of them are congruent to 1 at the 8th power. Some of them are congruent to 1 at the 4th power, such as 1, 4, 13, and 16. Some are congruent to 1 at the second power, such as 1 and 16. None of the powers of any of the numbers, primitive or non-primitive, are congruent to 1 for any power except 2nd, 4th, 8th, and 16th. These happen to be all the possible factors of 16. Do the same analysis for modulus 7, and you will see the same, i.e. none of the residues of the powers of the numbers are congruent to 1, except for those powers equal to factors of 7-1=6.  Primitive roots have the special ability that, all of the least residues are congruent to some one of their powers. Thus, in the powers of 3 relative to modulus 17, every number between 0 and 17 is found, though out of order.3 For any modulus, instead of discussing the least residues, one of the primitive roots can be picked as a base, and the powers of that primitive root can be discussed. For example, every number congruent to 3 raised to an even power in modulus 17 will be a quadratic residue. Check it!
All modular arithmetic can now be done with primitive roots. Nobody wants to square 14 just to see what it is congruent to relative to modulus 17, but with primitive roots, this is easy. 14 is congruent to 39, so 14·14 º 39·39 = 39+9 = 318, which is congruent to 32 º 9  (mod 17), since the primitive root repeats after the 16th power. All multiplications can thus be turned into additions of powers. Recall that this is similar to the work done on Logarithms, where if two numbers are multiplied, their logarithms are simply added.
In both of these charts, the column with the "2" at the top represents all of the quadratic residues. The column has two of each residue, for both modulus 7 and 17. The pattern repeats, backwards, half way down. In other words, each quadratic residue has two quadratic roots. For example, the roots of 9 in modulus 17 are 3 and 14. It is an effect of the top-down ordering of the universe, that all of those cycles which are shorter than those of the primitive roots, coincide with all the quadratic residues. For 17, this means that the longest cycles (3, 5, 6, 7, 10, 11, 12, 14) are quadratic nonresidues. Since the powers of the modulus itself are always congruent to zero, it is degenerate4, and we won't consider it. Thus, since the quadratic residues each have two roots, there will always be exactly half of the modulus minus 1 quadratic residues, disregarding the modulus itself. In other words, [1/2](p-1) residues are quadratic, if p is the modulus.
Pierre de Fermat was the first to recognize that the residues of powers always repeat at the power of the modulus. As we've seen, if the modulus is p, any number a raised to the power of the modulus minus 1 will be congruent to 1, or ap-1 º 1  (mod p). This was known to Gauss as "Fermat's Theorem," and is today called his "Little Theorem," to distinguish it from his "Great Theorem." The residues of powers will always proceed in cycles, and will always repeat, at the most, after the power before the modulus, as if they had come back full circle. There are also the shorter subcycles, which begin repeating after some factor of the modulus minus 1. Gauss called all of these cycles and subcycles periods. Every period completes itself at the p-1 power.
Last, but very important, look at the longest period among the quadratic residues. This always coincides with half of the modulus minus 1: 8 for 17, and 3 for 7. The only residues in this column are 1 for the quadratic residues, and p-1 for the primitive roots. So, in modulus 17, any quadratic residue raised to the power of 8 is congruent to 1, while every primitive root raised to the power of 8 is congruent to 16, which is also congruent to -1, as we saw above. This power represents the square root of the p-1 power, which is itself always congruent to 1 (this is Fermat's theorem). Thus, even within these periodic systems, 1 has two square roots, 1 and -1, which are both at the power [1/2] (p-1). The powers equal to [1/4] (p-1), then, will be square roots, of the square roots of 1. So, in modulus 17, 4 and 13 are the square roots of 16 º -1  (mod 17). Well, there's our old friend, Ö{-1}.

## Gauss and the Finite, Self-Bounded Universe

As was noted in the pedagogical on Prime Numbers, Gauss evidently did not believe in "bad infinities", unlike Euler and Newton. Euler's obsession, as can be seen in his integral calculus textbook, was to claim that any function, including transcendentals, could be held as equivalent to some series of infinitely added terms. He was merely following after Newton's not-calculus, which was not much more than a study of this type of infinite series, exposed as such by Gottfried Leibniz5. The fraud of the existence of such types of infinities was actually exposed, first, by Nicholas of Cusa, in his refutation of Archimedes' attempted quadrature of the circle. As was understood quite clearly by Gauss, any such run-on process that could be construed as "going off into infinity," really represents the existence of a true transcendental, which itself bounds the process. Therefore, infinities do not exist as such.
This is the insight Gauss had when investigating number. The sequence of counting numbers appears to run off without limit, by just adding 1 over and over. There is no number to which 1 cannot be added, in order to attain a greater number. But, as Gauss knew, there must be some higher, transcendental principle bounding even the field of number. This was not unique to Gauss, but was also recognized in part by the Pythagoreans, such as Eratosthenes.
The least residues of the powers, relative to any modulus, always repeat at the modulus minus 1 power, which was first noted by Fermat. Gauss's genius was to recognize that number obviously has a geometrical, periodic character. On just about the last page of his first and only book on modular arithmetic, the Disquisitiones Arithmeticae, Gauss finally lets the cat out of the bag in a footnote. Some of our astute readers might have already caught on. Gauss was not interested in neat number tricks, but in the properties of that universe which produced those anomalies among the numbers that we find neat. Of course, Gauss did make huge charts of numbers,6 but he thought of those numbers in terms of the transcendental.
Draw a circle, and mark off the circumference equally at 7 points. Number these, starting at 0. When you get all the way around, keep going, so that the mark labled "0" is also labled "7." Go around a few times. Do this with 17 also. All numbers that line up with a given dot are congruent with each other, since they are all equal to their least residue, plus some number of complete rotations around the circle.  We can now see how arithmetic in the modulus works. Adding any two numbers together adds their respective numbers of "steps" together. In modulus 7, since 8 is one "step" from 7, adding 8 to any number is the same as adding one more "step" to it. Multiplication is a little more complicated. All numbers can, arithmetically, be considered as functioning exactly like their least residues.
Let's look at the powers of the residues, starting at 2 in modulus 7. Each multiplication by 2 implies a doubling of the number of steps, so that each power is just the number of times the action has been doubled (where 2 represents one doubling of the unit step). 2 doubled is 4. 4 doubled is 8, which is congruent to 1 modulus 7. 1 doubled brings us back to 2, which completes the cycle of 2.

Do the same for 3. This cycle, in which the number of steps is tripled each time, will hit all the residues. Do the same for the rest of the residues modulus 7, then draw the cycle of 2 on the modulus 17 circle. This one repeats after hitting only half the residues (not counting the spot representing the modulus itself), just like in modulus 7. The power cycle for 3 hits all residues, as with modulus 7. Now, do the rest. The cycles of all the primitive roots will always hit every residue, while the others will not.

Now, let us more closely analyze the squares of residues. As in the power charts, only half of the residues will be quadratic residues, so put little squares around them.  When looked at geometrically, it is obvious that there is a pattern of the quadratic residues. For modulus 17, all of the quadratic residues on the top half of the circle have a corresponding quadratic residue directly across the diameter to the other side. It is symmetric about the diameter. On the other hand, the quadratic residues on the top half of the circle of modulus 7 always have corresponding quadratic non-residues across the diameter. It is antisymmetric. A special property that pops out immediately is that, since 1 is always a quadratic residue, no matter what the modulus is, -1 is a quadratic residue in only those moduli that are symmetric, but never in those moduli that are antisymmetric.

Try this with modulus 5 and 19.

We can now begin to classify our finite field of number according to which prime number moduli are symmetric, and which are antisymmetric. The symmetric moduli we have so far are 5 and 17, and the antisymmetric ones are 7 and 19. It would behoove the reader to construct the modulus circles for all prime number moduli up to 100, to collect the two types. For convenience, here is a chart: Is this chart familiar? The symmetric moduli are always our 4n + 1 numbers, while the antisymmetric moduli are always 4n+3 numbers. Therefore, -1 is always a quadratic residue of those numbers whose quadratic residues are symmetric across the diameter, which will always be 4n+1 numbers. It will never be a quadratic residue of antisymmetric, 4n+3 numbers. As was ignored by Euler, -1 is a quadratic residue of 4n+1 numbers, not because of some elaborate logical proof, but because of the geometric quality of those numbers. Another way to look at this is, since the residues on the bottom half of the circle are congruent to the negatives of the numbers on the top half, the negative of a quadratic residue will, itself, be a quadratic residue, only if -1 is also a quadratic residue. Hence, among the moduli 4n+1, -1 functions like a square number, while among the moduli 4n+3, it does not. So, which residues are equal to the square root of -1?  Notice that, in modulus 17, -1 º 16, whose square root is 4, also a square. Gauss would later call -1, when observed from the standpoint of modulus 17, a biquadratic residue, because it is congruent to the square of a square.
At this point, it is highly possible that Gauss saw something yet deeper in this coincidence of spectacular experimental results. In our investigations of the field of number thus far, we have considered it as capable of merely increase or decrease. Thus, from a given number, we can only go up or down. We get into negative numbers when we go way down, then keep going - they represent the opposite direction from increase. As Gauss's student Bernhard Riemann would characterize this almost sixty years later, simple numerical measurement involves only one mode of determination. Gauss's circular modulus thus represents one mode of determination, either clockwise or counterclockwise. You can never leave the circle. But, in his 1831 Second Treatise on Biquadratic Residues, Gauss demonstrated that the symmetric moduli, by virtue of their having -1 as a quadratic residue, are not bound by only one mode of determination, but two.7 We will leave this hypothesis until later, after we see what exactly Gauss was compelled to investigate, in the wake of his insight into the nature of Ö{-1}.

### Footnotes:

1This is from the preface to Gauss' Disquisitiones Arithmeticae. The results of this intense investigation formed the first half of the book.
2from October 19, 1795
3Or, perhaps this is a more accurate ordering of the numbers?
4The modulus is degenerate, but not like such Wall St. perverts as Michael Bloomberg - this zero is a residue that should be kept off the walls of our U.S. government
5Historia et Origio
6Once, Gauss decided to make a list of fractions from [1/2] to about [1/820], along with their decimal values, in order to prove that every decimal repeats after a number of digits equal to or less than the denominator of the fraction! For example, [1/7] = 0.14287457 1428¼, and [1/23] = 0.0434782608695652173913 04347826087¼
7Gauss had tacitly introduced this concept as early as his 1799 dissertation on the Fundamental Theorem of Algebra.

File translated from TEX by TTH, version 3.80.
On 04 Mar 2008, 21:40.