CS2120 Discrete Math Sept 1 - cs.virginia.edu

Post on 04-Oct-2021

7 views 0 download

transcript

CS2120Discrete Math

Sept 1

Elizabeth Orrico

Sets - Sept 1

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

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 ?

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 ?

Sidebar: Set Cover Problem

Your turn!

???

Sidebar: Set Cover Problem

Your turn!

What are these??!

∈ :

⊆ :

⊇ :

⊂ :

⊃ :

What are these??!

∈ : element (member) of

⊆ :

⊇ :

⊂ :

⊃ :

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ :

⊂ :

⊃ :

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ :

⊃ :

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ : proper subset of

⊃ :

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ : proper subset of

⊃ : proper superset of

What are these??!

∈ : element (member) of

⊆ : subset of

⊇ : superset of

⊂ : proper subset of

⊃ : proper superset of

What do they evaluate to?

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)

⋃, ⋂, \

⋃ “union”

⋂ “intersect”

\ “difference”

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).

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).

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

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!

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

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).

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

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

what about T \ S ?

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

⋃ 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 ?

⋃, ⋂, \

⋃ “union”

⋂ “intersect”

\ “difference”

Cardinality

Useful Infinite Sets

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

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

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".

Reminder: Subset Definition

Set A is a subset of set B

A ⊆ B

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

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 }

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

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

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

Other Notations

?

?

?

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!

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}.

Cartesian Product of Sets

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

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

Cartesian Product of Sets

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

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

Cartesian Product of Sets

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

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

= 6

Cartesian Product of Sets

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

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

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

Set-Builder Notation

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

Set-Builder Notation

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

Set-Builder Notation

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”

Set-Builder Notation -- My turn!

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

Set-Builder Notation -- My turn!

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

Set-Builder Notation -- My turn!

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

Set-Builder Notation -- My turn!

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

Set-Builder Notation -- My turn!

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

Set-Builder Notation -- My turn!

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

Set-Builder Notation -- My turn!

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

Set-Builder Notation -- Your turn!

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

Set-Builder Notation -- Your turn!

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

Set-Builder Notation -- Your turn!

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

Set-Builder Notation -- Your turn!

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