Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Congruences and Modular Arithmetic - Prof. Daniel E. Smith, Assignments of Mathematics

The concept of congruences and modular arithmetic using the example of the number system z12. It covers addition and multiplication in z12, and provides rules for finding remainders of larger numbers modulo a given number. The document also includes examples and exercises.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-1fz
koofers-user-1fz 🇺🇸

5

(1)

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Congruences
First let us recall some facts about division. Suppose that we were to divide
6 by 2. Then the quotient is 3 and the remainder is 0. So we have
6
2= 3 iff 6 = 2(3)
Now suppose we were to divide 7 by 2. The quotient is 3 and the remainder is
1. We can write this as 7
2= 3 + 1
2.
If we multiply both sides by 2 we get
7 = 2(3) + 1.
And so in general if we divide bby aand get a quotient of qand remainder of
rwe can write this as
b=aq +r.
Suppose that it is 11:00. What time will it be in 2 hours? Well in 1 hour
it will be 12:00 and in 1 more hour it will be 1:00. We will call this clock
arithmetic.
12 1
2
3
4
5
6
7
8
9
10
11
Figure 1: A 12 hour clock.
We would like a number system that behaves like clock arithmetic. But we
need our new number system to have a 0. Recall that in military time we start
with 0 and go to 23. So we will do the same thing and start with 0, but we will
only go to 11 in our number system.
1
pf3
pf4
pf5

Partial preview of the text

Download Understanding Congruences and Modular Arithmetic - Prof. Daniel E. Smith and more Assignments Mathematics in PDF only on Docsity!

Congruences

First let us recall some facts about division. Suppose that we were to divide 6 by 2. Then the quotient is 3 and the remainder is 0. So we have

6 2 = 3 iff 6 = 2(3)

Now suppose we were to divide 7 by 2. The quotient is 3 and the remainder is

  1. We can write this as 7 2

If we multiply both sides by 2 we get

7 = 2(3) + 1.

And so in general if we divide b by a and get a quotient of q and remainder of r we can write this as b = aq + r. Suppose that it is 11:00. What time will it be in 2 hours? Well in 1 hour it will be 12:00 and in 1 more hour it will be 1:00. We will call this clock arithmetic.

Figure 1: A 12 hour clock.

We would like a number system that behaves like clock arithmetic. But we need our new number system to have a 0. Recall that in military time we start with 0 and go to 23. So we will do the same thing and start with 0, but we will only go to 11 in our number system.

Figure 2: The number system Z 12

We will call this new number system Z 12 , which is pronounced “z mod 12”. We can do arithmetic in our new number system if we are a little careful. So for example 2 + 3 = 5 7 + 2 = 9 5 + 6 = 11 1(7) = 7 2(3) = 6 2(5) = 10

This makes sense because if we start at the number 2 and advance 3 steps around Figure we will be at 5. What if we tried to add 11 + 2? In our normal number system that would be 13, but there is no number 13 in Z 12. So what do we do? Well if we start at 11 and advance 2 steps around Figure we will be at 1. So we could say that 11 + 2 = 1, but this might be a little confusing since 11 + 2 = 13 in our normal number system. So what we will do is to write this as

11 + 2 ≡ 1 mod 12.

So we can now add or multiply any two numbers from Z 12.

5 + 7 ≡ 0 mod 12 8 + 9 ≡ 5 mod 12 2 + 3 + 9 ≡ 2 mod 12 3(4) ≡ 0 mod 12 3(5) ≡ 3 mod 12 8(9) ≡ 0 mod 12

The addition is pretty easy. Start with the first number in the addition and advance around Figure however far the second number tells you to go. Now since multiplication can be thought as a shorthand for addition we could do it the same way. For example 3(5) = 5 + 5 + 5. So we could start at 5 and advance by 5 and then advance by 5 again. This could become cumbersome for 8(9). One way of calculating this product would be to construct the following table.

Hey! This looks like division:

12 = 1(12) + 0 15 = 1(12) + 3 30 = 2(12) + 6 12 12

So to find 11(11) mod 12 we can multiply 11(11) = 121 and then find the re- mainder of dividing 121 by 12: 121 = 10(12) + 1. So 11(11) ≡ 1 mod 12. Sup- pose we want to find 30 mod 105. Since 30 = 0(105) + 30, 30 ≡ 30 mod 105. Also 110 ≡ 5 mod 105, since 110 = 1(105) + 5. So now we can work in Z 105 just as easily as Z 3. Now let us see how to do some calculations using modular arithmetic. Sup- pose we want to find a + b mod n. Let us pick some numbers for a, b, and n and see what happens. Let a = 3, b = 6, and n = 2. Well a + b = 3 + 6 = 9 ≡ 1 mod 2. Now let us find 3 mod 2 and 6 mod 2. Well 3 ≡ 1 mod 2 and 6 ≡ 0 mod 2. So 3 mod 2 + 6 mod 2 = 1 + 0 = 1. Hence 3 mod 2 + 6 mod 2 ≡ 3 + 9 mod 2. Therefore it looks like the rule is a + b mod n ≡ a mod n + b mod n. But let us look at another example first. Suppose we let a = 3, b = 5, and n = 2. Now we have 3 + 5 ≡ 8 ≡ 0 mod 2. Also 3 ≡ 1 mod 2 and 5 ≡ 1 mod 2, so 3 mod 2 + 5 mod 2 = 1 + 1 = 2. But it should have been 0. So let us mod out by 2 one more time and we get

(3 mod 2 + 5 mod 2) mod 2 ≡ 1 + 1 mod 2 ≡ 2 mod 2 ≡ 0 mod 2.

So we can see the rule should be

a + b mod n ≡ (a mod n + b mod n) mod n.

Similarly ab mod n ≡ ((a mod n) · (b mod n)) mod n.

Example 1. Simplify 5 + 2(4) + 11 mod 3. Well we have

5+2(4)+11 mod 3 ≡ (5 mod 3+(2 mod 3)(4 mod 3)+11 mod 3) mod 3

≡ (2 + 2(1) + 2) mod 3 ≡ 6 mod 3 ≡ 0 mod 3

Now let us play with exponents. Suppose we want to find 7^4 mod 3. We can rewrite this as

7(7)(7)(7) mod 3 ≡ ((7 mod 3)(7 mod 3)(7 mod 3)(7 mod 3)) mod 3

≡ (7 mod 3)^4 mod 3 ≡ 14 mod 3 ≡ 1 mod 3.

So 7^4 mod 3 ≡ 1 mod 3. This gives us the general rule

am^ mod n ≡ (a mod n)m^ mod n.

What is 8^4 mod 3?

84 mod 3 ≡ (8 mod 3)^4 mod 3 ≡ 24 mod 3 ≡ 8 mod 3 ≡ 2 mod 3.

Next let us look at 5^12 mod 7. Since 5 ≡ 5 mod 7 we cannot simplify this like before. So we need a new trick. First we recall that bm+n^ = bmbn^ and (bn)m^ = bmn. The other part of the trick is to rewrite 12 in the right way. We will write 12 as 8 + 4. So 512 = 58+4^ = 5^854.

Now

54 mod 7 ≡ (5^2 )^2 mod 7 ≡ 252 mod 7 ≡ 42 mod 7 ≡ 16 mod 7 ≡ 2 mod 7

and

58 mod 7 ≡ (5^4 )^2 mod 7 ≡ 22 mod 7 ≡ 4 mod 7.

So

512 mod 7 ≡ 5854 mod 7 ≡ 2(4) mod 7 ≡ 8 mod 7 ≡ 1 mod 7.

So why did I write 12 as 8 + 4? Before I explain why i did this let me explain how I choose 8 and 4. First recall your powers of 2:

n 0 1 2 3 4 5 6 7 8 9 10 2 n^1 2 4 8 16 32 64 128 256 512

Now to rewrite 12 I first look for the largest power of 2 less than 12. This is 8. So 12 = 8 + 4. Since 4 is a power of 2 I am done.

Example 2. Write 13 as a sum of powers of 2. First we find the largest power of 2 smaller than 13. This is 8 , So 13 = 8 +5. Now find the largest power of 2 smaller than 5 , it is 4. So 13 = 8 + 4 + 1. Since 1 is a power of 2 we are done.

Example 3. Let us see some more expansions as sums of powers of 2.

7: 7 = 4 + 2 + 1

23 23 = 16 + 4 + 2 + 1

50: 50 = 32 + 16 + 2

Homework

  1. Divide b by a and write the result in the form b = aq + r, where q is the

    • (a) a = 2 b = quotient and r is the remainder.
    • (b) a = 3 b =
      • (c) a = 2 b =
    • (d) a = 5 b = - (e) a = 7 b = - (f) a = 3 b = - (g) a = 5 b = - (h) a = 37 b = - (i) a = 17 b = - (j) a = 11 b =
      • (a) 7 ≡ x mod 2. Find x.
    • (b) 15 ≡ x mod
      • (c) 21 ≡ x mod
    • (d) 23 ≡ x mod
      • (e) 11 ≡ x mod - (f) 33 ≡ x mod - (g) 152 ≡ x mod - (h) 164 ≡ x mod - (i) 178 ≡ x mod
      • (a) 2 + 5 mod 3. Simplify.
    • (b) 5(7) mod
      • (c) 3 + 2(7) + 6 mod
    • (d) 7^2 + 2(12) + 3(5) mod
      • (e) 11 + 15(23) mod - (f) 11(15)(17) + 6(55) mod - (g) 8(15) + 13(12) + 103 mod - (h) 2^4 + 6(13) mod - (i) 12(17) + 22 + 51 mod - (j) 105 + 123(154) + 58 mod
    1. Express as a sum of powers of
      • (a)
    • (b)
      • (c)
    • (d) - (e) - (f) - (g) - (h) - (i) - (j) - (k) - (l)
      • (a) 3^7 mod 5. Simplify
    • (b) 5^13 mod
      • (c) 2^17 mod
    • (d) 6^23 mod - (e) 4^31 mod - (f) 3^51 mod - (g) 5^85 mod - (h) 7^101 mod - (i) 3^120 mod - (j) 9^130 mod