Docsity

Set Equality - Discrete Mathematics - Lecture Slides, Slides of Discrete Mathematics

Partial preview of the text

Download Set Equality - Discrete Mathematics - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

CSci 2011

Discrete Mathematics

Lecture 9, 10

Set Equality, Subsets

Two sets are equal if they have the same elements

 Two sets are not equal if they do not have the same elements {1, 2, 3, 4, 5} ≠ {1, 2, 3, 4}

If all the elements of a set S are also elements of a

set T, then S is a subset of T

 If S = {2, 4, 6}, T = {1, 2, 3, 4, 5, 6, 7}, S is a subset of T  This is specified by S ⊆ T meaning that ∀ x (x ∈ S → x ∈ T)

 For any set S, S ⊆ S (∀S S ⊆ S)  For any set S, ∅ ⊆ S (∀S ∅ ⊆ S)

Set cardinality

The cardinality of a set is the number of elements in

a set, written as |A|

Examples

 Let R = {1, 2, 3, 4, 5}. Then |R| = 5  |∅| = 0  Let S = {∅, {a}, {b}, {a, b}}. Then |S| = 4

Power Sets

Given S = {0, 1}. All the possible subsets of S?

 ∅ (as it is a subset of all sets), {0}, {1}, and {0, 1}  The power set of S (written as P(S)) is the set of all the subsets of S  P(S) = { ∅, {0}, {1}, {0,1} } Note that |S| = 2 and |P(S)| = 4

Let T = {0, 1, 2}. The P(T) = { ∅, {0}, {1}, {2},

Note that |T| = 3 and |P(T)| = 8

P(∅) = { ∅ }

 Note that |∅| = 0 and |P(∅)| = 1

If a set has n elements, then the power set will have

2 n^ elements

Cartesian products

A Cartesian product is a set of all ordered 2-tuples

where each “part” is from a given set

 Denoted by A x B, and uses parenthesis (not curly brackets)  For example, 2-D Cartesian coordinates are the set of all ordered pairs Z x Z Recall Z is the set of all integers This is all the possible coordinates in 2-D space  Example: Given A = { a, b } and B = { 0, 1 }, what is their Cartiesian product? C = A x B = { (a,0), (a,1), (b,0), (b,1) }

Formal definition of a Cartesian product:

 A x B = { ( a , b ) | a ∈ A and b ∈ B }

Cartesian Products 2

All the possible grades in this class will be a

Cartesian product of the set S of all the students in

this class and the set G of all possible grades

 Let S = { Alice, Bob, Chris } and G = { A, B, C }  D = { (Alice, A), (Alice, B), (Alice, C), (Bob, A), (Bob, B), (Bob, C), (Chris, A), (Chris, B), (Chris, C) }  The final grades will be a subset of this: { (Alice, C), (Bob, B), (Chris, A) } Such a subset of a Cartesian product is called a relation (more on this later in the course)

Set operations: Intersection

Formal definition for the intersection of two sets: A

∩ B = { x | x ∈ A and x ∈ B }

Examples

 {a, b} ∩ {3, 4} = ∅  {1, 2} ∩ ∅ = ∅

Properties of the intersection operation

 A ∩ U = A Identity law  A ∩ ∅ = ∅ Domination law  A ∩ A = A Idempotent law  A ∩ B = B ∩ A Commutative law  A ∩ (B ∩ C) = (A ∩ B) ∩ C Associative law

Disjoint sets

Formal definition for disjoint sets: two sets

are disjoint if their intersection is the empty set

Further examples

{1, 2, 3} and {3, 4, 5} are not disjoint

{a, b} and {3, 4} are disjoint

{1, 2} and ∅ are disjoint

Their intersection is the empty set

∅ and ∅ are disjoint!

Their intersection is the empty set

Complement sets

Formal definition for the complement of a

set: A = { x | x ∉ A } = Ac

Or U – A, where U is the universal set

Further examples (assuming U = Z )

{1, 2, 3}c^ = { …, -2, -1, 0, 4, 5, 6, … }

Properties of complement sets

(A c) c^ = A Complementation law

A U A c^ = U Complement law

A ∩ A c^ = ∅ Complement law

Set identities

A∪∅ = A

A∩U = A

Identity Law

A∪U = U

A∩∅ = ∅

Domination law

A∪A = A A∩A = A

Idempotent Law (Ac^ ) c^ = A Complement Law

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

Commutative Law

(A∪B) c^ = Ac∩Bc (A∩B) c^ = Ac∪Bc^

De Morgan’s Law

A∪(B∪C)

= (A∪B)∪C

A∩(B∩C)

= (A∩B)∩C

Associative Law

A∩(B∪C) =

(A∩B)∪(A∩C)

A∪(B∩C) =

(A∪B)∩(A∪C)

Distributive Law

A∪(A∩B) = A

A∩(A∪B) = A

Absorption Law

A ∪ A c^ = U A ∩ Ac^ = ∅

Complement Law

What we are going to prove…

A∩B=B-(B-A)

A B

B-(B-A) A∩B B-A

Proof by Set Identities

A ∩ B = A - (A - B)

Proof) A - (A - B) = A - (A ∩ Bc)

= A ∩ (A ∩ Bc) c

= A ∩ (Ac^ ∪ B)

= (A ∩ A c) ∪ (A ∩ B)

= ∅ ∪ (A ∩ B)

= A ∩ B

Examples

 Let A , B , and C be sets. Show that:

a) (AUB) ⊆ (AUBUC)

b) (A∩B∩C) ⊆ (A∩B)

c) (A-B)-C ⊆ A-C

d) (A-C) ∩ (C-B) = ∅

Definition of a function

A function takes an element from a set and maps it to a UNIQUE element in another set

R Z

f

Domain Co-domain

Pre-image of 4 Image of 4.

f maps R to Z

f(4.3)