Vous êtes sur la page 1sur 6

6-16-2008

Congruences and Modular Arithmetic


a is congruent to b mod n means that n | a b. Notation: a = b (mod n). Congruence mod n is an equivalence relation. Hence, congruences have many of the same properties as ordinary equations. Congruences provide a convenient shorthand for divisibility relations.

Deniton. Let a, b, and m be integers. a is congruent to b mod m if m | a b; that is, if a b = km for some integer k. Write a = b (mod m) to mean that a is congruent to b mod m. m is called the modulus of the congruence; I will almost always work with positive moduli. Note that a = 0 (mod m) if and only if m | a. Thus, modular arithmetic gives you another way of dealing with divisibility relations.

Example. 101 = 3 (mod 2) and 2 = 101 (mod 3).

Proposition. Congruence mod m is an equivalence relation: (a) (Reexivity) a = a (mod m) for all a. (b) (Symmetry) If a = b (mod m), then b = a(mod m). (c) (Transitivity) If a = b (mod m) and b = c (mod m), then a = c (mod m). Proof. Ill prove transitivity by way of example. Suppose a = b (mod m) and b = c (mod m). Then there are integers j and k such that a b = jm, b c = km. Add the two equations: a c = (j + k)m. This implies that a = c (mod m).

Example. Consider congruence mod 3. There are 3 congruence classes: {. . . , 3, 0, 3, 6, . . .}, {. . . 4, 1, 2, 5, . . .}, {. . . 5, 2, 1, 4, . . .}. Each integer belongs to exactly one of these classes. Two integers in a given class are congruent mod 3. (If you know some group theory, you probably recognize this as constructing Z3 from Z.) When youre doing things mod 3, it is if there were only 3 numbers. Ill grab one number from each of the classes to represent the classes; for simplicity, Ill use 0, 2, and 1. Here is an addition table for the classes in terms of these representatives: + 0 1 2 0 0 1 2 1 1 1 2 0 2 2 0 1

Heres an example: 2 + 1 = 0, because 2 + 1 = 3 as integers, and 3s congruence class is represented by 0. This is the table for addition mod 3. I could have chosen dierent representatives for the classes say 3, 4, and 4. A choice of representatives, one from each class, is called a complete system of residues mod 3. But working mod 3 its natural to use the numbers 0, 1, and 2 as representatives and in general, if Im working mod n, the obvious choice of representatives is the set {0, 1, 2, . . . , n 1}. This set is called the standard residue system mod n, and it is the set of representatives Ill usually use.

Theorem. Suppose a = b (mod m) and c = d (mod m). Then: (a) a + c = b + d (mod m). (b) ac = bd (mod m). Note that you can use the second property and induction to show that if a = b (mod m), then an = bn (mod m) Proof. Suppose a = b (mod m) and c = d (mod m). (a) m | a b and m | c d, so by properties of divisibility, m | (a b) + (c d) = (a + c) (b + d). This implies that a + c = b + d (mod m). (b) m | a b and m | c d imply that there are integers j and k such that mj = a b Therefore, a = b + mj Multiplying these two equations, I obtain ac = (b + mj )(d + mk) ac = bd + m(dj + bk + mjk) ac bd = m(dj + bk + mjk) Hence, m | ac bd, so ac = bd (mod m). Corollary. Suppose a = b (mod m). Then: (a) a c = b c (mod m). (b) ac = bc (mod m). Proof. Apply the theorem to the equations a = b (mod m) and c = c (mod m). and c = d + mk. and mk = c d. for all n 1.

Example. (Reducing an expression mod n) Reduce 9910 (mod 7) to an element in the standard residue system {0, 1, . . . , 6}. 99 = 1 (mod 7), so 9910 = 110 = 1 (mod 7) . 2

Example. (A modular binomial theorem) If p is prime, then (x + y )p = xp + y p (mod p) . By the Binomial Theorem, (x + y )p =
i=0 p

p i pi xy . i

A typical coecient remain are xp and y p . For example

p i

p! is divisible by p for i = 0, p. So going mod p, the only terms that i! (p i)!

(x + y )2 = x2 + y 2 (mod 2)

and

(x + y )3 = x3 + y 3 (mod 3) .

The result is not true if the modulus is not prime. For example, (1 + 1)4 = 0 (mod 4) , but 14 + 14 = 2 (mod 4) .

Example. Solve the congruence 2x + 11 = 7 (mod 3) . First, reduce all the coecients mod 3: 2x + 2 = 1 (mod 3) . Next, add 1 to both sides, using the fact that 2 + 1 = 0 (mod 3): 2x = 2 (mod 3) . Finally, multiply both sides by 2, using the fact that 2 2 = 4 = 1 (mod 3): x = 1 (mod 3) . That is, any number in the set {. . . , 5, 2, 1, 4, . . .} will solve the original congruence.

Remark. Notice that I accomplished division by 2 (in solving 2x = 2 (mod 3) by multiplying by 2. The reason this works is that, mod 3, 2 is its own multiplicative inverse. Recall that two numbers x and y are multiplicative inverses if x y = 1 and y x = 1. For example, in 3 5 the rational numbers, and are multiplicative inverses. Division by a number is dened to be multiplication 5 3 1 by its multiplicative inverse. Thus, division by 3 means multiplication by . 3 In the integers, only 1 and 1 have multiplicative inverses. When you perform a division in Z such as dividing 2x = 6 by 2 to get x = 3 you are actually factoring and using the Zero Divisor Property: 2x = 6, 2x 6 = 0, 2(x 3) = 0, x 3 = 0, x = 3.

(I used the Zero Divisor Property in making the third step: Since 2 = 0, x 3 must be 0.) In doing modular arithmetic, however, many numbers may have multiplicative inverses. In these cases, you can perform division by multiplying by the multiplicative inverse. 3

Here is a multiplication table mod 3, using the standard residue system {0, 1, 2}: 0 1 2 0 0 0 0 1 0 1 2 2 0 2 1

You can construct similar tables for other moduli. For example, 2 and 3 are multiplicative inverses mod 5, because 2 3 = 1 (mod 5). So if you want to divide by 3 mod 5, you multiply by 2 instead. This doesnt always work. For example, consider 2x = 4 (mod 6) . 2 does not have a multiplicative inverse mod 6; that is, there is no k such that 2k = 1 (mod 6). You can check by trial that the solutions to the equation above are x = 2 (mod 6) and x = 5 (mod 6) just look at 2x (mod 6) for x = 0, 1, 2, 3, 4, 5. Which elements have multiplicative inverses? If an element has a multiplicative inverse, how do you nd it? Ill discuss these questions shortly. Proposition. If ac = bc (mod m), then a=b Proof. Write ac bc = km, Then (a b) (Notice that where k Z. mod m (c, m) .

c m =k . (c, m) (c, m)

c m c and are integers, since (c, m) | c and (c, m) | m.) Now divides the (c, m) (c, m) (c, m) m . Therefore, it must divide k: right side, but its relatively prime to (c, m) k= Hence, (a b) c j (c, m) for some j Z.

c c m = j , (c, m) (c, m) (c, m) m . ab=j (c, m)

This proves that a = b

mod

m . (c, m)

Notice that you divide the equality by c, but you divide the modulus by (c, m).

Example. In 2x = 4 (mod 7) , 2 is a common factor of 2 and 4, and (2, 7) = 1, so x = 2 (mod 7) . 4

Alternatively, notice that 2 4 = 1 (mod 7), so if I multiply the equation by 4, I get x = 2 (mod 7) .

Example. (Solving a congruence with cancellation) Solve 8x = 4 (mod 14) . I want to divide the 8 and 4 by the common factor of 4. Since (4, 14) = 2, I divide the modulus by 2. This gives 2x = 1 (mod 7) . Now 4 2 = 1 (mod 7), so if I multiply both sides by 4, I get x = 4 (mod 7) . The original equation had modulus 14, so I need solutions mod 14. To nd all of them, look at the numbers which satisfy x = 4 (mod 7) in the standard residue system 0, 1, 2, . . . , 13. The numbers are 4 and 4 + 7 = 11. Hence, the solutions are x = 4 (mod 14) or x = 11 (mod 14).

Earlier examples showed that you can often use multiplicative inverses to solve congruences. What numbers have multiplicative inverses mod n? Theorem. m has a multiplicative inverse mod n if and only if (m, n) = 1. Proof. Suppose m has a multiplicative inverse mod n. This means that am = 1 (mod n) for some a. Then am + bn = 1 for some Hence, (m, n) = 1. Conversely, if (m, n) = 1, then am + bn = 1 for some a, b Z. b Z.

Reducing mod n, I get am = 1 (mod n), which means that m has a multiplicative inverse mod n.

Example. (Finding elements which have multiplicative inverses) Find the elements in {0, 1, 2, . . . , 11} which have multiplicative inverses mod 12. The numbers in {0, 1, 2, . . . , 11} which are relatively prime to 12 and 1, 5, 7, and 11. Hence, 1, 5, 7, and 11 have multiplicative inverses mod 12.

If I know (m, n) = 1, then m has a multiplicative inverse mod n. But how do I nd the inverse? Its an easy application of the Extended Euclidean Algorithm.

Example. (Finding a modular multiplicative inverse) Find 291 (mod 48). 5

Note that (29, 48) = 1. Do the Extended Euclidean Algorithm: a 48 29 19 10 9 1 Thus, 1 = (29, 48) = 5 29 3 48. Reduce mod 48: 1 = 5 29 (mod 48) . Hence, 291 = 5 (mod 48). q 1 1 1 1 9 y 5 3 2 1 1 0

c 2008 by Bruce Ikenaga

Vous aimerez peut-être aussi