Showing posts with label modular arithmetic. Show all posts
Showing posts with label modular arithmetic. Show all posts

Jan 27, 2011

Division ±mod 11

OK, I've waited too long. Here's an example of modular division with a prime modulus, i.e., 11. By way of reference I also include the multiplication table. I have replaced 6, 7, 8, 9, and 10 with their negative values: –5, –4, –3, –2, and –1, respectively.


I won't attempt to explain this or comment on it, other than saying I think it's beautiful.

Dec 30, 2010

Modular division

Sorry, I've been very lazy about adding content here. In this entry I will consider modular division.

If the modulus m is not prime, some divisions have multiple results and others have none. Here, for example, is the division table for mod 10):



We see that 1, for example, is divisible only by itself, 3, 7, and 9. By contrast, 2 is divisible by every number except 5 and 0, but some of the results overlap: 2/2 equals both 1 and 6; conversely both 2/2 and 2/7 equal 6. The number 5 is rather special: It can be divided by every odd number; 5/5 can equal any odd number, and 0/5 can equal any even number; also, 5 shows up as a second quotient when 0 is divided by an even number.

In terms of regular, non-modular arithmetic, we may interpret the results as follows: 1/1=1 (the result shown in column 1, row /1) means that if an integer ending in 1 is evenly divisible by another integer ending in 1, the quotient will also end in 1, for example, 1/1, 11/1, 11/11, 111/1, and 121/11. And 6/8=2, 7 (column 6, row /8) means that means that if an integer ending in 6 is evenly divisible by an integer ending in 8, the quotient may end in either 2, as with 16/8, 36/18, and 96/8, or 7, as with 56/8, 126/18, and 136/8.

Where/how did I find these results? Well, the way I actually did it was slightly (?) messy, but the simple answer is that they can all be derived from the mod 10 multiplication table:



For example, consider the /2 row of the division table. To fill in the values, we must find 1/2, 2/2, 3/2, etc. In other words, we are looking for the values that satisfy a=1/2, b=2/2, c=3/2, d=4/2 and so forth. We can rewrite the equalities as 2a=1, b=2, 2c=3, 2d=4. etc. Having done so, we can look for a simply by running our eye down column 2 and finding the row(s) in which the result is 1, meaning that 2a=1. There aren't any. No number can be multiplied by 2 to give a result of 1 in mod 10.

With d=4/2, by contrast, if we follow the same procedure, rewriting the equality as 2d=4, and looking down column 2, we find a result of 4 in row 2 and again in row 7.

Comparing the two tables, we see that division by 1 (row /1 in the division table) is equivalent to multiplication by 1. This of course is not very surprising or interesting. Rather more interesting is that division by 3 turns out to be equivalent to multiplication by 7, and vice versa. Also, division by 9 is equivalent to multiplication by 9.

Now let's try switching to ±mod 10, meaning a notation using both positive and negative numbers (as introduced in my previous entry). This means replacing 9 with –1, 8 with –2, 7 with –3, and 6 with –4. For balance, let's add + signs to 1, 2, 3, and 4, and so as to leave no number unsigned, let's add ± signs to 5 and 0. Here's how the division table looks with this notation:


Just as with multiplication (see my previous entry), using ±mod notation gives all sorts of additional symmetry to the table. Above I wrote, "Division by 3 turns out to be equivalent to multiplication by 7, and vice versa. Also, division by 9 is equivalent to multiplication by 9." These results become less surprising here. In mod 10, 3*7 = 1, which we take as just one of the many results of multiplication. But in ±mod 10, we can easily derive (+3)*(–3) = –9 = +1. This strikes me as more satisfying, though of course it is simply a matter of using different notation. And the second result, concerning division and multiplication by 9, becomes downright trivial when presented as "division by –1 is equivalent to multiplication by –1."

So that's mod 10 division. Things get much more interesting, IMO, when we consider prime moduli, which I plan to do in my next entry.

Jun 13, 2010

More ±modular arithmetic

I have been playing around with modular arithmetic sporadically since earlier this year, and I posted a couple of entries about my observations in my old blog.

Fun with modular arithmetic (1)
Fun with modular arithmetic (2)

What is modular arithmetic? Here is the introductory sentence from the Wikipedia article about the subject:
In mathematicsmodular arithmetic (sometimes called clock arithmetic) is a system of arithmetic for integers, where numbers "wrap around" after they reach a certain value—the modulus 
Ordinary arithmetic may be thought of as using numbers on a line stretching infinitely from left to right; modular arithmetic may be thought of as using numbers wrapped around a circle.



I have noted that introducing negative numbers gives added symmetry to the modular multiplication table. With mod 10, for example, the conventional multiplication table (omitting the 0 column and row for simplicity) looks like this, with symmetry across both diagonals:



But with negative numbers, we get this:







I think the additional symmetry is beautiful—specifically, the negative mirroring left to right and top to bottom across the ±5 column and row. Nothing surprising about it, of course, but pretty nonetheless. Oh, and I would call your attention to the main diagonal (colored blue), which gives the products of numbers multiplied by themselves, i.e., squares. It turns out that all the squares are either plus or minus 1, plus or minus 4, or 5. And of course we mustn't forget 0, which is the product of 0 times 0. Using positive values, we have six possibilities: 0, 1, 4, 5, 6, and 9. In regular arithmetic, the final digit of any square number must be one of these six; i.e., no square numbers end in 2, 3, 7, or 8.

Moving right along, let's look at the multiplication table for mod 13, using both positive and negative numbers:





Here, since the modulus is odd, we don't have anything like the ±5 row and column in the ±mod 10 table, but we still have the negative mirroring of the left and right halves and top and bottom halves. And in this case it turns out that the squares, aside from 0, are limited to plus and minus 1, 3, and 4. Which may not be such an interesting observation, but note also that each row and column includes all the digits. This is because the modulus is prime. And each half row and half column includes either the positive or the negative value of all of the digits. This is a regularity that isn't be so obvious with the usual sort of notation, using positive numbers only, where the left-right and top-bottom mirroring is not to be seen:





With a prime modulus like 13 we can also present a complete division table, since every number except zero is uniquely divisible by every other number. I will show that another time. Meanwhile, here is a link to a page with many more interesting observations about modular arithmetic—which would be even better, IMHO, if it used negative numbers:

http://www.cut-the-knot.org/blue/Modulo.shtml