You are on page 1of 54

Discrete Math

you need to know @tlberglund


1

Discrete Math ?
2

Discrete Math
Math with Integers Number theory Modular Arithmetic Graphs...another time
3

Acknowledgements
http://bit.ly/discrete-math-course http://www.math.hmc.edu/~benjamin/ http://bit.ly/ted-mathemagic

Counting

g n i t n u Co

Arrangements Multi-subsets
6

Sequences Subsets

s e c n e u q e S Ordered, Repeating

K stacks of octocat stickers

Take N, stack them

n a r r A

s t n e m e g

K individual octocat stickers

Ordered, non-repeating

Take N, stack them

s t e s b u S Non-ordered, non-repeating
K individual octocat stickers Put N of them in a bag

s t e s b u s i t l u M Non-ordered, repeating
K stacks of octocat stickers Put N of them in a bag

10

Number Theory

11

n o i s i v i D m e r o e h T

a = dq + r
12

s i v Di

y t i l i ib

a = dq + r

13

s i v Di

y t i l i ib

a = dq

d|a
14

s i v Di

y t i l i ib

Greatest Common Divisors

(x ,y) gcd(x,y)

15

s t u o z B y t i t n e d I (a ,b)=g

ax+by=g
16

s d i l c u m h E t i r o g l A For

) x h s i g g i ) (pick b o = B l i t n u (recurse

gcd(a ,b)=gcd(b, a-bx)

a, b, and x:

17

s d i l c u m h E t i r o g l A
(recurs

Modular Edition!

gcd(a ,b)=gcd(b, a mod b)


e until B =o)
18

Modular Arithmetic

19

r a l u d c o i t M e m h t i Ar

Charles Frederick Gauss

Calendars

Clocks

20

r a l u d c o i t M e m h t i Ar ab (mod m)

if m|(a-b) for m>0


21

r a l u d c o i t M e m h t i Ar ab (mod m)

if a mod m = B mod m
22

r a l u d o M n o i t i d d A
if

ab

and

a+cb+d (mod m)
23

cd (mod m)

r a n l o u i d t o a c M i l p i t l u M
if

ab

and

acbd (mod m)

cd (mod m)

24

d e Se g n i t n a Pl

1100111

103

1
25

d e Se g n i t n a Pl

1100111
1 * 7 = 7

103

1
26

d e Se g n i t n a Pl

1100111
7 * 7 = 343

103

7
27

d e Se g n i t n a Pl
2

343 = 117649 343


28

1100111

103

d e Se g n i t n a Pl
117649 117649
2

= 13841287201

1100111

103

29

d e Se g n i t n a Pl
13841287201
2

*7= 1341068619663964900807

13841287201
30

1100111

103

d e Se g n i t n a Pl
1341068619663964900807
2

*7= 12589255298531885026341962383987545444758743

1341068619663964900807
31

1100111

103

d e Se g n i t n a Pl
12589255298531885026341962383987545444758743
2

*7= 1109425442801291991031214184801374366124020697224286512520326098667350170655466324580343

12589255298531885026341962383987545444758743

1100111

103

32

d e Se g n i t n a Pl

103

11094254428012919910312141848013 74366124020697224286512520326 098667350170655466324580343


33

d e Se g n i t n a Pl

1100111

103

mod 53

1
34

d e Se g n i t n a Pl
2

1 *7 mod 53= 7 1
35

1100111

103

mod 53

d e Se g n i t n a Pl
2

7 *7 mod 53= 25 7
36

1100111

103

mod 53

d e Se g n i t n a Pl
2

25 mod 53= 42 25
37

1100111

103

mod 53

d e Se g n i t n a Pl
2

42 mod 53= 15 42
38

1100111

103

mod 53

d e Se g n i t n a Pl
2

15 *7 mod 53= 38 15
39

1100111

103

mod 53

d e Se g n i t n a Pl
2

38 *7 mod 53= 38 38
40

1100111

103

mod 53

d e Se g n i t n a Pl
2

38 *7 mod 53= 38 38
41

1100111

103

mod 53

d e Se g n i t n a Pl

38

103

mod 53

42

A S R
Private Key Public Key
43

A S R

Private Key
Decr ypt with this

t p y r c n E is h t h t i w

Public Key
44

A S R

Pick two big primes p and q Let n = pq Compute Eulers totient (n) Happily, (n) = (p-1)(q-1)

45

A S R

Find d such that (d, (n))=1


Algorithm!

Employ that Extended Euclidean

ax+by=1
46

A S R

Find d such that (d, (n))=1


Algorithm!

Employ that Extended Euclidean

dx+by=1
47

A S R

Find d such that (d, (n))=1


Algorithm!

Employ that Extended Euclidean

dx+(n)y=1
48

A S R

Find d such that (d, (n))=1


Algorithm!

Employ that Extended Euclidean

de+(n)y=1
49

A S R

Find d such that (d, (n))=1


Algorithm!

Employ that Extended Euclidean

de+(n)f=1
50

A S R
Distribute (e , n) on tee-shirts Keep (d , n) secret

51

A S R

Sending message M

M = C mod N
d

C = M mod N
e

52

53

Thank You!

@tlberglund
54

You might also like