Discrete Math You Need to Know

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
4
Counting
5
g
n
i
t
n
u
Co
Sequences
Arrangements
Subsets
Multi-subsets
6
s
e
c
n
e
u
q
e
S
Ordered, Repeating
K stacks of octocat stickers
Take N, stack them
7
n
a
r
r
A
s
t
n
e
m
e
g
Ordered, non-repeating
K individual octocat stickers
Take N, stack them
8
s
t
e
s
b
u
S
Non-ordered, non-repeating
K individual octocat stickers
Put N of them in a bag
9
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
a, b, and x:
gcd(a ,b)=gcd(b, a-bx)
)
x
h
s
i
g
g
i
)
(pick b
o
=
B
l
i
t
n
u
(recurse
17
s
’
d
i
l
c
u
m
h
E
t
i
r
o
g
l
A
Modular Edition!
gcd(a ,b)=gcd(b, a mod b)
(recurs
e until B
=o)
18
Modular Arithmetic
19
r
a
l
u
d
c
o
i
t
M
e
m
h
t
i
Ar
Clocks
Calendars
Charles Frederick Gauss
20
r
a
l
u
d
c
o
i
t
M
e
m
h
t
i
Ar
a≡b (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
a≡b (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
a≡b
and
c≡d (mod m)
a+c≡b+d (mod m)
23
r
a
n
l
o
u
i
d
t
o
a
c
M
i
l
p
i
t
l
u
M
if
a≡b
and
c≡d (mod m)
ac≡bd (mod m)
24
d
e
Se
g
n
i
t
n
a
Pl
1100111
7
103
1
25
d
e
Se
g
n
i
t
n
a
Pl
➜
1100111
7
103
1 * 7 = 7
2
1
26
d
e
Se
g
n
i
t
n
a
Pl
➜
1100111
7
103
7 * 7 = 343
2
7
27
d
e
Se
g
n
i
t
n
a
Pl
➜
1100111
7
103
343 = 117649
2
343
28
d
e
Se
g
n
i
t
n
a
Pl
➜
1100111
7
103
117649
2
= 13841287201
117649
29
d
e
Se
g
n
i
t
n
a
Pl
➜
1100111
7
103
13841287201
2
*7= 1341068619663964900807
13841287201
30
d
e
Se
g
n
i
t
n
a
Pl
➜
1100111
7
103
1341068619663964900807
2
*7= 12589255298531885026341962383987545444758743
1341068619663964900807
31
d
e
Se
g
n
i
t
n
a
Pl
➜
1100111
7
103
12589255298531885026341962383987545444758743
2
*7= 1109425442801291991031214184801374366124020697224286512520326098667350170655466324580343
12589255298531885026341962383987545444758743
32
d
e
Se
g
n
i
t
n
a
Pl
7
103
11094254428012919910312141848013
74366124020697224286512520326
098667350170655466324580343
33
d
e
Se
g
n
i
t
n
a
Pl
1100111
7
103
mod 53
1
34
d
e
Se
g
n
i
t
n
a
Pl
mod 53
➜
1100111
7
103
1 *7 mod 53= 7
2
1
35
d
e
Se
g
n
i
t
n
a
Pl
mod 53
➜
1100111
7
103
7 *7 mod 53= 25
2
7
36
d
e
Se
g
n
i
t
n
a
Pl
mod 53
➜
1100111
7
103
25 mod 53= 42
2
25
37
d
e
Se
g
n
i
t
n
a
Pl
mod 53
➜
1100111
7
103
42 mod 53= 15
2
42
38
d
e
Se
g
n
i
t
n
a
Pl
mod 53
➜
1100111
7
103
15 *7 mod 53= 38
2
15
39
d
e
Se
g
n
i
t
n
a
Pl
mod 53
➜
1100111
7
103
38 *7 mod 53= 38
2
38
40
d
e
Se
g
n
i
t
n
a
Pl
mod 53
➜
1100111
7
103
38 *7 mod 53= 38
2
38
41
d
e
Se
g
n
i
t
n
a
Pl
38
7
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 Euler’s totient ø(n)
•Happily, ø(n) = (p-1)(q-1)
45
A
S
R
•Find d such that (d, ø(n))=1
•Employ that Extended Euclidean
Algorithm!
ax+by=1
46
A
S
R
•Find d such that (d, ø(n))=1
•Employ that Extended Euclidean
Algorithm!
dx+by=1
47
A
S
R
•Find d such that (d, ø(n))=1
•Employ that Extended Euclidean
Algorithm!
dx+ø(n)y=1
48
A
S
R
•Find d such that (d, ø(n))=1
•Employ that Extended Euclidean
Algorithm!
de+ø(n)y=1
49
A
S
R
•Find d such that (d, ø(n))=1
•Employ that Extended Euclidean
Algorithm!
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
C = M mod N
e
M = C mod N
d
52
53
Thank
You!
@tlberglund
54