0% found this document useful (0 votes)
67 views18 pages

مادة امتحان نصف الفصل الأول

This document discusses key concepts in set theory including elements, finite and infinite sets, subsets, unions, intersections, complements, and De Morgan's laws. Some key points covered are the definitions of sets, subsets, proper subsets, unions, intersections, the empty set, cardinality, and properties of operations on sets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views18 pages

مادة امتحان نصف الفصل الأول

This document discusses key concepts in set theory including elements, finite and infinite sets, subsets, unions, intersections, complements, and De Morgan's laws. Some key points covered are the definitions of sets, subsets, proper subsets, unions, intersections, the empty set, cardinality, and properties of operations on sets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Al-Farabi University

‫را‬‫ ا‬
Cybersecurity Sciences

Department ‫ام‬‫ ا‬‫ ا‬ 

‫ ا‬‫ا‬
Discrete Structures

‫و‬‫ ا‬‫ا‬

2024 - 2023
Introduction to Set Theory
Set is a collection of objects called elements.

Elements
 A = { , , , }, We write ∈ A to denote that is an element of the set A. The
notation ∉ A denotes that is not an element of the set A.
 Let A= {yellow, blue, red}
“yellow is an element of A”, yellow ∈ A
“Green is not an element of A”, yellow ∉ A

Finite and Infinite Set


A set can be finite or infinite.
Finite Set
A finite set is a set with limited elements. For example, a set A is a set of counting numbers
less than 10. A = {1, 2, 3, 4, 5, 6, 7, 8, 9}
Infinite Set
An infinite set is a set with unlimited elements. For example, a set N is the set of counting
numbers. N=Z+ = {1, 2, 3, 4, 5, 6, 7, 8, 9, …}

Element Belong Set ∈


To express symbolically that an element belongs to a set we use ∈, for example:
1 ∈ A read as “1 in A” or “1 belong to A”
And 0 ∉ A read as “0 not in A” or “0 not belong to A”

1
Note: In most cases we don’t write out all the elements in a set but will write a shorthand
description using set builder natation, for example the set of prime numbers could be written
as: P= {p | p is prime} read as “p such that p is a prime”
Its good practice when dealing with sets of numbers to declare explicitly which sets you are
starting with, for example:
{ ∈ ℕ| < 5} ≠ { ∈ ℝ| < 5}
Equal Sets
Two sets are equal if they both contains the same elements. For example, If ∀ , ∈ , ∈
and ∀ , ∈ , ∈ , then A=B

This definition means that the order of the elements doesn’t matter.

A=B
It also doesn’t matter if elements are repeated

A=B

2
Example:
If set A is the set of letters in the word “earth”.
A={e, a, r, t, h}
and set B is the set of letters in the word “heart”
B={h, e, a, r, t}
So, A=B
Cardinality
 The size or cardinality of a set is the number of elements it contains.
 The cardinality of A is denoted by |A|.
Examples:
 If set A={1, 2, 3} then the cardinality |A|=3
 If set P = {p | p is a prime} then |P| = ∞
 Let C = {yellow, blue, red}, “The cardinality (size) of C is 3”, |C| = 3
 A = { , , , }, |A| = 4
 = {1, 2, 3, 7, 9}, | | = 5
 ∅ = { }, |∅| = 0
 A = { , , , , {2}}, A = 5
 = {1, 2, 3, {2, 3}, 9}, =5
 {∅} = {{ }}, ∅ = 1

The Singleton set


 A set with one element.
 A={5}
 C(A)=1

Equivalent Sets
Equivalent sets have different elements but have the same number of elements
(cardinality).
A={1, 2, 3, 4, 5} B={h, e, a, r, t}

3
C(A)=5 C(B)=5
A≈B

Universal Set
Universal set is the set containing all elements and of which all other sets are subsets.
U={a, e, i, o, u}
A={a, e, i}
B={i, o, u}
Set U is the set of counting numbers.
A={1, 3, 5, 7}
B={2, 4, 6}
U={1, 2, 3, 4, 5, 6, 7}

Subset
Set A is a subset of set B, if and only if (iff) all of elements in A is also in B.


Which read as “A is a subset of B”
List all the possible subsets of set A.
A= {s, i, r}
1. {s, I, r} 5. {s, i}
2. {S} 6. {s, r}
3. {i} 7.{I, r}
4. {r} 8. { } The empty set is a subset of every set.

General Formula
How many subsets does set A have?
2n, where n is the number of elements.
If C(A)=3, then there are 23=(2)(2)(2)=8 subsets.
4
Proper Subset
Set A is a proper subset of set B if there is at least one element in B not contained in A.
A⊂B
A={h, a, b, i, t}
B={a, b, i, t} B⊂A
C={b, i, t} C⊂B
D={i, t} D⊂C

Example:
List all the proper subsets of set A.
A={s, i, r}
{s, i}, {s, r}, {i, r}, {s}, {i}, {r}, { }
A={s, i, r}
General Formula
How many proper subsets does set A have?
2n-1, n is the number of elements.
If C(A)=3 then the number of proper subsets are 23-1=8-1=7.

The empty Set ∅

 There is a special set that has no elements. This set is called the empty set, or null set,
and is denoted by ∅.
 The empty set can also be denoted by { }
 ∅ is a subset of any set.
 ∅ is unique
 The cardinality C(∅)=0

Superset
Set A containing all of the elements of another set. A is a superset of B if every element in B
is also in A.
A⊇B
5
For example, if A = {1, 2, 3, 4, 5} and B = {1, 2, 3},

then A is a superset of B because A contains all the elements of B, as well as 4 and 5.

A⊇B

Proper Superset
A is a proper superset of B, if A⊇B and A≠B.
A⊃B
A={1, 2, 3, 4, 5} B={1, 2, 3}
B⊂A A⊃B
Power Set
The set of all the subsets of a set. For example, If A={s, i, r}, then what is P(A)?
P(A)={{s, i, r}, {s, i}, {s, r}, {I, r}, {s}, {i}, {r}, { }}
How many elements does the power set of A={s, i, r} have?
C(P(A)) = 23 = 8
Notes:
 The set is said to be a subset of iff every element of is also an element of .
 We use the notation ⊆ to indicate that is a subset of the se .
 To show that two sets A and B are equal, show that ⊆ and ⊆ .

 The set is a subset of the set but that ≠ , we write ⊂ and say that is a
of .

6
Question:

If ={ ∈ ℕ| }, which of these are subsets of B?


(a) 4
(b) {10, 100, 1000}
(c) {a | a=2k, k ∈ ℕ}

Another example: if ⊆ ⊆ ℎ =

If ⊆ ≠ , then A is a proper subset of B

Sometimes denoted ⊂ , sometimes ⊆ .


Some Properties
If ⊆ and ⊆ then ⊆ (Transitive)

Example
Odd numbers subset from integers, but integers subset from rational, implies odd numbers are
subset of rational numbers by transitive.

7
Union and Intersection
The union and intersection are two ways of combining the elements in two wats of combining
the elements in two sets into a new set.
The union of two sets A and B is the set containing all the elements in A as well as all the
elements in B.
∪ ={ | ∈ ∈ }

Example:
A= {1, 2, 3, 4, 5, 6} and B= {2, 4, 6, 8}

∪ = {1, 2, 3, 4.5,6,8}
The intersection of sets A and B is the set containing elements that are in both A and B.
∩ ={ | ∈ ∈ } read as “A intersect B”

∩ = {2,4,6}
Examples
Let A={0, 1} and B={1, 2, 3}
1. What is ∪ ? {0, 1, 2, 3}
2. What is ∩ ? {1}
8
Let = { ∈ ℕ| } = { ∈ ℕ|b is even}.
1. What is ∪ ? ℕ
2. What is ∩ ? ∅

Properties of the Union


1. ∪∅=A
2. ∪ =A
3. ⊆ , ℎ ∪ =

4. ∪ =B∪A
5. ∪ ( ∪ ) = (A ∪ B) ∪ C
Properties of the Intersection
1. ∩∅=∅
2. ∩ =A
3. ⊆ , ℎ ∩ =

4. ∩ =B∩A
5. ∩ ( ∩ ) = (A ∩ B) ∩ C
Cardinality of Union & Intersection
A={1, 2, 3} , B={3, 4}

9
|A|=3 + |B|=2 = | ∪ |=4+| ∩ | = 1= 5
Union and Intersection Cardinality
| ∪ | = | | + | | − |A ∩ B|
| ∪ |≤| |+| |
Mixing Unions and Intersections
∪ ( ∩ ) = ( ∪ ) ∩ ( ∪ ) (Distributive)

∩ ( ∪ ) = ( ∩ ) ∪ ( ∩ ) (Distributive)

× ( + ) = ( × ) + ( × ) (Distributive)

Now suppose ∊ ( ∪ ) ∩ ( ∪ ), then


∊( ∪ ) ∈ ( ∪ ).
If ∉ , ℎ ∈ ∈ ⇒ ∈ ( ∩ )
Otherwise ∊ ,
Therefore ∊ ∪ ( ∩ ), ( ∪ ) ∩ ( ∪ ) ⊆ ∪ ( ∩ )

10
If ∪ ( ∩ ) ⊆( ∪ )∩( ∪ )

And ( ∪ ) ∩ ( ∪ ) ⊆ ∪ ( ∩ )

Then ∪ ( ∩ )=( ∪ )∩( ∪ )

The Complement
The set-theoretic difference of two sets A and B is the set of all elements in A that aren’t in B.
\ = { ∈ A|x ∉ B}

For example:
If A={1,2,3,4,5} and B={2, 4, 6, 8}
\ = {1,3,5}
\ = {6,8}
If ⊆ , the set-theoretic difference of A and B is called the complement of B with respect
to A.

Can be written C(B) is the set of all elements.

11
Let A be the set of outcomes of rolling a pair of rolling a pair of dice in which both dice show
the same number.

Some other examples of complements


{ ∈ ℕ| } = { ∈ ℕ|x is even}
{ ∈ ℝ| ∈ ℚ} = { ∈ ℝ|x is irretional}
The complement negates the predicate.
= { ∈ B| }
= { ∈ B|¬ }

Properties of Complements
Let A and B be subsets of the universal set U.
1. ∅ =
2. =∅
3. ( ) =

4. If ⊆ , ℎ ⊆

12
De Morgan’s Law
If A and B are subsets of the universal set U
( ∪ ) = ∩
( ∩ ) = ∪

Example
Let U be the set of all integer numbers ℤ. Let A be the set of negatives and B be the set of
positive.
( ∪ ) = ∩
“Number that are neither negatives nor positives are not negatives and are not positives”

Example
Let U be the set ℕ, let A be the set of prime numbers and B the set { ∈ ℕ | < 100}.
( ∩ ) = ∪
( ∩< 100) = ∪ (< 100)
“the set of numbers that are not prime and less than 100 is the set of numbers that are either
not prime greater than 100”

De Morgan’s Duality Principle


∩( ∪ )=( ∩ )∪( ∩ ) ∪ ( ∩ ) = ( ∪ ) ∩ ( ∪ ) (intersection)
( ∪ ) = ∩ ( ∩ ) = ∪ (De Morgan)
Given any set-theoretic identity involving ∪ and ∩ if ∪ and ∩ are interchanged throughout,
then the result will be another valid identity.

13
Set of Sets
The elements of a set may be sets themselves:
A={{0},{0,1},{0,1,2}}
{0} ∈ A, 0 ∉ A, {0} ⊈ A and {{0}} ⊆A
The power set contains all subsets of a given set.
Let A be a set.
P(A)={X | X ⊆ A},
( ) = { ∅, {0, 1}, {0}, {1} }
Where P(A) is a “power set of A”
For A={0, 1}
( ) = { ∅, {0, 1}, {0}, {1} }
Indexed Families of Sets
Each element is indexed by a number
={ | ∈ }
={ | ∈ {1,2,3}} ↔ ={ , , }
Let = {{0}, {0,1}, {0,1,2}}, we can write this as
= {0}, = {0,1}, = {0,1,2}
Interval Notation
 Closed interval [ , ]
 Open interval ( , )
[ , ]={ | ≤ ≤ }
[ , )={ | ≤ < }
( , ]={ | < ≤ }
( , )={ | < < }
Common sets
 Natural numbers
ℕ = {1, 2, 3, 4, ….}
 Integers

14
ℝ = {…., -1, 0, 1, ….}
 Rational numbers
1 1
ℚ = {… , −1, − , 0, , 1, … }
2 2

Cartesian Product of Sets


A cartesian product of two non-empty sets A and B is the set of all possible ordered pairs
where the first component of the pair is from A, and the second component of the pair is
from B. The set of ordered pairs thus obtained is denoted by A×B.
A × B = {(a, b) : a ∈ A and b ∈ B}
Example:
= {1, 2} = {4, 5, 6}

× = {(1, 4), (1, 5), (1, 6), (2, 4), (2, 5), (2, 6)}
Here the first component of every ordered pair is from set A the second component is from
set B. The Cartesian Product of two sets can be easily represented in the form of a matrix
where both sets are on either axis, as shown in the image below. Cartesian Product of

= {1, 2} = { , , }

15
Properties of Cartesian Product
1. The Cartesian Product is non-commutative: A × B ≠ B × A
Example:
A = {1, 2} , B = {a, b}
A × B = {(1, a), (1, b), (2, a), (2, b)}
B × A = {(a, 1), (a, 1), (b, 1), (b, 2)}
Therefore, as A ≠ B we have A × B ≠ B × A
2. A × B = B × A, only if A = B
3. The cardinality of the Cartesian Product is defined as the number of elements in A × B
and is equal to the product of cardinality of both sets: |A × B| = |A| * |B|
Example:
A = {1, 2} , B = {a, b}

A × B = {(1, a), (1, b), (2, a), (2, b)}


C(A)=2 and C(B)=2 then C(A × B)=2*2=4

4. A × B = {∅}, if either A = {∅} or B = {∅}

Computer Set Representation


Computer Set Representation is How to find binary representation of sets. For example, the
universal set = {1,2,3,4,5,6,7,8,9,10}

And set = {2,4,6,8,10}

Bit string of ⊆ is 0101010101

Subset A represent with binary strings of length 5. In particular, we can let bit string (BS) of
A is 0101010101 mean the following:

 The bit (1) represents that element of subset A is in the set U.

 The bit (0) represents that element of subset A is not in the set U.

In general if ={ , ,…, }

And ⊆ then
16
1 ∈
0 ∉

Binary String OR & AND Functions


Let = {1,2,3,4,5}
and = {1,3,5,7,9}
∪ = {1,2,3,4,5,7,9}
∩ = {1,3,5}
B. S. of A is 111110000
B. S. of B is 101010101
B. S. of ∪ = (111110000) ∪ (101010101)
=111110101={1,2,3,4,5,7,9}
Union between two B. S. is corresponding to (OR)

∪ 0 1
0 0 1
1 1 1
B. S. of ∩ = (111110000) ∩ (101010101)
=101010000 (AND)

∩ 0 1
0 0 0
1 0 1

0∪0=0 0∩0=0
0∪1=1 0∩1=0
1∪0=1 1∩0=0
1∪1=1 1∩1=1

17

You might also like