Foundations of Computing II Lecture 1: Welcome & Introduction - - PowerPoint PPT Presentation

foundations of computing ii
SMART_READER_LITE
LIVE PREVIEW

Foundations of Computing II Lecture 1: Welcome & Introduction - - PowerPoint PPT Presentation

CSE 312 Foundations of Computing II Lecture 1: Welcome & Introduction Stefano Tessaro tessaro@cs.washington.edu 1 Foundations of Computing II = Introduction to Probability & Statistics for computer scientists What is probability??


slide-1
SLIDE 1

CSE 312

Foundations of Computing II

Lecture 1: Welcome & Introduction

Stefano Tessaro

tessaro@cs.washington.edu

1

slide-2
SLIDE 2

2

Foundations of Computing II = Introduction to Probability & Statistics

for computer scientists

What is probability?? Why probability?!

slide-3
SLIDE 3

3

Probability

Big data Data compression Congestion control Cryptography Load Balancing Machine Learning Data Structures Natural Language Processing Algorithms Computational Biology Fault-tolerant systems Complexity theory Error-correcting codes + much more!

slide-4
SLIDE 4

CSE 312 team

4 Kushal Jhunjhunwalla Leonid Baraznenok barazl@cs kushaljh@cs Duowen (Justin) Chen chendw98@cs Tina Kelly Li 3nakli@cs Zhanhao Zhang zhangz73@cs Su Ye yes23@cs Siva N. Ramamoorthy sivanr@cs Stefano Tessaro tessaro@cs

Cryptographer, Associate Professor @ Allen School since Jan 2019.

slide-5
SLIDE 5

Most important info https://courses.cs.washington.edu/courses/cse312/19au/

5

tl;dr:

  • Weekly Homework, starting next week, Wed – Wed schedule. Submissions via

Gradescope only, individual submissions.

  • Weekly Quiz Sessions, starting tomorrow. Short review + in-class assignment,

posted one day in advance. Do attend them.

  • Office hours on M/T/W.
  • Midterm on Friday 11/1.
  • Grade (approx.): 50% HW, 15% midterm, 35% final
  • Panopto is activated – not a replacement for class attendance!
slide-6
SLIDE 6

Class materials + textbook Mandatory textbook: Dimitri P. Bertsekas and John N. Tsitsiklis, Introduction to Probability, First Edition, Athena Scientific, 2000. [Available for free!] Optional: Kenneth H. Rosen, Discrete Mathematics and Its Applications, McGraw-Hill, 2012. I will use slides. These will be available online.

6

slide-7
SLIDE 7

Review: Sets and Sequences

7

slide-8
SLIDE 8

Sets “Definition.” A set is a collection of (distinct) elements from a universe Ω.

8

Notation:

  • " ∈ $: " belongs to / is an element of $
  • " ∉ $: " does not belong to / is not an element of $
  • |$|: size / cardinality of $

Order irrelevant: 1,2,3 = 3,1,2 = 3,2,1 = 1,3,2 = ⋯ No repe00ons: 1,2,2,3 = 1,2,3

slide-9
SLIDE 9

Subsets / set inclusion

9

  • .

Defini&on. - ⊆ . if ∀": " ∈ - ⇒ " ∈ .

Examples:

  • 1,2,3 ⊆ {1,2,3,5}
  • 1,2,3 ⊆ {1,2,3}
  • 1,2,3 ⊈ {1,2,4}

Defini&on. - ⊂ . if - ⊆ . ∧ - ≠ .

Examples:

  • 1,2,3 ⊂ {1,2,3,5}
  • 1,2,3 ⊄ {1,2,3}
  • 1,2,3 ⊄ {1,2,4}
slide-10
SLIDE 10

Common sets

10

  • Empty set: ∅
  • First = integers: [=] = {1,2, … , =}
  • Integers: ℤ = {… , −3, −2, −1,0,1,2,3, … }
  • Naturals: ℕ = {0,1,2,3, … }
  • Reals: ℝ (aka. points on the real line)
  • Ra&onals: ℚ =

G H ∈ ℝ I, J ∈ ℤ, J ≠ 0}

finite sets infinite sets countable uncountable

slide-11
SLIDE 11

Implicit descriptions

11

Often, sets are described implicitly.

What is this set?

$K = {I ∈ ℕ | 1 ≤ I ≤ 7}

$K = {1,2,3,4,5,6,7}

What is this set?

$O = I ∈ ℕ ∃Q ∈ ℕ: I = 2Q + 1}

$O = 1,3,5,7, … =the odd naturals

unambiguous ambiguous

slide-12
SLIDE 12

Set operations

12

  • ∪ . = " | " ∈ - ∨ " ∈ .
  • .
  • ∩ . = " | " ∈ - ∧ " ∈ .
  • .
  • ∖ . = " | " ∈ - ∧ " ∉ .
  • .

set union set intersection set difference

[Sometimes also: - − .]

slide-13
SLIDE 13

Set operations (cont’d)

13

  • W = " | " ∉ - = Ω ∖ -
  • set complement

universe Ω

Fact 1. -W W = -.

[Sometimes also: ̅

  • ]

Fact 2. - ∪ . W = -W ∩ .W. Fact 3. - ∩ . W = -W ∪ .W. “De Morgan’s Laws”

slide-14
SLIDE 14

Sequences

14

A (finite) sequence (or tuple) is an (ordered) list of elements.

  • Definition. The cartesian product of two sets $, Y is

$×Y = { I, J : I ∈ $, J ∈ Y}

Equivalent naming: 2-sequence = 2-tuple = ordered pair.

Order ma9ers: 1,2,3 ≠ 3,2,1 ≠ (1,3,2) Repe00ons ma9er: 1,2,3 ≠ 1,2,2,3 ≠ 1,1,2,3

slide-15
SLIDE 15

Cartesian product – cont’d

15

  • Definition. The cartesian product of two sets $, Y is

$×Y = { I, J : I ∈ $, J ∈ Y}

Example.

1,2,3 × ★, ♠ = { 1,★ , 2,★ , 3,★ , 1, ♠ , 2, ♠ , 3, ♠ }

slide-16
SLIDE 16

Cartesian product – even more notation $×Y×^ = { I, J, _ : I ∈ $, J ∈ Y, _ ∈ ^}

16

$×Y×^×` …

  • Notation. $a = $×$× ⋯×$

Q times

slide-17
SLIDE 17

Next – Counting (aka ”combinatorics”)

17

slide-18
SLIDE 18

We are interested in counting the number of objects with a certain given property. [Weeks 0-1]

18

“How many ways are there to assign 7 TAs to 5 sec3ons, such that each sec3on is assigned to two TAs, and no TA is assigned to more than two sec3ons?” “How many integer solutions ", b, c ∈ ℤd does the equation "d + bd = cd have?” Generally: Question boils down to computing cardinality |$| of some given (implicitly defined) set $.

slide-19
SLIDE 19

Example – Strings

How many string of length 5 over the alphabet -, ., e, … , f are there?

  • E.g., AZURE, BINGO, TANGO, STEVE, SARAH, …

19

Answer: 26g = 11881376

String =

  • .

26 op&ons

h f

  • .

f

  • .

f i

  • .

f j

  • .

f k

h

  • i

j k

26 options 26 op&ons 26 op&ons 26 op&ons

slide-20
SLIDE 20

Product rule – Generally

20

  • K×-O× ⋯×-l = -K × -O × ⋯×|-l|
slide-21
SLIDE 21

Example – Strings

How many string of length 5 over the alphabet -, ., e, … , f are there?

  • E.g., AZURE, BINGO, TANGO, STEVE, SARAH, …
  • , ., e, … , f g =
  • , ., e, … , f

g = 26g.

21

Product rule

slide-22
SLIDE 22

Example – Laptop customization Alice wants to buy a new laptop:

  • The laptop can be blue, orange, purple, or silver.
  • The SSD storage can be 128GB, 256GB, and 512GB
  • The available RAM can be 8GB or 16GB.
  • The laptop comes with a 13” or with a 15” screen.

How many different laptop configurations are there?

22

slide-23
SLIDE 23

Example – Laptop customization (cont’d)

23

e = {blue, orange, purple, silver} n = {128GB, 256GB, 512GB}

  • = {8GB, 16GB}

$ = {13”, 15”} Configuration = element of e×n×o×$

# configurations = e×n×o×$ = e × n × o × $ = 4×3×2×2 = 48.

Product rule

slide-24
SLIDE 24

Example – Power set

24

  • Definition. The power set of $ is

2r = {s | s ⊆ $} .

  • Proposition. |2r| = 2|r|.

Example. 2 ★,♠ = {∅, ★ , ♠ , {★, ♠}} 2∅ = {∅}

slide-25
SLIDE 25

Proof of proposition

25

subset s ⊆ $ sequence 1t ∈ 0,1 l

1t = ("K, … , "l) where "u = v1 if yu ∈ s if yu ∉ s

  • Proposition. |2r| = 2|r|.

Let $ = {yK, … , yl} (i.e., $ = = ≥ 1)

1-to-1 correspondence

Therefore: |2r| = | 0,1 l|= 0,1

l

Product rule

= 2l

(Case $ = ∅ needs to be handled separately)

slide-26
SLIDE 26

26

Sequential process: We fix elements in a sequence one by one, and see how many possibilities we have at each step. Example: “How many sequences are there in 1,2,3 d?” 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 2 2 3 3 3 3 3 3 3 3 3 "K "O "d

27 paths = 27 sequences

slide-27
SLIDE 27

27

Example: “How many sequences are there in 1,2,3 d with no repea3ng elements?” 1 2 3 1 1 1 1 2 2 2 3 3 2 3 3 "K "O "d

6 sequences

slide-28
SLIDE 28

Factorial

28

“How many sequences in = l with no repea3ng elements?”

Answer = =× = − 1 × = − 2 × ⋯×2×1

”Permutations”

  • Definition. The factorial function is

=! = =× = − 1 × ⋯×2×1 .

  • Theorem. (Stirling’s approximation)

2| ⋅ =l~K

O ⋅ Äl≤ =! ≤  ⋅ =l~K O⋅ Äl .

= 2.5066 = 2.7183