Modular Arithmetic

views updated May 11 2018

Modular Arithmetic

Modular arithmetic derives from the concept of congruence modulo m, written symbolically as

a =̅ b (mod m)

where a and b are any integers and m is a positive integer greater than 1. This means that a - b is divisible by m. For example,

36 =̅ 16 (mod 5)

since 36 - 16 = 20 is divisible by 5. Likewise 11 =̅ 38 (mod 9) because 11-38 = -27 is divisible by 9.

The concept of congruence was first used by Carl Friedrich Gauss (1755-1855). Gauss was a mathematician as well as a master of astronomy, physics, geodesy, and statistics. He lived in Germany and for many years was director of the university observatory in Göttingen.

Many of the properties of equality are also true for congruences. For example, consider modulo 5.

Since 5 =̅ 0 (mod 5), 6 =̅ 1 (mod 5), 7 =̅ 2 (mod 5), etc., we need only consider the set, called a complete residue set. Then, for example,

1 + 2 = 3, 3 + 4 = 2 [since 7 =̅ 2 (mod 5)], and 2 × 3 = 1 [since 6 =̅ 1 (mod 5)].

Indeed, we can produce tables for addition and multiplication. Where we note that not only do we have

a + b = b + a and a × b = b × a

for all a and b in the set (addition and multiplication are commutative), but less obviously, we have associatively

a + (b + c) = (a + b) + c and a × (b × c)= (a × b) × c

and distributivity

a × (b + c)= a × b + a × c

again for all a, b, c in the set. Furthermore, we have an additive identity, 0, such that a + 0 = 0 + a for all a in the set and a multiplicative identity, 1, such that a × l = l × a for a in the set. We can also see that we have both additive and multiplicative inverses. That is, for any a in we have a b such that

a + b = b + a = 0

and a c such that

a × c = c × a = 1

for any a in {1, 2, 3, 4}. Specifically we have

1 + 4 = 0, 2 + 3 = 0, 3 + 2 = 0, and 4 + 1 = 0 and l × 1 = 1, 2 × 3 = 1, 3 × 2 = 1, and 4 × 4 = 1

A system in which an addition and a multiplication are defined and for which the commutative, associative, and distributive properties hold, where there exist identities for addition and multiplication, where every element has an additive inverse, and every nonzero element has a multiplicative inverse, is called a field. Other examples of fields are the set of rational numbers and the set of real numbers. Since the number of elements in our set is finite, we have an example of finite field.

Do these results hold for an J complete residue set? Indeed they do, except for the existence of multiplicative inverses. Thus, if we consider the complete residue system mod 4 (0, 1, 2, 3) we see that there is no multiplicative inverse for 2 since 2 × 0 = 0,2 × l = 2,2 × 2 = 0 [(because4 =̅ 0(mod4)] and 2 × 3 = 2.

In order for multiplicative inverses to exist in a complete residue system mod m, it is necessary and sufficient for m to be a prime, or a number whose only divisors are 1 and m. Thus 2, 3, 5, 7, 11, and 13 are all primes but 4, 6, 8 and 9 are not.

The concept of congruence can be used to establish a rule for deciding whether a number is divisible by 9. A number is divisible by 9 if and only if the sum of its digits is divisible by 9. Thus, for example, 243,648 is divisible by 9 because 2 + 4 + 3 + 6 + 4 + 8 = 27 is divisible by 9 whereas 243,649 is not because 28 is not divisible by 9. A proof of this fact depends upon the fact that 10 =̅ 1 (mod 9).

Modular Arithmetic

views updated May 14 2018

Modular arithmetic

Modular arithmetic derives from the concept of congruence modulo m, written symbolically as

where a and b are any integers and m is a positive integer greater than 1. This means that a - b is divisible by m. For example,

since 36 - 16 = 20 is divisible by 5. Likewise 11 ≡38 (mod 9) because 11-38 = -27 is divisible by 9.

The concept of congruence was first used by Carl Friedrich Gauss (1755-1855). Gauss was a mathematician as well as a master of astronomy , physics , geodesy, and statistics . He lived in Germany and for many years was director of the university observatory in Göttingen.

Many of the properties of equality are also true for congruences. For example, consider modulo 5. Since 5 ≡ 0 (mod 5), 6 ≡ 1 (mod 5), 7 ≡ 2 (mod 5), etc., we need only consider the set, called a complete residue set. Then, for example,

Indeed, we can produce tables for addition and multiplication . Where we note that not only do we have

for all a and b in the set (addition and multiplication are commutative), but less obviously, we have associatively

and distributivity

again for all a, b, c in the set. Furthermore, we have an additive identity, 0, such that a + 0 = 0 + a for all a in the set and a multiplicative identity, 1, such that a × l = l × a for a in the set. We can also see that we have both additive and multiplicative inverses. That is, for any a in we have a b such that

and a c such that

for any a in {1, 2, 3, 4}. Specifically we have

and

A system in which an addition and a multiplication are defined and for which the commutative, associative, and distributive properties hold, where there exist identities for addition and multiplication, where every element has an additive inverse, and every non-zero element has a multiplicative inverse, is called a field . Other examples of fields are the set of rational numbers and the set of real numbers . Since the number of elements in our set is finite, we have an example of finite field.

Do these results hold for an J complete residue set? Indeed they do, except for the existence of multiplicative inverses. Thus, if we consider the complete residue system mod 4 (0, 1, 2, 3) we see that there is no multiplicative inverse for 2 since 2 × 0 = 0, 2 × l = 2, 2 × 2 = 0 [(because 4 ≡ 0 (mod 4)] and 2 × 3 = 2.

In order for multiplicative inverses to exist in a complete residue system mod m, it is necessary and sufficient for m to be a prime, or a number whose only divisors are 1 and m. Thus 2, 3, 5, 7, 11, and 13 are all primes but 4, 6, 8 and 9 are not.

The concept of congruence can be used to establish a rule for deciding whether a number is divisible by 9. A number is divisible by 9 if and only if the sum of its digits is divisible by 9. Thus, for example, 243,648 is divisible by 9 because 2 + 4 + 3 + 6 + 4 + 8 = 27 is divisible by 9 whereas 243,649 is not because 28 is not divisible by 9. A proof of this fact depends upon the fact that 10 ≡ 1 (mod 9).

modular arithmetic

views updated May 14 2018

modular arithmetic (residue arithmetic) Arithmetic based on the concept of the congruence relation defined on the integers and used in computing to circumvent the problem of performing arithmetic on very large numbers.

Let m1, m2,…, mk be integers, no two of which have a common factor greater than one. Given a large positive integer n it is possible to compute the remainders or residues r1, r2,…, rk such that nr1 (mod m1) nr2 (mod m2) … nrk (mod mk)

Provided n is less than m1 × m2 × … × mk

n can be represented by (r1,r2,…,rk)

This can be regarded as an internal representation of n. Addition, subtraction, and multiplication of two large numbers then involves the addition, subtraction, and multiplication of corresponding pairs, e.g. (r1,…,rk) + (s1,…,sk) = (r1 + s1, …, rk + sk)

Determining the sign of an integer or comparing relative magnitudes are less straightforward.

residue arithmetic

views updated Jun 08 2018

residue arithmetic Another name for modular arithmetic.