powerpoint presentationarielpro/15251/lectures/lecture05.pdf · bit representation • 221

22
CMU 15-251 Counting II Teachers: Victor Adamchik Ariel Procaccia (this time)

Upload: others

Post on 22-Sep-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

CMU 15-251

Counting II

Teachers:

Victor Adamchik

Ariel Procaccia (this time)

Page 2: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Shortest paths

2

1. 3003

2. 4052

3. 5027

4. 6348

Page 3: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Bit representation

o

o

o

o

3

Page 4: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Bit representation

• 525= 2,598,960

⌈log(2,598,960)⌉ = 22

4

0000000000000000000000

0000000000000000000001

0000000000000000000010

0000000000000000000011

Page 5: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Bit representation

• 221 < 525

5

⌈log 𝑛⌉

Page 6: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Polynomials as choice trees

1 + 𝑥 3

1 + 3𝑥 +3𝑥2 + 𝑥3

6

𝑥3 𝑥2 𝑥2 𝑥 𝑥2 𝑥 𝑥 1

1 𝑥

1 𝑥 1 𝑥

1 𝑥 1 𝑥 1 𝑥 1 𝑥

Page 7: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

The binomial formula

• 1 + 𝑥 𝑛 = 𝑐𝑜 + 𝑐1𝑥 +⋯+ 𝑐𝑛𝑥𝑛

• 𝑐𝑘𝑘 𝑥 𝑐𝑘 =

𝑛𝑘

7

1 + 𝑥 𝑛 = 𝑛

𝑘𝑥𝑘

𝑛

𝑘=0

Page 8: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

The binomial formula

8

1 + 𝑥 0 = 1

1 + 𝑥 1 = 1 + 1𝑥

1 + 𝑥 2 = 1 + 2𝑥 + 1𝑥2

1 + 𝑥 3 = 1 + 3𝑥 + 3𝑥2 + 1𝑥3

Page 9: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

The binomial formula

• 𝑥 = 1:

2𝑛 = 𝑛

𝑘

𝑛

𝑘=0

𝑛 2𝑛

9

1 + 𝑥 𝑛 = 𝑛

𝑘𝑥𝑘

𝑛

𝑘=0

Page 10: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

The binomial formula

• 𝑥 = −1:

0 = 𝑛

𝑘

𝑛

𝑘=0

−1 𝑘 ⇒ 𝑛

𝑘=

𝑛

𝑘𝑘 𝑘

10

1 + 𝑥 𝑛 = 𝑛

𝑘𝑥𝑘

𝑛

𝑘=0

Page 11: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

A combinatorial proof

• 𝑂𝑛 𝐸𝑛𝑛

𝑂𝑛 = |𝐸𝑛|

11

Page 12: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

A combinatorial proof

𝑓𝑛: 𝐸𝑛 → 𝑂𝑛 𝑛 ≥ 3?

12

Page 13: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

13

Page 14: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

14

0

0

1

0

1

1

2

0

2

1

2

2

3

0

3

1

3

2

3

3

Page 15: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

15

Page 16: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

16

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

1 6 6 1 15 15 20

𝑛𝑘

0

1

2

3

4

5

6

0

1

2

3

4

5

6

Page 17: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

17

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

1 6 6 1 15 15 20

𝑛𝑘= 𝑛−1𝑘−1+ 𝑛−1𝑘

𝑛 = 4, 𝑘 = 2

0

1

2

3

4

5

6

0

1

2

3

4

5

6

Page 18: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

18

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

1 6 6 1 15 15 20

0

1

2

3

4

5

6

0

1

2

3

4

5

6

𝑛𝑘= 2𝑛−1𝑘 𝑜𝑑𝑑 𝑛 = 4

Page 19: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

19

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

1 6 6 1 15 15 20

𝑛𝑘

2𝑛𝑘=0 = 2𝑛

𝑛𝑛 = 3

𝑛, 𝑘

0

1

2

3

4

5

6

0

1

2

3

4

5

6

Page 20: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

Pascal’s triangle

• 𝑖𝑘

𝑛𝑖=𝑘 =?

1.𝑛+1𝑘

2.𝑛𝑘+1

3.𝑛+1𝑘+1

4.2𝑛𝑘

20

1

1 1

1 2 1

1 3 3 3

1 4 6 4 1

1 5 10 10 5 1

1 6 6 1 15 15 20

0

1

2

3

4

5

6

0

1

2

3

4

5

6

𝑘 = 2, 𝑛 = 5

Page 21: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

proofs from the book

21

Page 22: PowerPoint Presentationarielpro/15251/Lectures/lecture05.pdf · Bit representation • 221

What we have learned

o

o

o

o

22