2_SET_SD1

7
STRUKTUR DISKRIT I-2, SETS (HIMPUNAN) A set is a collection or group of objects or elements or members. There is universal set called U Notation for set: List the elements between braces: S = {a,b,c,d} = {b,c,a,d,d} Specification by predicates: S = {x | P(x)} S contains all the elements from U which make all the predicate true Brace notation with ellipses S = {...., -3, -2, -1}, The negative integers Notation : X is member of S atau X is an element of S: X Є S. X is not a member of S: X S Common universal sets R = Reals N = Natural Numbers = {0,1,2,3,....} Z = All integers = {..., -3,-2,-1,0,1,2,3,4,....} Z + = is the set of positive integer SUBSETS Definition : The set A is a subsets of the set B, denoted A B if Definition : The void set, the null set, the Empty set denoted Ø is the set with no members. Definition : If A B but A ≠ B denoted A B Definition : The set of all subset of a set A , denoted P (A), is called the power set of A For Example: if A = {a,b} then P (A) = {Ø, {a},{b}, {a,b}} Definition : The Number of (distinct) elements in A denoted | A| is called the cardinality of A. Syandra Sari Page 1 of 7

description

2

Transcript of 2_SET_SD1

Page 1: 2_SET_SD1

STRUKTUR DISKRIT I-2, SETS (HIMPUNAN)

A set is a collection or group of objects or elements or members. There is universal set called U

Notation for set: List the elements between braces:

S = {a,b,c,d} = {b,c,a,d,d} Specification by predicates:

S = {x | P(x)}S contains all the elements from U which make all the predicate true

Brace notation with ellipsesS = {...., -3, -2, -1},The negative integers

Notation :X is member of S atau X is an element of S: X Є S.

X is not a member of S: X S

Common universal sets R = Reals N = Natural Numbers = {0,1,2,3,....} Z = All integers = {..., -3,-2,-1,0,1,2,3,4,....} Z+ = is the set of positive integer

SUBSETSDefinition : The set A is a subsets of the set B, denoted A B if

Definition : The void set, the null set, the Empty set denoted Ø is the set with no members.Definition : If A B but A ≠ B denoted A BDefinition : The set of all subset of a set A , denoted P (A), is called the power set of A

For Example: if A = {a,b} then P (A) = {Ø, {a},{b},{a,b}} Definition : The Number of (distinct) elements in A denoted |A| is called the cardinality of

A.If the cardinality of a natural number (in N) then the set is called finite, else infinite.For Example : A = {a,b} |{a,b}| = 2 |P ({a,b})| = 4A is finite so is P (A) |A| = n|P(A)| = 2 n

Sets can be both members and subsets of other sets.For Example : A = {Ø, {Ø}}A has two elements and four subsets: Ø, {Ø}, {{Ø}}, {Ø, {Ø}}Ø is both a member of A and subsets of A.Definition : Cartesian Product of A with B , denoted A X B, is the set of ordered pairs

{<a,b>|A a Λ b B}

Notation :

Syandra Sari Page 1 of 6

Page 2: 2_SET_SD1

STRUKTUR DISKRIT I-2, SETS (HIMPUNAN)

For example : A = {a,b}, B = {1,2,3} A X B = {<a,1>, <a,2>, <a,3>,<b,1>,b,2>,<b,3>}

SETS OPERATIONSDefinition : Two sets A and B are equal , denoted A = B

x [ X A X B] A=B if A B and B A

Definition : The union of A and B denoted A B is the set {X | X A X B}

The intersection of A and B, denoted A B is the set {X | X A X B} if the

intersection is void, A and B are said to be disjoint.

The complement of A , denoted is the set { X| (X A )} alternative AC,{X | X A}

The difference of A and B , or the complement of B relative to A, denoted A-B, is the set

A

The complement of A is U – A The symmetric difference of A and B, denoted is the set (A-B) (B-A)

For Example : U = {0,1,2,3,4,5,6,7,8,9,10}A = {1,2,3,4,5}, B = {,5,6,7,8} Then

A B =

A B =

= = A – B = B – A =

A B =

VENN DIAGRAMA Useful geometric visualization tool (for 3 or less sets).

The universe is the rectangular box

Each set is represented by a circle and its interior All possible combination of the sets must be represented

Syandra Sari Page 2 of 6

Page 3: 2_SET_SD1

STRUKTUR DISKRIT I-2, SETS (HIMPUNAN)

FOR TWO SETS FOR THREE SETS

Shade the appropiate region to represent the given set operation.

SET IDENTITIESSet identities correspond to the logical equivalences.For Example : The complement of the union s the intersection of the complements.

A B= A B

=========================Table Identity Set Identity=========================

A Ø = A Identity Laws

A ∩ = A

=========================

A = Domination Laws

A ∩

============================================

A A = A Idempotent Laws

A ∩ A = A

============================================(Ā) = A Complementation Laws============================================

A B = B A Commutative Laws

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

A (B C) = (A B) C Associative Laws

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

Syandra Sari Page 3 of 6

Page 4: 2_SET_SD1

STRUKTUR DISKRIT I-2, SETS (HIMPUNAN)

A (B C) = (A ∩ B) (A ∩ C) Distributive Laws

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

==================================================

A ∩ B = Ā B De Morgans Laws

A B = Ā ∩ B

================================================

For Example : Use Builder Notation and Logical Equivalents to show that

Solution : The following chain of equalities provides a demonstration of this identity.

A ∩ B = { x | x A ∩ B } = { x | ¬ (x (A∩B)) } = { x | ¬ (x A Λ x B) }

= { x | x A x B }

= { x | x x }

= { x | x } =

Set identities can also proved using membership tables.

For Example : Use a membership table to show that A ∩ (B C) = (A∩B) (A∩C)

To indicate that an element is in a set, a 1 is used . To indicate that an element is not in a set, a 0 is used.

TABLE 2. A MEMBERSHIP TABLE FOR DISTRIBUTIVE

A B C B C A∩(B C) A∩B A∩C (A∩B) (A∩C)

1 1 1 1 1 1 1 11 1 0 1 1 1 0 11 0 1 1 1 0 1 11 0 0 0 0 0 0 00 1 1 1 1 0 0 00 1 0 1 0 0 0 00 0 1 1 0 0 0 00 0 0 0 0 0 0 0

SAME

It is Proven that the identity is valid.

For Example : let A,B,C be sets show that = ( ) ∩

Solution : We have

Syandra Sari Page 4 of 6

Page 5: 2_SET_SD1

STRUKTUR DISKRIT I-2, SETS (HIMPUNAN)

= Ā ∩ by the first De Morgans

= Ā ∩ ( ) by the second De Morgans

= ( )∩ Ā by the com. for intersection

= ( )∩ Ā by the com. for union

GENERALIZED UNION AND INTERSECTION

Definition : The union of a collection of the sets is the set that contain those elements that are members of at least one set in the collection.

A1 A2 A3 .......An =

Definiton : The intersection of a collection of sets is the set that contains those elements that are members of all sets in the collection.

A1∩A2∩ A3... An = Example : = {i, i+1, i+2, ......} Then

= {i, i+1, i+2,.....} = {1,2,3,4.......} , and

= = {i, i+1, i+2,....} = {n, n+1, n+2,....}

Computer Representation Of Set

One way to represant sets using computer is using an arbitrary ordering of the elements of the universal set. Assume that the universal set U is finite. First, specify an arbitrary ordering of the elements of U for instance a1,a2,....an

Represent subset A of U with bit string of length n where the i-th bit in this string is 1 if ai belongs to A and 0 if ai does not belong to A.

For Example : U= {1,2,3,4,5, 6,7,8,9,10}

Syandra Sari Page 5 of 6

Page 6: 2_SET_SD1

STRUKTUR DISKRIT I-2, SETS (HIMPUNAN)

What bit strings represent the subset of all odd integers in U , the subset of all even int in U?, the subset of int not exceeding 5 inU?

Solution : Odd integers in U : { 1,3,5,67,9 } → 1010101010Even integers in U; { 2,4,6,8,10 } → 0101010101All integers in U not exceeded 5 : {1,2,3,4,5} → 1111100000

How about operation set complement , intersection, and unions?Complement = negasiIntersection = ANDUnion = OR

Syandra Sari Page 6 of 6