06.01.2015 Views

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.2. MODULAR ARITHMETIC 39<br />

While % and ≡ are very closely related, they have an important difference:<br />

% performs an operation and ≡ is a statement. The symbol % is an operation,<br />

like addition. It turns two numbers into a third. But ≡ is a true/false statement,<br />

like equals. The mathematical statement 7 = 9 is a false one, while 7 = 9 − 2 is<br />

a true one. Similarly, 28 ≡ 2 (mod 26) is true and 29 ≡ 2 (mod 26) is false.<br />

If A%n = B then A ≡ B (mod n). For example, 78%10 = 8 so 78 ≡ 8<br />

(mod 10). Conversely, if A ≡ B (mod n), then A%n = B%n. For example,<br />

31 ≡ 17 (mod 7) since 31%7 = 3 = 17%7. Notice, however, that 31%7 ≠ 17<br />

and 17%7 ≠ 31. So the “equivalence modulo” statement, ≡ (mod n), is slightly<br />

weaker than “ equal remainder,” %n =.<br />

For the next several chapters the remainder operator will dominate and it<br />

will be a while until we see how powerful equivalence is. But since we’ve done<br />

most <strong>of</strong> the work, let us state the following.<br />

Theorem 1 Suppose A and B are any integers, and n is a positive integer. We<br />

write A ≡ B (mod n) if any <strong>of</strong> the following equivalent statements are true:<br />

1. A%n = B%n.<br />

2. A and B have the same remainder when divided by n.<br />

3. n divides B − A with remainder 0.<br />

4. A and B differ by a multiple <strong>of</strong> n.<br />

Perhaps the language in the theorem is a bit unfamiliar. By “equivalent<br />

statements” we simply mean that when numerical values are substituted for A,<br />

B and n, then either all <strong>of</strong> the statements will be true, or all <strong>of</strong> them will be<br />

false. In less formal language, each statement contains the same information,<br />

they just present it in different ways. For example if A and B have the same<br />

remainder when divided by n, then A − B will have no remainder. So A − B<br />

will be a multiple <strong>of</strong> n, or A and B will differ by n.<br />

Doing algebra using ≡ is very similar to the algebra you are used to. In fact,<br />

+, −, × and the Associate, Commutative, and Distributive Rules all work using<br />

≡ just like they always did with =. Division, however, is more complicated, as<br />

the following examples show.<br />

Examples: Examples <strong>of</strong> Division in Modular Arithmetic.<br />

(1) 3x ≡ 9 (mod 7) has the usual solution x = 3.<br />

(2) 3x ≡ 9 (mod 12) has the usual solution x = 3, but also x = 7 and x = 11.<br />

(3) 3x ≡ 8 (mod 7) has the unusual solution x = 5.<br />

(4) 3x ≡ 8 (mod 12) has no solutions.<br />

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!