You are on page 1of 73

# Chapter 1: Discrete Structures SETS

SETS
• WHY ARE WE STUDYING SETS • The concept of set is basic to all of mathematics and mathematical applications. • Sets are foundational in many areas of Computer Science. • For us, sets are useful to understand the principles of counting and probability theory

.

3. 2. 3. 4}.SETS A set is determined by its elements and not by any particular order in which the element might be listed. 1. A={1. 1} or {4. Example. 2} . 3. A might just as well be specified as {2. 4.

3. c} = {a. we may have duplicates in our list. a. 5} . Example {a. b. 5. c} {1. only one occurrence of each element is in the set. 3. b. c.SETS The elements making up a set are assumed to be distinct. 1} = {1. 3.

B.SETS Use uppercase letters A. C … to denote sets The symbol ∈ stands for “belongs to” The symbol ∉ stands for “does not belong to” .

b∈ X and m∉ X A={{1}. 4}. b. 3. {2}∈ A and 1∉ A .EXAMPLE X={ a. {2}. c. d. e }.

the notation. SETS . we can describe it by listing a property necessary for memberships Let S be a set. P(x)} or A= {x∈ S | P(x)} means that A is the set of all elements x of S such that x satisfies the property P. A= {x | x ∈S.If a set is a large finite set or an infinite set.

we can also write A as. 5. 4. 6}. 2. 3. Let B={x | x∈ Z. 3. 4. …} . 2. x>0}. B={1. 0<x<7} if Z denotes the set of integers.SETS Let A={1. A={x | x∈ Z.

.

. if A ⊆ B and B ⊆ A. A=B.SUBSET If every element of A is an element of B. we say that A is a subset of B and write A ⊆ B. The empty set { } is a subset of every set.

{3}.EXAMPLE A={1. 3} Subset of A. 3} {1. 2}. {1. 3} . {2. {2}. { }. 2. 2. 3}. {1. {1}.

we say that A is a proper subset of B.  A ⊂ B and A≠B .PROPER SUBSET If A is a subset of B and A is not equal to B.

3} Proper subset of B. {1}. {2}. 3}. {2. 2}. {3}. 3} . { }. 2. {1. {1.EXAMPLE B={1.

EQUAL SET Two set A and B are equal and we write A=B. b. a}. 3. 2. c. example A={a. B={b. A=B C={1. c}. 4} D={x | x is a positive integer . 2x <10}  C=D . if A and B have the same elements.

.

UNIVERSAL SET Sometimes we are dealing with sets all of which are subsets of a set U. This set U is called a universal set or a universe. The set U must be explicitly given or inferred from the context. .

6.3.8} as a universal set.2.4.5.7. .2.7} One may choose U={1.4.6.3}.EXAMPLE The sets X={1. Y={2.8} and Z={5.

.

.

.

.

.

.

Finite Set
Let A be a set, 􀂄􀂄 If there exists a nonnegative integer n such that A has n elements, then A is called a finite set with n elements. Example 􀂄􀂄 C = {1, 2, 3, 4} 􀂄􀂄 B = {x | x is an integer, 1 < x < 4}

Infinite SET
Let A be a set,  A is called an infinite set, if A is not a finite set. Example Z = {x| x is an integer} or Z = {…, -3, -2, -1, 0, 1, 2, 3,…} S={x| x is a real number , 1 < x < 4}

f.c.b.d. |A|=3 B= {a. |B|=7 .CARDINALITY SET Let S be a finite set with n distinct elements. example A= {1.e. 3}. 2. where n≥0.g}. Then we write |S|=n and say that the cardinality (or the number of elements) of S is n.

.

.

then |P(A)| = 2^n . is called the power set of A. denoted P(A). P(A)= {X | X ⊆ A} If |A|=n.POWER SET The set of all subsets of a set A.

P(A)= {{ }.3} } Notice that|A| = 3.3} the power set of A.2. {1.EXAMPLE A={1.3}.2. {3}.2}. {1. {1. {2. and|P(A)| = 2^3 = 8 . {2}. {1}.3}.

2. 2. a} Find: 􀂄􀂄 |X| 􀂄􀂄 Proper subset of X 􀂄􀂄 Power set of X . {1}.EXERCISE Let X= {1.

is defined to be the set The union consists of all elements belonging to either A or B (or both) A ∪ B = { x | x ∈ A or x ∈ B} .OPERATION ON SET The union of two sets A and B. denoted by A ∪ B.

OPERATIONS ON SETS Venn diagram of A ∪ B .

6} and C={8.EXAMPLE A={1. 5}. 3. 2. B={2. 4. 4. 9} Find : A∪B= A∪C= B∪C= A∪B∪C= .

5. 2. 6. 6} A ∪ C = {1. 4. 2. 5. 4. 3. 2. 9} B ∪ C = {2. 6. 3. 5. 8. 9} . 4. 4. 8. 9} A ∪ B ∪ C = {1.A ∪ B = {1. 3. 8.

denoted by A ∩ B.OPERATIONS ON SETS The intersection of two sets A and B. . is defined to be the set A ∩ B = { x | x ∈ A and x ∈ B} The intersection consists of all elements belonging to both A and B.

OPERATIONS ON SETS Venn diagram of A ∩ B .

10 } Find: A∩B= A∩C= C∩B= A∩B∩C= .EXAMPLES A={1. 2. 4. B={2. 3. 10} and C={ 1. 8. 6}. 5. 8. 2. 6. 4.

8. 10} A ∩ B ∩ C = {2} .A ∩ B = {2. 4. 6} A ∩ C = {1. 2} C ∩ B = {2.

OPERATIONS ON SETS Two sets A and B are said to be disjoint if. A∩B=∅ .

A ∩ B = ∅ .OPERATIONS ON SETS Venn diagram.

OPERATIONS ON SETS If A and B are finite sets. the cardinality of A ∪ B. | A ∪ B| = |A| + |B| − |A ∩ B| .

OPERATIONS ON SETS The set A-B= { x | x ∈ A and x ∉ B} is called the difference. . The difference A-B consists of all elements in A that are not in B.

OPERATIONS ON SETS Venn diagram of A-B .

6. 4. 5. 3. 6. 7 } . 8 }  A-B = { 1. 4. 3. 5. 8 } B= { 2.EXAMPLE A= { 1. 2. 7.

denoted by A′ is defined to be A′ = { x∈U| x ∉ A} A′ = U-A .OPERATIONS ON SETS The complement of a set A with respect to a universal set U.

OPERATIONS ON SETS Venn diagram of A’ .

4. 5.EXAMPLE Let U be a universal set. 7 } . 3. 7 } A= { 2. 4. 5. 2. 6. U= { 1. 3. 6 }  A′ = U – A = { 1.

g. A ∩ B . d. j. g. k. c. e. m } Find: A ∪ B . c. A-B and A′. h. b. m } A = { a. | A ∪ B| . c. l. i. f. m} B = { b. . h.EXERCISE Let. f . U = { a.

g.m } A ∪ B = { a.i.k.f } A ∩ B = { c.| A ∪ B| = 7 A-B = { a.d.h.g.l} .f.j.m } SOLUTIONS A′ = { b.c.h.b.e.

EXERCISE {1.3} ∪ {3.3} ∩ {3.4.5} {x| x>0} ∪ {x| x>1} {1.5 {x| x>0} ∩ {x| x>1} .2.4.2.

2.2.4.3.5}={1.5} {x| x>0} ∪ {x| x>1} = {x| x>0} {1.3} ∪ {3.3} ∩ {3.SOLUTIONS {1.4.4.2.5}={3} {x| x>0} ∩ {x| x>1} = {x| x>1} .

Properties of Set • Commutative laws • A ∩ B=B ∩ A • A ∪ B=B ∪ A .

Properties of Set • Associative laws • A ∩ (B ∩ C) = (A ∩ B) ∩ C • A ∪ (B ∪ C) = (A ∪ B) ∪ C • Distributive laws • A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) • A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) .

Properties of Set • • • • • • Complement laws (A′)′ = A A ∩ A′ = ∅ A ∪ A′ = U ∅′ =U U′ = ∅ .

Properties of Set • Absorption laws • A ∪ (A ∩ B) = A • A ∩ (A ∪ B) = A • Idempotent laws • A ∩ A=A • A ∪ A=A .

Properties of Set • De Morgan’s laws • (A ∩ B)′ = A′ ∪ B′ • (A ∪ B)′ = A′ ∩ B′ • Properties of universal set • A∪U=U • A∩U=A .

Properties of SET • Properties of empty set • A∪∅=A • A∩∅=∅ .

EXAMPLE Simplify the set (((A∪B)∩C)’∪B’)’ .

SOLUTION .

.

Cartesian Product • An ordered pair (a. 1) . a). b) is considered distinct from ordered pair (b. 2) ≠ (2. unless a=b. • Example (1.

b)| a∈A. • A×∅ = ∅×A = ∅ . b∈B} • For any set A.Cartesian Product • The Cartesian product of two sets A and B. written A×B is the set. • A×B = {(a.

EXAMPLE • A= {a. (b. (a. a). 1). (1. b). b}. • A×B = {(a. b)} . (2. B={1. 2)} • B×A = {(1. 2). a). 2}. 1). (b. (2.

Cartesian Product • if A ≠ B. then |A×B|=mn . • if |A| = m and |B| = n. then A×B ≠ B×A.

(3. 4). (6. (1.3= 6. 1). 2). A×B ≠ B×A • |A| = 2 . (3. . B={2. | A×B |= 2. 6)} • B×A = {(2. (4. • A×B = {(1. 6). 3}. 3)} • A ≠ B. (6. |B| = 3. 4. (2.EXAMPLE • A= {1. 2). 1). (3. (4. (1. 4). 6}. 3). 3). 1).

5} • {Male.2 } X {3. Single} X { Student. 4. Female} X {Married. Faculty} .EXERCISE • {1.

.

.

• 􀂄􀂄 A×B.Exercise • Let A= {w. |B×C|. PS}. B={1. 2} and C={KB. |A×C|. • Find |A×B|. A×C • 􀂄􀂄 A×B×C . x}. B×C.|A×B×C| • Determine the following set. SD.