discrete mathematics - predicates and sets

131
Discrete Mathematics Predicates and Sets H. Turgut Uyar Ay¸ seg¨ ul Gen¸ cata Yayımlı Emre Harmancı 2001-2013

Upload: turgut-uyar

Post on 05-Dec-2014

10.182 views

Category:

Education


2 download

DESCRIPTION

Predicates, quantifiers. Sets, subsets, power sets, set operations, laws of set theory, principle of inclusion-exclusion.

TRANSCRIPT

Page 1: Discrete Mathematics - Predicates and Sets

Discrete MathematicsPredicates and Sets

H. Turgut Uyar Aysegul Gencata Yayımlı Emre Harmancı

2001-2013

Page 2: Discrete Mathematics - Predicates and Sets

License

c©2001-2013 T. Uyar, A. Yayımlı, E. Harmancı

You are free:

to Share – to copy, distribute and transmit the work

to Remix – to adapt the work

Under the following conditions:

Attribution – You must attribute the work in the manner specified by the author or licensor (but not in anyway that suggests that they endorse you or your use of the work).

Noncommercial – You may not use this work for commercial purposes.

Share Alike – If you alter, transform, or build upon this work, you may distribute the resulting work onlyunder the same or similar license to this one.

Legal code (the full license):http://creativecommons.org/licenses/by-nc-sa/3.0/

Page 3: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 4: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 5: Discrete Mathematics - Predicates and Sets

Predicate

Definition

predicate (or open statement): a declarative sentence which

contains one or more variables, and

is not a proposition, but

becomes a proposition when the variables in itare replaced by certain allowable choices

Page 6: Discrete Mathematics - Predicates and Sets

Universe of Discourse

Definition

universe of discourse: Uset of allowable choices

examples:

Z: integersN: natural numbersZ+: positive integersQ: rational numbersR: real numbersC: complex numbers

Page 7: Discrete Mathematics - Predicates and Sets

Universe of Discourse

Definition

universe of discourse: Uset of allowable choices

examples:

Z: integersN: natural numbersZ+: positive integersQ: rational numbersR: real numbersC: complex numbers

Page 8: Discrete Mathematics - Predicates and Sets

Predicate Examples

Example

U = Np(x): x + 2 is an even integer

p(5): Fp(8): T

¬p(x): x + 2 is not an even integer

Example

U = Nq(x , y): x + y and x − 2y are even integers

q(11, 3): F , q(14, 4): T

Page 9: Discrete Mathematics - Predicates and Sets

Predicate Examples

Example

U = Np(x): x + 2 is an even integer

p(5): Fp(8): T

¬p(x): x + 2 is not an even integer

Example

U = Nq(x , y): x + y and x − 2y are even integers

q(11, 3): F , q(14, 4): T

Page 10: Discrete Mathematics - Predicates and Sets

Predicate Examples

Example

U = Np(x): x + 2 is an even integer

p(5): Fp(8): T

¬p(x): x + 2 is not an even integer

Example

U = Nq(x , y): x + y and x − 2y are even integers

q(11, 3): F , q(14, 4): T

Page 11: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 12: Discrete Mathematics - Predicates and Sets

Quantifiers

Definition

existential quantifier:predicate is true for some values

symbol: ∃read: there exists

symbol: ∃!read: there exists only one

Definition

universal quantifier:predicate is true for all values

symbol: ∀read: for all

Page 13: Discrete Mathematics - Predicates and Sets

Quantifiers

Definition

existential quantifier:predicate is true for some values

symbol: ∃read: there exists

symbol: ∃!read: there exists only one

Definition

universal quantifier:predicate is true for all values

symbol: ∀read: for all

Page 14: Discrete Mathematics - Predicates and Sets

Quantifiers

Definition

existential quantifier:predicate is true for some values

symbol: ∃read: there exists

symbol: ∃!read: there exists only one

Definition

universal quantifier:predicate is true for all values

symbol: ∀read: for all

Page 15: Discrete Mathematics - Predicates and Sets

Quantifiers

existential quantifier

U = {x1, x2, . . . , xn}∃x p(x) ≡ p(x1) ∨ p(x2) ∨ · · · ∨ p(xn)

p(x) is true for some x

universal quantifier

U = {x1, x2, . . . , xn}∀x p(x) ≡ p(x1) ∧ p(x2) ∧ · · · ∧ p(xn)

p(x) is true for all x

Page 16: Discrete Mathematics - Predicates and Sets

Quantifiers

existential quantifier

U = {x1, x2, . . . , xn}∃x p(x) ≡ p(x1) ∨ p(x2) ∨ · · · ∨ p(xn)

p(x) is true for some x

universal quantifier

U = {x1, x2, . . . , xn}∀x p(x) ≡ p(x1) ∧ p(x2) ∧ · · · ∧ p(xn)

p(x) is true for all x

Page 17: Discrete Mathematics - Predicates and Sets

Quantifier Examples

Example

U = R

p(x) : x ≥ 0

q(x) : x2 ≥ 0

r(x) : (x − 4)(x + 1) = 0

s(x) : x2 − 3 > 0

are the following expressions true?

∃x [p(x) ∧ r(x)]

∀x [p(x) → q(x)]

∀x [q(x) → s(x)]

∀x [r(x) ∨ s(x)]

∀x [r(x) → p(x)]

Page 18: Discrete Mathematics - Predicates and Sets

Quantifier Examples

Example

U = R

p(x) : x ≥ 0

q(x) : x2 ≥ 0

r(x) : (x − 4)(x + 1) = 0

s(x) : x2 − 3 > 0

are the following expressions true?

∃x [p(x) ∧ r(x)]

∀x [p(x) → q(x)]

∀x [q(x) → s(x)]

∀x [r(x) ∨ s(x)]

∀x [r(x) → p(x)]

Page 19: Discrete Mathematics - Predicates and Sets

Quantifier Examples

Example

U = R

p(x) : x ≥ 0

q(x) : x2 ≥ 0

r(x) : (x − 4)(x + 1) = 0

s(x) : x2 − 3 > 0

are the following expressions true?

∃x [p(x) ∧ r(x)]

∀x [p(x) → q(x)]

∀x [q(x) → s(x)]

∀x [r(x) ∨ s(x)]

∀x [r(x) → p(x)]

Page 20: Discrete Mathematics - Predicates and Sets

Quantifier Examples

Example

U = R

p(x) : x ≥ 0

q(x) : x2 ≥ 0

r(x) : (x − 4)(x + 1) = 0

s(x) : x2 − 3 > 0

are the following expressions true?

∃x [p(x) ∧ r(x)]

∀x [p(x) → q(x)]

∀x [q(x) → s(x)]

∀x [r(x) ∨ s(x)]

∀x [r(x) → p(x)]

Page 21: Discrete Mathematics - Predicates and Sets

Quantifier Examples

Example

U = R

p(x) : x ≥ 0

q(x) : x2 ≥ 0

r(x) : (x − 4)(x + 1) = 0

s(x) : x2 − 3 > 0

are the following expressions true?

∃x [p(x) ∧ r(x)]

∀x [p(x) → q(x)]

∀x [q(x) → s(x)]

∀x [r(x) ∨ s(x)]

∀x [r(x) → p(x)]

Page 22: Discrete Mathematics - Predicates and Sets

Quantifier Examples

Example

U = R

p(x) : x ≥ 0

q(x) : x2 ≥ 0

r(x) : (x − 4)(x + 1) = 0

s(x) : x2 − 3 > 0

are the following expressions true?

∃x [p(x) ∧ r(x)]

∀x [p(x) → q(x)]

∀x [q(x) → s(x)]

∀x [r(x) ∨ s(x)]

∀x [r(x) → p(x)]

Page 23: Discrete Mathematics - Predicates and Sets

Negating Quantifiers

replace ∀ with ∃, and ∃ with ∀negate the predicate

¬∃x p(x) ⇔ ∀x ¬p(x)

¬∃x ¬p(x) ⇔ ∀x p(x)

¬∀x p(x) ⇔ ∃x ¬p(x)

¬∀x ¬p(x) ⇔ ∃x p(x)

Page 24: Discrete Mathematics - Predicates and Sets

Negating Quantifiers

replace ∀ with ∃, and ∃ with ∀negate the predicate

¬∃x p(x) ⇔ ∀x ¬p(x)

¬∃x ¬p(x) ⇔ ∀x p(x)

¬∀x p(x) ⇔ ∃x ¬p(x)

¬∀x ¬p(x) ⇔ ∃x p(x)

Page 25: Discrete Mathematics - Predicates and Sets

Negating Quantifiers

Theorem

¬∃x p(x) ⇔ ∀x ¬p(x)

Proof.

¬∃x p(x) ≡ ¬[p(x1) ∨ p(x2) ∨ · · · ∨ p(xn)]

⇔ ¬p(x1) ∧ ¬p(x2) ∧ · · · ∧ ¬p(xn)

≡ ∀x ¬p(x)

Page 26: Discrete Mathematics - Predicates and Sets

Negating Quantifiers

Theorem

¬∃x p(x) ⇔ ∀x ¬p(x)

Proof.

¬∃x p(x) ≡ ¬[p(x1) ∨ p(x2) ∨ · · · ∨ p(xn)]

⇔ ¬p(x1) ∧ ¬p(x2) ∧ · · · ∧ ¬p(xn)

≡ ∀x ¬p(x)

Page 27: Discrete Mathematics - Predicates and Sets

Negating Quantifiers

Theorem

¬∃x p(x) ⇔ ∀x ¬p(x)

Proof.

¬∃x p(x) ≡ ¬[p(x1) ∨ p(x2) ∨ · · · ∨ p(xn)]

⇔ ¬p(x1) ∧ ¬p(x2) ∧ · · · ∧ ¬p(xn)

≡ ∀x ¬p(x)

Page 28: Discrete Mathematics - Predicates and Sets

Negating Quantifiers

Theorem

¬∃x p(x) ⇔ ∀x ¬p(x)

Proof.

¬∃x p(x) ≡ ¬[p(x1) ∨ p(x2) ∨ · · · ∨ p(xn)]

⇔ ¬p(x1) ∧ ¬p(x2) ∧ · · · ∧ ¬p(xn)

≡ ∀x ¬p(x)

Page 29: Discrete Mathematics - Predicates and Sets

Predicate Equivalences

Theorem

∃x [p(x) ∨ q(x)] ⇔ ∃x p(x) ∨ ∃x q(x)

Theorem

∀x [p(x) ∧ q(x)] ⇔ ∀x p(x) ∧ ∀x q(x)

Page 30: Discrete Mathematics - Predicates and Sets

Predicate Equivalences

Theorem

∃x [p(x) ∨ q(x)] ⇔ ∃x p(x) ∨ ∃x q(x)

Theorem

∀x [p(x) ∧ q(x)] ⇔ ∀x p(x) ∧ ∀x q(x)

Page 31: Discrete Mathematics - Predicates and Sets

Predicate Implications

Theorem

∀x p(x) ⇒ ∃x p(x)

Theorem

∃x [p(x) ∧ q(x)] ⇒ ∃x p(x) ∧ ∃x q(x)

Theorem

∀x p(x) ∨ ∀x q(x) ⇒ ∀x [p(x) ∨ q(x)]

Page 32: Discrete Mathematics - Predicates and Sets

Predicate Implications

Theorem

∀x p(x) ⇒ ∃x p(x)

Theorem

∃x [p(x) ∧ q(x)] ⇒ ∃x p(x) ∧ ∃x q(x)

Theorem

∀x p(x) ∨ ∀x q(x) ⇒ ∀x [p(x) ∨ q(x)]

Page 33: Discrete Mathematics - Predicates and Sets

Predicate Implications

Theorem

∀x p(x) ⇒ ∃x p(x)

Theorem

∃x [p(x) ∧ q(x)] ⇒ ∃x p(x) ∧ ∃x q(x)

Theorem

∀x p(x) ∨ ∀x q(x) ⇒ ∀x [p(x) ∨ q(x)]

Page 34: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 35: Discrete Mathematics - Predicates and Sets

Multiple Quantifiers

∃x∃y p(x , y)

∀x∃y p(x , y)

∃x∀y p(x , y)

∀x∀y p(x , y)

Page 36: Discrete Mathematics - Predicates and Sets

Multiple Quantifier Examples

Example

U = Zp(x , y) : x + y = 17

∀x∃y p(x , y):for every x there exists a y such that x + y = 17

∃y∀x p(x , y):there exists a y so that for all x , x + y = 17

what if U = N?

Page 37: Discrete Mathematics - Predicates and Sets

Multiple Quantifier Examples

Example

U = Zp(x , y) : x + y = 17

∀x∃y p(x , y):for every x there exists a y such that x + y = 17

∃y∀x p(x , y):there exists a y so that for all x , x + y = 17

what if U = N?

Page 38: Discrete Mathematics - Predicates and Sets

Multiple Quantifier Examples

Example

U = Zp(x , y) : x + y = 17

∀x∃y p(x , y):for every x there exists a y such that x + y = 17

∃y∀x p(x , y):there exists a y so that for all x , x + y = 17

what if U = N?

Page 39: Discrete Mathematics - Predicates and Sets

Multiple Quantifier Examples

Example

U = Zp(x , y) : x + y = 17

∀x∃y p(x , y):for every x there exists a y such that x + y = 17

∃y∀x p(x , y):there exists a y so that for all x , x + y = 17

what if U = N?

Page 40: Discrete Mathematics - Predicates and Sets

Multiple Quantifiers

Example

Ux = {1, 2} ∧ Uy = {A,B}

∃x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∨ [p(2,A) ∨ p(2,B)]

∃x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∨ [p(2,A) ∧ p(2,B)]

∀x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∧ [p(2,A) ∨ p(2,B)]

∀x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∧ [p(2,A) ∧ p(2,B)]

Page 41: Discrete Mathematics - Predicates and Sets

Multiple Quantifiers

Example

Ux = {1, 2} ∧ Uy = {A,B}

∃x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∨ [p(2,A) ∨ p(2,B)]

∃x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∨ [p(2,A) ∧ p(2,B)]

∀x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∧ [p(2,A) ∨ p(2,B)]

∀x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∧ [p(2,A) ∧ p(2,B)]

Page 42: Discrete Mathematics - Predicates and Sets

Multiple Quantifiers

Example

Ux = {1, 2} ∧ Uy = {A,B}

∃x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∨ [p(2,A) ∨ p(2,B)]

∃x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∨ [p(2,A) ∧ p(2,B)]

∀x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∧ [p(2,A) ∨ p(2,B)]

∀x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∧ [p(2,A) ∧ p(2,B)]

Page 43: Discrete Mathematics - Predicates and Sets

Multiple Quantifiers

Example

Ux = {1, 2} ∧ Uy = {A,B}

∃x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∨ [p(2,A) ∨ p(2,B)]

∃x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∨ [p(2,A) ∧ p(2,B)]

∀x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∧ [p(2,A) ∨ p(2,B)]

∀x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∧ [p(2,A) ∧ p(2,B)]

Page 44: Discrete Mathematics - Predicates and Sets

Multiple Quantifiers

Example

Ux = {1, 2} ∧ Uy = {A,B}

∃x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∨ [p(2,A) ∨ p(2,B)]

∃x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∨ [p(2,A) ∧ p(2,B)]

∀x∃y p(x , y) ≡ [p(1,A) ∨ p(1,B)] ∧ [p(2,A) ∨ p(2,B)]

∀x∀y p(x , y) ≡ [p(1,A) ∧ p(1,B)] ∧ [p(2,A) ∧ p(2,B)]

Page 45: Discrete Mathematics - Predicates and Sets

References

Required Reading: Grimaldi

Chapter 2: Fundamentals of Logic

2.4. The Use of Quantifiers

Supplementary Reading: O’Donnell, Hall, Page

Chapter 7: Predicate Logic

Page 46: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 47: Discrete Mathematics - Predicates and Sets

Set

Definition

set: a collection of elements that are

distinct

unordered

non-repeating

Page 48: Discrete Mathematics - Predicates and Sets

Set Representation

explicit representationelements are listed within braces: {a1, a2, . . . , an}

implicit representationelements that validate a predicate: {x |x ∈ G , p(x)}

∅: empty set

let S be a set, and a be an element

a ∈ S : a is an element of set Sa /∈ S : a is not an element of set S

|S |: number of elements (cardinality)

Page 49: Discrete Mathematics - Predicates and Sets

Set Representation

explicit representationelements are listed within braces: {a1, a2, . . . , an}

implicit representationelements that validate a predicate: {x |x ∈ G , p(x)}

∅: empty set

let S be a set, and a be an element

a ∈ S : a is an element of set Sa /∈ S : a is not an element of set S

|S |: number of elements (cardinality)

Page 50: Discrete Mathematics - Predicates and Sets

Set Representation

explicit representationelements are listed within braces: {a1, a2, . . . , an}

implicit representationelements that validate a predicate: {x |x ∈ G , p(x)}

∅: empty set

let S be a set, and a be an element

a ∈ S : a is an element of set Sa /∈ S : a is not an element of set S

|S |: number of elements (cardinality)

Page 51: Discrete Mathematics - Predicates and Sets

Set Representation

explicit representationelements are listed within braces: {a1, a2, . . . , an}

implicit representationelements that validate a predicate: {x |x ∈ G , p(x)}

∅: empty set

let S be a set, and a be an element

a ∈ S : a is an element of set Sa /∈ S : a is not an element of set S

|S |: number of elements (cardinality)

Page 52: Discrete Mathematics - Predicates and Sets

Set Representation

explicit representationelements are listed within braces: {a1, a2, . . . , an}

implicit representationelements that validate a predicate: {x |x ∈ G , p(x)}

∅: empty set

let S be a set, and a be an element

a ∈ S : a is an element of set Sa /∈ S : a is not an element of set S

|S |: number of elements (cardinality)

Page 53: Discrete Mathematics - Predicates and Sets

Explicit Representation Example

Example

{3, 8, 2, 11, 5}11 ∈ {3, 8, 2, 11, 5}|{3, 8, 2, 11, 5}| = 5

Page 54: Discrete Mathematics - Predicates and Sets

Implicit Representation Examples

Example

{x |x ∈ Z+, 20 < x3 < 100} ≡ {3, 4}{2x − 1|x ∈ Z+, 20 < x3 < 100} ≡ {5, 7}

Example

A = {x |x ∈ R, 1 ≤ x ≤ 5}

Example

E = {n|n ∈ N,∃k ∈ N [n = 2k]}A = {x |x ∈ E , 1 ≤ x ≤ 5}

Page 55: Discrete Mathematics - Predicates and Sets

Implicit Representation Examples

Example

{x |x ∈ Z+, 20 < x3 < 100} ≡ {3, 4}{2x − 1|x ∈ Z+, 20 < x3 < 100} ≡ {5, 7}

Example

A = {x |x ∈ R, 1 ≤ x ≤ 5}

Example

E = {n|n ∈ N,∃k ∈ N [n = 2k]}A = {x |x ∈ E , 1 ≤ x ≤ 5}

Page 56: Discrete Mathematics - Predicates and Sets

Implicit Representation Examples

Example

{x |x ∈ Z+, 20 < x3 < 100} ≡ {3, 4}{2x − 1|x ∈ Z+, 20 < x3 < 100} ≡ {5, 7}

Example

A = {x |x ∈ R, 1 ≤ x ≤ 5}

Example

E = {n|n ∈ N,∃k ∈ N [n = 2k]}A = {x |x ∈ E , 1 ≤ x ≤ 5}

Page 57: Discrete Mathematics - Predicates and Sets

Set Dilemma

There is a barber who lives in a small town.He shaves all those men who don’t shave themselves.He doesn’t shave those men who shave themselves.

Does the barber shave himself?

yes → but he doesn’t shave men who shave themselves→ no

no → but he shaves all men who don’t shave themselves→ yes

Page 58: Discrete Mathematics - Predicates and Sets

Set Dilemma

There is a barber who lives in a small town.He shaves all those men who don’t shave themselves.He doesn’t shave those men who shave themselves.

Does the barber shave himself?

yes → but he doesn’t shave men who shave themselves→ no

no → but he shaves all men who don’t shave themselves→ yes

Page 59: Discrete Mathematics - Predicates and Sets

Set Dilemma

There is a barber who lives in a small town.He shaves all those men who don’t shave themselves.He doesn’t shave those men who shave themselves.

Does the barber shave himself?

yes → but he doesn’t shave men who shave themselves→ no

no → but he shaves all men who don’t shave themselves→ yes

Page 60: Discrete Mathematics - Predicates and Sets

Set Dilemma

let S be the set of sets that are not an element of themselvesS = {A|A /∈ A}

Is S an element of itself?

yes → but the predicate is not valid → no

no → but the predicate is valid → yes

Page 61: Discrete Mathematics - Predicates and Sets

Set Dilemma

let S be the set of sets that are not an element of themselvesS = {A|A /∈ A}

Is S an element of itself?

yes → but the predicate is not valid → no

no → but the predicate is valid → yes

Page 62: Discrete Mathematics - Predicates and Sets

Set Dilemma

let S be the set of sets that are not an element of themselvesS = {A|A /∈ A}

Is S an element of itself?

yes → but the predicate is not valid → no

no → but the predicate is valid → yes

Page 63: Discrete Mathematics - Predicates and Sets

Set Dilemma

let S be the set of sets that are not an element of themselvesS = {A|A /∈ A}

Is S an element of itself?

yes → but the predicate is not valid → no

no → but the predicate is valid → yes

Page 64: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 65: Discrete Mathematics - Predicates and Sets

Subset

Definition

A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B]

set equality:A = B ⇔ (A ⊆ B) ∧ (B ⊆ A)

proper subset:A ⊂ B ⇔ (A ⊆ B) ∧ (A 6= B)

∀S [∅ ⊆ S ]

Page 66: Discrete Mathematics - Predicates and Sets

Subset

Definition

A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B]

set equality:A = B ⇔ (A ⊆ B) ∧ (B ⊆ A)

proper subset:A ⊂ B ⇔ (A ⊆ B) ∧ (A 6= B)

∀S [∅ ⊆ S ]

Page 67: Discrete Mathematics - Predicates and Sets

Subset

Definition

A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B]

set equality:A = B ⇔ (A ⊆ B) ∧ (B ⊆ A)

proper subset:A ⊂ B ⇔ (A ⊆ B) ∧ (A 6= B)

∀S [∅ ⊆ S ]

Page 68: Discrete Mathematics - Predicates and Sets

Subset

Definition

A ⊆ B ⇔ ∀x [x ∈ A → x ∈ B]

set equality:A = B ⇔ (A ⊆ B) ∧ (B ⊆ A)

proper subset:A ⊂ B ⇔ (A ⊆ B) ∧ (A 6= B)

∀S [∅ ⊆ S ]

Page 69: Discrete Mathematics - Predicates and Sets

Subset

not a subset

A * B ⇔ ¬∀x [x ∈ A → x ∈ B]

⇔ ∃x ¬[x ∈ A → x ∈ B]

⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ (x /∈ B)]

Page 70: Discrete Mathematics - Predicates and Sets

Subset

not a subset

A * B ⇔ ¬∀x [x ∈ A → x ∈ B]

⇔ ∃x ¬[x ∈ A → x ∈ B]

⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ (x /∈ B)]

Page 71: Discrete Mathematics - Predicates and Sets

Subset

not a subset

A * B ⇔ ¬∀x [x ∈ A → x ∈ B]

⇔ ∃x ¬[x ∈ A → x ∈ B]

⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ (x /∈ B)]

Page 72: Discrete Mathematics - Predicates and Sets

Subset

not a subset

A * B ⇔ ¬∀x [x ∈ A → x ∈ B]

⇔ ∃x ¬[x ∈ A → x ∈ B]

⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ (x /∈ B)]

Page 73: Discrete Mathematics - Predicates and Sets

Subset

not a subset

A * B ⇔ ¬∀x [x ∈ A → x ∈ B]

⇔ ∃x ¬[x ∈ A → x ∈ B]

⇔ ∃x ¬[¬(x ∈ A) ∨ (x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ ¬(x ∈ B)]

⇔ ∃x [(x ∈ A) ∧ (x /∈ B)]

Page 74: Discrete Mathematics - Predicates and Sets

Power Set

Definition

power set: P(S)the set of all subsets of a set, including the empty setand the set itself

if a set has n elements, its power set has 2n elements

Page 75: Discrete Mathematics - Predicates and Sets

Power Set

Definition

power set: P(S)the set of all subsets of a set, including the empty setand the set itself

if a set has n elements, its power set has 2n elements

Page 76: Discrete Mathematics - Predicates and Sets

Example of Power Set

Example

P({1, 2, 3}) = {∅,{1}, {2}, {3},{1, 2}, {1, 3}, {2, 3},{1, 2, 3}

}

Page 77: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 78: Discrete Mathematics - Predicates and Sets

Set Operations

complement

A = {x |x /∈ A}

intersection

A ∩ B = {x |(x ∈ A) ∧ (x ∈ B)}

if A ∩ B = ∅ then A and B are disjoint

union

A ∪ B = {x |(x ∈ A) ∨ (x ∈ B)}

Page 79: Discrete Mathematics - Predicates and Sets

Set Operations

complement

A = {x |x /∈ A}

intersection

A ∩ B = {x |(x ∈ A) ∧ (x ∈ B)}

if A ∩ B = ∅ then A and B are disjoint

union

A ∪ B = {x |(x ∈ A) ∨ (x ∈ B)}

Page 80: Discrete Mathematics - Predicates and Sets

Set Operations

complement

A = {x |x /∈ A}

intersection

A ∩ B = {x |(x ∈ A) ∧ (x ∈ B)}

if A ∩ B = ∅ then A and B are disjoint

union

A ∪ B = {x |(x ∈ A) ∨ (x ∈ B)}

Page 81: Discrete Mathematics - Predicates and Sets

Set Operations

difference

A− B = {x |(x ∈ A) ∧ (x /∈ B)}

A− B = A ∩ B

symmetric difference:A4 B = {x |(x ∈ A ∪ B) ∧ (x /∈ A ∩ B)}

Page 82: Discrete Mathematics - Predicates and Sets

Set Operations

difference

A− B = {x |(x ∈ A) ∧ (x /∈ B)}

A− B = A ∩ B

symmetric difference:A4 B = {x |(x ∈ A ∪ B) ∧ (x /∈ A ∩ B)}

Page 83: Discrete Mathematics - Predicates and Sets

Set Operations

difference

A− B = {x |(x ∈ A) ∧ (x /∈ B)}

A− B = A ∩ B

symmetric difference:A4 B = {x |(x ∈ A ∪ B) ∧ (x /∈ A ∩ B)}

Page 84: Discrete Mathematics - Predicates and Sets

Cartesian Product

Definition

Cartesian product:A× B = {(a, b)|a ∈ A, b ∈ B}

A× B × C × · · · × N = {(a, b, . . . , n)|a ∈ A, b ∈ B, . . . , n ∈ N}

|A× B × C × · · · × N| = |A| · |B| · |C | · · · |N|

Page 85: Discrete Mathematics - Predicates and Sets

Cartesian Product

Definition

Cartesian product:A× B = {(a, b)|a ∈ A, b ∈ B}

A× B × C × · · · × N = {(a, b, . . . , n)|a ∈ A, b ∈ B, . . . , n ∈ N}

|A× B × C × · · · × N| = |A| · |B| · |C | · · · |N|

Page 86: Discrete Mathematics - Predicates and Sets

Cartesian Product Example

Example

A = {a1.a2, a3, a4}B = {b1, b2, b3}

A× B = {(a1, b1), (a1, b2), (a1, b3),

(a2, b1), (a2, b2), (a2, b3),

(a3, b1), (a3, b2), (a3, b3),

(a4, b1), (a4, b2), (a4, b3)

}

Page 87: Discrete Mathematics - Predicates and Sets

Equivalences

Double Complement

A = A

CommutativityA ∩ B = B ∩ A A ∪ B = B ∪ A

Associativity(A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C )

IdempotenceA ∩ A = A A ∪ A = A

InverseA ∩ A = ∅ A ∪ A = U

Page 88: Discrete Mathematics - Predicates and Sets

Equivalences

Double Complement

A = A

CommutativityA ∩ B = B ∩ A A ∪ B = B ∪ A

Associativity(A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C )

IdempotenceA ∩ A = A A ∪ A = A

InverseA ∩ A = ∅ A ∪ A = U

Page 89: Discrete Mathematics - Predicates and Sets

Equivalences

Double Complement

A = A

CommutativityA ∩ B = B ∩ A A ∪ B = B ∪ A

Associativity(A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C )

IdempotenceA ∩ A = A A ∪ A = A

InverseA ∩ A = ∅ A ∪ A = U

Page 90: Discrete Mathematics - Predicates and Sets

Equivalences

Double Complement

A = A

CommutativityA ∩ B = B ∩ A A ∪ B = B ∪ A

Associativity(A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C )

IdempotenceA ∩ A = A A ∪ A = A

InverseA ∩ A = ∅ A ∪ A = U

Page 91: Discrete Mathematics - Predicates and Sets

Equivalences

Double Complement

A = A

CommutativityA ∩ B = B ∩ A A ∪ B = B ∪ A

Associativity(A ∩ B) ∩ C = A ∩ (B ∩ C ) (A ∪ B) ∪ C = A ∪ (B ∪ C )

IdempotenceA ∩ A = A A ∪ A = A

InverseA ∩ A = ∅ A ∪ A = U

Page 92: Discrete Mathematics - Predicates and Sets

Equivalences

IdentityA ∩ U = A A ∪ ∅ = A

DominationA ∩ ∅ = ∅ A ∪ U = U

DistributivityA ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C )

AbsorptionA ∩ (A ∪ B) = A A ∪ (A ∩ B) = A

DeMorgan’s LawsA ∩ B = A ∪ B A ∪ B = A ∩ B

Page 93: Discrete Mathematics - Predicates and Sets

Equivalences

IdentityA ∩ U = A A ∪ ∅ = A

DominationA ∩ ∅ = ∅ A ∪ U = U

DistributivityA ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C )

AbsorptionA ∩ (A ∪ B) = A A ∪ (A ∩ B) = A

DeMorgan’s LawsA ∩ B = A ∪ B A ∪ B = A ∩ B

Page 94: Discrete Mathematics - Predicates and Sets

Equivalences

IdentityA ∩ U = A A ∪ ∅ = A

DominationA ∩ ∅ = ∅ A ∪ U = U

DistributivityA ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C )

AbsorptionA ∩ (A ∪ B) = A A ∪ (A ∩ B) = A

DeMorgan’s LawsA ∩ B = A ∪ B A ∪ B = A ∩ B

Page 95: Discrete Mathematics - Predicates and Sets

Equivalences

IdentityA ∩ U = A A ∪ ∅ = A

DominationA ∩ ∅ = ∅ A ∪ U = U

DistributivityA ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C )

AbsorptionA ∩ (A ∪ B) = A A ∪ (A ∩ B) = A

DeMorgan’s LawsA ∩ B = A ∪ B A ∪ B = A ∩ B

Page 96: Discrete Mathematics - Predicates and Sets

Equivalences

IdentityA ∩ U = A A ∪ ∅ = A

DominationA ∩ ∅ = ∅ A ∪ U = U

DistributivityA ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ) A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C )

AbsorptionA ∩ (A ∪ B) = A A ∪ (A ∩ B) = A

DeMorgan’s LawsA ∩ B = A ∪ B A ∪ B = A ∩ B

Page 97: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 98: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 99: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 100: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 101: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 102: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 103: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 104: Discrete Mathematics - Predicates and Sets

DeMorgan’s Laws

Proof.

A ∩ B = {x |x /∈ (A ∩ B)}= {x |¬(x ∈ (A ∩ B))}= {x |¬((x ∈ A) ∧ (x ∈ B))}= {x |¬(x ∈ A) ∨ ¬(x ∈ B)}= {x |(x /∈ A) ∨ (x /∈ B)}= {x |(x ∈ A) ∨ (x ∈ B)}= {x |x ∈ A ∪ B}= A ∪ B

Page 105: Discrete Mathematics - Predicates and Sets

Example of Equivalence

Theorem

A ∩ (B − C ) = (A ∩ B)− (A ∩ C )

Page 106: Discrete Mathematics - Predicates and Sets

Equivalence Example

Proof.

(A ∩ B)− (A ∩ C ) = (A ∩ B) ∩ (A ∩ C )

= (A ∩ B) ∩ (A ∪ C )

= ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C ))

= ∅ ∪ ((A ∩ B) ∩ C ))

= (A ∩ B) ∩ C

= A ∩ (B ∩ C )

= A ∩ (B − C )

Page 107: Discrete Mathematics - Predicates and Sets

Equivalence Example

Proof.

(A ∩ B)− (A ∩ C ) = (A ∩ B) ∩ (A ∩ C )

= (A ∩ B) ∩ (A ∪ C )

= ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C ))

= ∅ ∪ ((A ∩ B) ∩ C ))

= (A ∩ B) ∩ C

= A ∩ (B ∩ C )

= A ∩ (B − C )

Page 108: Discrete Mathematics - Predicates and Sets

Equivalence Example

Proof.

(A ∩ B)− (A ∩ C ) = (A ∩ B) ∩ (A ∩ C )

= (A ∩ B) ∩ (A ∪ C )

= ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C ))

= ∅ ∪ ((A ∩ B) ∩ C ))

= (A ∩ B) ∩ C

= A ∩ (B ∩ C )

= A ∩ (B − C )

Page 109: Discrete Mathematics - Predicates and Sets

Equivalence Example

Proof.

(A ∩ B)− (A ∩ C ) = (A ∩ B) ∩ (A ∩ C )

= (A ∩ B) ∩ (A ∪ C )

= ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C ))

= ∅ ∪ ((A ∩ B) ∩ C ))

= (A ∩ B) ∩ C

= A ∩ (B ∩ C )

= A ∩ (B − C )

Page 110: Discrete Mathematics - Predicates and Sets

Equivalence Example

Proof.

(A ∩ B)− (A ∩ C ) = (A ∩ B) ∩ (A ∩ C )

= (A ∩ B) ∩ (A ∪ C )

= ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C ))

= ∅ ∪ ((A ∩ B) ∩ C ))

= (A ∩ B) ∩ C

= A ∩ (B ∩ C )

= A ∩ (B − C )

Page 111: Discrete Mathematics - Predicates and Sets

Equivalence Example

Proof.

(A ∩ B)− (A ∩ C ) = (A ∩ B) ∩ (A ∩ C )

= (A ∩ B) ∩ (A ∪ C )

= ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C ))

= ∅ ∪ ((A ∩ B) ∩ C ))

= (A ∩ B) ∩ C

= A ∩ (B ∩ C )

= A ∩ (B − C )

Page 112: Discrete Mathematics - Predicates and Sets

Equivalence Example

Proof.

(A ∩ B)− (A ∩ C ) = (A ∩ B) ∩ (A ∩ C )

= (A ∩ B) ∩ (A ∪ C )

= ((A ∩ B) ∩ A) ∪ ((A ∩ B) ∩ C ))

= ∅ ∪ ((A ∩ B) ∩ C ))

= (A ∩ B) ∩ C

= A ∩ (B ∩ C )

= A ∩ (B − C )

Page 113: Discrete Mathematics - Predicates and Sets

Topics

1 PredicatesIntroductionQuantifiersMultiple Quantifiers

2 SetsIntroductionSubsetSet OperationsInclusion-Exclusion

Page 114: Discrete Mathematics - Predicates and Sets

Principle of Inclusion-Exclusion

|A ∪ B| = |A|+ |B| − |A ∩ B||A ∪ B ∪ C | =|A|+ |B|+ |C | − (|A ∩ B|+ |A ∩ C |+ |B ∩ C |) + |A ∩ B ∩ C |

Theorem

|A1 ∪ A2 ∪ · · · ∪ An| =∑

i

|Ai | −∑i ,j

|Ai ∩ Aj |

+∑i ,j ,k

|Ai ∩ Aj ∩ Ak |

· · ·+−1n−1|Ai ∩ Aj ∩ · · · ∩ An|

Page 115: Discrete Mathematics - Predicates and Sets

Principle of Inclusion-Exclusion

|A ∪ B| = |A|+ |B| − |A ∩ B||A ∪ B ∪ C | =|A|+ |B|+ |C | − (|A ∩ B|+ |A ∩ C |+ |B ∩ C |) + |A ∩ B ∩ C |

Theorem

|A1 ∪ A2 ∪ · · · ∪ An| =∑

i

|Ai | −∑i ,j

|Ai ∩ Aj |

+∑i ,j ,k

|Ai ∩ Aj ∩ Ak |

· · ·+−1n−1|Ai ∩ Aj ∩ · · · ∩ An|

Page 116: Discrete Mathematics - Predicates and Sets

Principle of Inclusion-Exclusion

|A ∪ B| = |A|+ |B| − |A ∩ B||A ∪ B ∪ C | =|A|+ |B|+ |C | − (|A ∩ B|+ |A ∩ C |+ |B ∩ C |) + |A ∩ B ∩ C |

Theorem

|A1 ∪ A2 ∪ · · · ∪ An| =∑

i

|Ai | −∑i ,j

|Ai ∩ Aj |

+∑i ,j ,k

|Ai ∩ Aj ∩ Ak |

· · ·+−1n−1|Ai ∩ Aj ∩ · · · ∩ An|

Page 117: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

a method to identify prime numbers

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1718 19 20 21 22 23 24 25 26 27 28 29 30

2 3 5 7 9 11 13 15 1719 21 23 25 27 29

2 3 5 7 11 13 1719 23 25 29

2 3 5 7 11 13 1719 23 29

Page 118: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

a method to identify prime numbers

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1718 19 20 21 22 23 24 25 26 27 28 29 30

2 3 5 7 9 11 13 15 1719 21 23 25 27 29

2 3 5 7 11 13 1719 23 25 29

2 3 5 7 11 13 1719 23 29

Page 119: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

a method to identify prime numbers

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1718 19 20 21 22 23 24 25 26 27 28 29 30

2 3 5 7 9 11 13 15 1719 21 23 25 27 29

2 3 5 7 11 13 1719 23 25 29

2 3 5 7 11 13 1719 23 29

Page 120: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

a method to identify prime numbers

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1718 19 20 21 22 23 24 25 26 27 28 29 30

2 3 5 7 9 11 13 15 1719 21 23 25 27 29

2 3 5 7 11 13 1719 23 25 29

2 3 5 7 11 13 1719 23 29

Page 121: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

a method to identify prime numbers

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1718 19 20 21 22 23 24 25 26 27 28 29 30

2 3 5 7 9 11 13 15 1719 21 23 25 27 29

2 3 5 7 11 13 1719 23 25 29

2 3 5 7 11 13 1719 23 29

Page 122: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

number of primes between 1 and 100

numbers that are not divisible by 2, 3, 5 and 7

A2: set of numbers divisible by 2A3: set of numbers divisible by 3A5: set of numbers divisible by 5A7: set of numbers divisible by 7

|A2 ∪ A3 ∪ A5 ∪ A7|

Page 123: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

number of primes between 1 and 100

numbers that are not divisible by 2, 3, 5 and 7

A2: set of numbers divisible by 2A3: set of numbers divisible by 3A5: set of numbers divisible by 5A7: set of numbers divisible by 7

|A2 ∪ A3 ∪ A5 ∪ A7|

Page 124: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

number of primes between 1 and 100

numbers that are not divisible by 2, 3, 5 and 7

A2: set of numbers divisible by 2A3: set of numbers divisible by 3A5: set of numbers divisible by 5A7: set of numbers divisible by 7

|A2 ∪ A3 ∪ A5 ∪ A7|

Page 125: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

|A2| = b100/2c = 50

|A3| = b100/3c = 33

|A5| = b100/5c = 20

|A7| = b100/7c = 14

|A2 ∩ A3| = b100/6c = 16

|A2 ∩ A5| = b100/10c = 10

|A2 ∩ A7| = b100/14c = 7

|A3 ∩ A5| = b100/15c = 6

|A3 ∩ A7| = b100/21c = 4

|A5 ∩ A7| = b100/35c = 2

Page 126: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

|A2| = b100/2c = 50

|A3| = b100/3c = 33

|A5| = b100/5c = 20

|A7| = b100/7c = 14

|A2 ∩ A3| = b100/6c = 16

|A2 ∩ A5| = b100/10c = 10

|A2 ∩ A7| = b100/14c = 7

|A3 ∩ A5| = b100/15c = 6

|A3 ∩ A7| = b100/21c = 4

|A5 ∩ A7| = b100/35c = 2

Page 127: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

|A2 ∩ A3 ∩ A5| = b100/30c = 3

|A2 ∩ A3 ∩ A7| = b100/42c = 2

|A2 ∩ A5 ∩ A7| = b100/70c = 1

|A3 ∩ A5 ∩ A7| = b100/105c = 0

|A2 ∩ A3 ∩ A5 ∩ A7| = b100/210c = 0

Page 128: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

|A2 ∩ A3 ∩ A5| = b100/30c = 3

|A2 ∩ A3 ∩ A7| = b100/42c = 2

|A2 ∩ A5 ∩ A7| = b100/70c = 1

|A3 ∩ A5 ∩ A7| = b100/105c = 0

|A2 ∩ A3 ∩ A5 ∩ A7| = b100/210c = 0

Page 129: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

|A2 ∪ A3 ∪ A5 ∪ A7| = (50 + 33 + 20 + 14)

− (16 + 10 + 7 + 6 + 4 + 2)

+ (3 + 2 + 1 + 0)

− (0)

= 78

number of primes: (100− 78) + 4− 1 = 25

Page 130: Discrete Mathematics - Predicates and Sets

Inclusion-Exclusion Example

Example (sieve of Eratosthenes)

|A2 ∪ A3 ∪ A5 ∪ A7| = (50 + 33 + 20 + 14)

− (16 + 10 + 7 + 6 + 4 + 2)

+ (3 + 2 + 1 + 0)

− (0)

= 78

number of primes: (100− 78) + 4− 1 = 25

Page 131: Discrete Mathematics - Predicates and Sets

References

Required Reading: Grimaldi

Chapter 3: Set Theory

3.1. Sets and Subsets3.2. Set Operations and the Laws of Set Theory

Chapter 8: The Principle of Inclusion and Exclusion

8.1. The Principle of Inclusion and Exclusion

Supplementary Reading: O’Donnell, Hall, Page

Chapter 8: Set Theory