Top Banner
CS2120 Discrete Math Sept 1 Elizabeth Orrico
73

CS2120 Discrete Math Sept 1 - cs.virginia.edu

Oct 04, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS2120 Discrete Math Sept 1 - cs.virginia.edu

CS2120Discrete Math

Sept 1

Elizabeth Orrico

Page 2: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Sets - Sept 1

1.) Practice Problems 1-132 -- About Stars2.) Discord3.) ⋃, ⋂, \4.) Cardinality5.) Power sets6.) Cartesian Product7.) Set-builder notation

Page 3: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Sidebar: Set Cover Problem

A very famous and useful problem in combinatorics and CS! One of the original problems to be proven NP-Complete.

One Example: Given a “universe” U (big set with everything else in the problem inside) and a set of sets, S

U = {1, 2, 3, 4, 5}

S = { {1, 2, 3}, {2, 5, 1}, {3, 4, 1} ,{3, 4, 5} }

What is the minimum number of sets in S needed to cover everything in U ?

Page 4: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Sidebar: Set Cover Problem

A very famous and useful problem in combinatorics and CS! One of the original problems to be proven NP-Complete.

One Example: Given a “universe” U (big set with everything else in the problem inside) and a set of sets, S

U = {1, 2, 3, 4, 5}

S = { {1, 2, 3}, {2, 5, 1}, {3, 4, 1} ,{3, 4, 5} }

What is the minimum number of sets in S needed to cover everything in U ?

Page 5: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Sidebar: Set Cover Problem

Your turn!

???

Page 6: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Sidebar: Set Cover Problem

Your turn!

Page 7: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ :

⊆ :

⊇ :

⊂ :

⊃ :

Page 8: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ : element (member) of

⊆ :

⊇ :

⊂ :

⊃ :

Page 9: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ :

⊂ :

⊃ :

Page 10: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ :

⊃ :

Page 11: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ : proper subset of

⊃ :

Page 12: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ : proper subset of

⊃ : proper superset of

Page 13: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ : proper subset of

⊃ : proper superset of

What do they evaluate to?

Page 14: CS2120 Discrete Math Sept 1 - cs.virginia.edu

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ : proper subset of

⊃ : proper superset of

What do they evaluate to? True or False (booleans)

Page 15: CS2120 Discrete Math Sept 1 - cs.virginia.edu

⋃, ⋂, \

⋃ “union”

⋂ “intersect”

\ “difference”

Page 16: CS2120 Discrete Math Sept 1 - cs.virginia.edu

In mathematics, the intersection of two sets S and T, denoted by S ∩ T, is the set containing all elements of S that also belong to T (or equivalently, all elements of T that also belong to S).

Page 17: CS2120 Discrete Math Sept 1 - cs.virginia.edu

In mathematics, the intersection of two sets S and T, denoted by S ∩ T, is the set containing all elements of S that also belong to T (or equivalently, all elements of T that also belong to S).

Page 18: CS2120 Discrete Math Sept 1 - cs.virginia.edu

In mathematics, the intersection of two sets S and T, denoted by S ∩ T, is the set containing all elements of S that also belong to T (or equivalently, all elements of T that also belong to S).

S ∩ T = 3, 1, -8

Page 19: CS2120 Discrete Math Sept 1 - cs.virginia.edu

In mathematics, the intersection of two sets S and T, denoted by S ∩ T, is the set containing all elements of S that also belong to T (or equivalently, all elements of T that also belong to S).

S ∩ T = 3, 1, -8

not quite!

Page 20: CS2120 Discrete Math Sept 1 - cs.virginia.edu

In mathematics, the intersection of two sets S and T, denoted by S ∩ T, is the set containing all elements of S that also belong to T (or equivalently, all elements of T that also belong to S).

S ∩ T = {3, 1, -8}

evaluates to a set

Page 21: CS2120 Discrete Math Sept 1 - cs.virginia.edu

S ∩ T = {3, 1, -8}

evaluates to a set

In mathematics, the intersection of two sets S and T, denoted by S ∩ T, is the set containing all elements of S that also belong to T (or equivalently, all elements of T that also belong to S).

Page 22: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 23: CS2120 Discrete Math Sept 1 - cs.virginia.edu

S \ T = {7, 11, -5, 9}

Page 24: CS2120 Discrete Math Sept 1 - cs.virginia.edu

S \ T = {7, 11, -5, 9}

what about T \ S ?

Page 25: CS2120 Discrete Math Sept 1 - cs.virginia.edu

⋃ Union: A set that contains all the elements of both S and T.

Page 26: CS2120 Discrete Math Sept 1 - cs.virginia.edu

⋃ Union: A set that contains all the elements of both S and T.

S ⋃ T = {7, 11, -5, 9, 3, -8, 1, -7, 10, 0, -2, 6}

what about T ⋃ S ?

Page 27: CS2120 Discrete Math Sept 1 - cs.virginia.edu

⋃, ⋂, \

⋃ “union”

⋂ “intersect”

\ “difference”

Page 28: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Cardinality

Page 29: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Useful Infinite Sets

Page 30: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 31: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Select from the choices given here

A: {0,1,2,3....} B: {....-3, -2, -1} C: {1,2,3....} D: {....-3, -2, -1, 0} E: None of the Above

Page 32: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Select from the choices given here

A: {0,1,2,3....} B: {....-3, -2, -1} C: {1,2,3....} D: {....-3, -2, -1, 0} E: None of the Above

Page 33: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Georg Ferdinand Ludwig Philipp Cantor ... was a German mathematician. He created set theory, which has become a fundamental theory in mathematics. Cantor ] defined infinite and well-ordered sets, and proved that the real numbers are more numerous than the natural numbers. In fact, Cantor's method of proof of this theorem implies the existence of an infinity of infinities.

Cantor's work is of great philosophical interest, a fact he was well aware of. Cantor's theory of transfinite numbers was originally regarded as so counter-intuitive – even shocking – that it encountered resistance from mathematical contemporaries such as Leopold Kronecker and Henri Poincaré[3] and later from Hermann Weyl and L. E. J. Brouwer, while Ludwig Wittgenstein raised philosophical objections. Cantor, a devout Lutheran, believed the theory had been communicated to him by God.

The objections to Cantor's work were occasionally fierce: Leopold Kronecker's public opposition and personal attacks included describing Cantor as a "scientific charlatan", a "renegade" and a "corrupter of youth".

Page 34: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Reminder: Subset Definition

Set A is a subset of set B

A ⊆ B

If & only if all elements of A are also in B

Page 35: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 36: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Power sets -- Turn n’ Talk

1.) What is the power set of {}?

2.) What is the power set of {a, b, c}

3.) What is the power set of { W, X, Y, Z }

Page 37: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Can we see a rule/pattern to determine the cardinality of a powerset?

https://colab.research.google.com/drive/1DMVe35jOr_CTx88glXOkUnaFKaqCDeQo?usp=sharing

Page 38: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Can we see a rule/pattern to determine the cardinality of a powerset?

Page 39: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Other Notations

Page 40: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 41: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 42: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 43: CS2120 Discrete Math Sept 1 - cs.virginia.edu

?

Page 44: CS2120 Discrete Math Sept 1 - cs.virginia.edu

?

Page 45: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 46: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 47: CS2120 Discrete Math Sept 1 - cs.virginia.edu

?

Page 48: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 49: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 50: CS2120 Discrete Math Sept 1 - cs.virginia.edu

High Level: Sets vs SequencesBoth can:-Contain anything-Can have a sequence of sequences, set of sets, sequence of sets, etc-Cannot be modified

Sets:-no duplicates-no order-has cardinality

Sequences:-can have duplicates-has order-has length

Lists, Arrays, Ordered pairs, Tuples, etc!

Page 51: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Cartesian Product of Sets

Ordered Pair: An ordered pair is a sequence with 2 elements. It is a pair of objects where one element is designated first and the other element is designated second, denoted (a, b).

Cartesian Product: The Cartesian product of two sets A and B, denoted A × B, is the set of all possible ordered pairs where the elements of A are first and the elements of B are second.

In set-builder notation, A × B = {(a, b) | a ∈ A and b ∈ B}.

Page 52: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Cartesian Product of Sets

{1, 2} × {3, 4, 5}

= {(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)}

Page 53: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Cartesian Product of Sets

|{1, 2} × {3, 4, 5}|

= |{(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)}|

Page 54: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Cartesian Product of Sets

|{1, 2} × {3, 4, 5}|

= |{(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)}|

= 6

Page 55: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Cartesian Product of Sets

Your Turn: What is {1, 2}× {2, 3}?

Page 56: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation

- {x | x is blue}- { 2x | x elem of integer} = three elem in, three elem out- { 2x | (x elem of integer) AND (x is odd)} = three elem in, three

elem out- { child/spouse/co-star of (x person) |- 6 degrees of Kevin Bacon- Propositions

Page 58: CS2120 Discrete Math Sept 1 - cs.virginia.edu
Page 59: CS2120 Discrete Math Sept 1 - cs.virginia.edu

https://ltcconline.net/greenl/courses/152a/definitions/SETS.HTM

Set-Builder Notation

Page 60: CS2120 Discrete Math Sept 1 - cs.virginia.edu

https://ltcconline.net/greenl/courses/152a/definitions/SETS.HTM

Set-Builder Notation

Page 61: CS2120 Discrete Math Sept 1 - cs.virginia.edu

https://www.mathsisfun.com/sets/set-builder-notation.html

Set-Builder Notation

Page 62: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation

Let’s formalize our set operators in “set-builder notation”

Quick Side-Note:-We will need to link together multiple “conditions” with “and’s”,

“not’s” and “or’s”

Special symbols:

∨ is “or” (notice similarity to ⋃) ∧ is “and” (notice similarity to ⋂)

¬ is “not”

Page 63: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- My turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 64: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- My turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 65: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- My turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 66: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- My turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 67: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- My turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 68: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- My turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 69: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- My turn!

For Reference:∨ is “or” (notice similarity to ⋃)∧ is “and” (notice similarity to ⋂)¬ is “not”

Page 70: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- Your turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 71: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- Your turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 72: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- Your turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”

Page 73: CS2120 Discrete Math Sept 1 - cs.virginia.edu

Set-Builder Notation -- Your turn!

For Reference:∨ is “or” ∧ is “and” ¬ is “not”