WHY? rem(a,n) = rem(b,n) 66666663 example: 30 12 (mod 9) 788253 - - PowerPoint PPT Presentation

why
SMART_READER_LITE
LIVE PREVIEW

WHY? rem(a,n) = rem(b,n) 66666663 example: 30 12 (mod 9) 788253 - - PowerPoint PPT Presentation

Congruence mod n Mathematics for Computer Science MIT 6.042J/18.062J Def : a b (mod n) Congruences: iff n|(a - - b) example: 30 12 (mod 9) arithmetic (mod n) since 9 divides (30 - 12) congruence.1 congruence.2 Albert R Meyer, March


slide-1
SLIDE 1

Albert R Meyer, March 9, 2015

Congruences: arithmetic (mod n)

Mathematics for Computer Science

MIT 6.042J/18.062J

congruence.1 Albert R Meyer, March 9, 2015

Congruence mod n

Def: a ≡ b (mod n) iff n|(a -

  • b)

example: 30 ≡ 12 (mod 9)

since 9 divides (30 - 12)

congruence.2 Albert R Meyer, March 9, 2015

example:

66666663 ≡ 788253 (mod 10)

WHY?

66666663

  • 788253

xxxxxxx0

Congruence mod n

congruence.3 Albert R Meyer, March 9, 2015

a ≡ b (mod n) iff rem(a,n) = rem(b,n)

Remainder Lemma

example: 30 ≡ 12 (mod 9)

since

rem(30,9) = 3 = rem(12,9)

congruence.4

4/2/08 2:20PM

1

slide-2
SLIDE 2

Albert R Meyer, March 9, 2015

a ≡ b (mod n) iff rem(a,n) = rem(b,n) rb,n

abbreviate:

congruence.5

Remainder Lemma

Albert R Meyer, March 9, 2015

a = qan + ra,n b = qbn + rb,n if rem’s are =, then a-b=(qa-qb)n

proof: (if)

so n|(a-b)

congruence.6

()

Albert R Meyer, March 9, 2015

proof: (only if)

()

a = qan + ra,n b = qbn + rb,n

conversely, n|(a-b) means

congruence.9 Albert R Meyer, March 9, 2015

n|((qa-qb)n + (ra,n-rb,n))

n|

so

n|

|--| < n

IMPLIES ra,n= rb,n

congruence.10

proof: (only if)

4/2/08 2:20PM

2

slide-3
SLIDE 3

a ≡ rem(a,n) (mod n)

Albert R Meyer, March 9, 2015

a ≡ b (mod n) iff rem(a,n) = rem(b,n)

QED

congruence.11

Remainder Lemma

Albert R Meyer, March 9, 2015

symmetric a ≡ b (mod n) implies b ≡ a (mod n) transitive a ≡ b & b ≡ c (mod n) implies a ≡ c (mod n)

Corollaries

congruence.12 Albert R Meyer, March 9, 2015

Corollary:

pf: 0 ≤ ra,n < n, so ra,n = rem(ra,n,n)

Remainder arithmetic

congruence.13

a ≡ rem(a,n) (mod n) f 0

Albert R Meyer, March 9, 2015

If a ≡ b (mod n), then a+c ≡ b+c (mod n) pf: n | (a -

  • b) implies

n | ((a+c) -(b +c))

Congruence mod n

congruence.14

4/2/08 2:20PM

3

rem a,n (mod n ) ≡

slide-4
SLIDE 4

Albert R Meyer, March 9, 2015

If a ≡ b (mod n), then a⋅c ≡ b⋅c (mod n)

pf: n | (a - b) implies

n | (a - b)⋅c, and so n | ((a⋅c) – (b⋅c))

congruence.16

Congruence mod n

Albert R Meyer, March 9, 2015

Corollary: If a ≡ b (mod n) & c ≡ d (mod n), then a+c ≡ b+d (mod n)

congruence.17

⋅ ⋅

Congruence mod n

Albert R Meyer, March 9, 2015

Cor: If a ≡ a’ (mod n),

then replacing a by a’ in any arithmetic formula gives an ≡ (mod n) formula

congruence.18

Congruence mod n

Albert R Meyer, March 9, 2015

So arithmetic (mod n) a lot like ordinary arithmetic

congruence.19

Congruence mod n

4/2/08 2:20PM

4

slide-5
SLIDE 5

0 to n-1

Albert R Meyer, March 9, 2015

important: congruence & a ≡ rem(a,n) (mod n) keeps (mod n) arithmetic in the remainder range

congruence.20

Remainder arithmetic

[0,n)

Albert R Meyer, March 9, 2015

example: 2879 ≡ ? (mod 4)

2879 ≡ 39 since r287,4 = 3 = ((32)2)2.3 ≡ (12)2.3 since r9,4 =1 = 3 (mod 4)

congruence.21

Remainder arithmetic

4/2/08 2:20PM

5

slide-6
SLIDE 6

MIT OpenCourseWare http://ocw.mit.edu

6.042J / 18.062J Mathematics for Computer Science

Spring 2015 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.