Sets, Functions, Sequences and Sums ICS 253: Discrete Structures I

King Fahd University of Petroleum & Minerals
Information & Computer Science Department
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions,
Sequences and Sums
ICS 253: Discrete Structures I
2
Basic Structures: Sets, Functions, Sequences and Sums
Reading Assignment
• K. H. Rosen, Discrete Mathematics and Its
Applications, 7th Global Ed., McGraw-Hill,
2006.
• Chapter 2 (Except Section 2.6)
ICS 253: Discrete Structures I
3
Basic Structures: Sets, Functions, Sequences and Sums
Introduction
• Many important discrete structures are built using sets.
• For example: combinations used extensively in counting, relations,
graphs and finite state machines.
• Functions play important roles throughout discrete mathematics.
• For example, they are used to represent the computational complexity
of algorithms, to study the size of sets, to count objects, etc.
• Sequences and strings are special types of functions.
• We will introduce some important types of sequences, and will
address the problem of identifying a pattern for the terms of a
sequence from its first few terms.
• Using the notion of a sequence, we will define what it means for a set
to be countable.
• Adding consecutive terms of a sequence, making a sum, will prove
to be helpful in many discrete structures applications.
ICS 253: Discrete Structures I
4
Basic Structures: Sets, Functions, Sequences and Sums
Section 2.1: Sets
• A Set is an unordered collection of “objects”.
•
•
•
•
Defined by Cantor 1895
Objects in a set are also called elements or members of a set.
Example: A set of vowels, V= {a, e, i, o, u}
Bertrand Russel in 1902 showed that this definition may
lead to paradoxes.
• A paradox means a logical inconsistency.
• Paradoxes occur if no “restriction” is made on the
objects of a set
•
Q29 pp. 128: Russel’s Paradox: Let S contain all sets x
where x does not belong to itself, i.e. S = { x | x  x}.
Show that S is not well-defined by showing that both SS
and SS lead to a contradiction
ICS 253: Discrete Structures I
5
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q1(a) pp 127: List the members of these sets.
a) {x | x is a real number such that x2 = 1}
• Q2 (b,c) pp 127: Use set builder notation to
give a description of each of these sets.
b) {-3, -2, -1,0,1,2, 3}
c) {m,n,o,p}
ICS 253: Discrete Structures I
6
Basic Structures: Sets, Functions, Sequences and Sums
Some Notations and Preliminaries
•
•
•
•
•
ℕ = {0,1,2,…} set of natural numbers
ℤ = {…, -2, -1, 0, 1, 2, …} set of integers
ℝ: set of real numbers
ℚ: set of rational numbers
Two sets are equal if and only if they have the
same elements.
•
i.e. order and repetitions are irrelevant.
• The set A is a subset of B if and only if every
element of A is also an element of B, denoted by
A  B.
•
•
i.e. x(xA  xB)
Prove that   S for all sets S
ICS 253: Discrete Structures I
7
Basic Structures: Sets, Functions, Sequences and Sums
Venn Diagrams
• Used to graphically represent sets
• Universal set is represented by a rectangle,
all other subsets are represented by circles
and/or other geometric shapes.
• Q#11 pp.127: Use a Venn diagram to
illustrate the relationship A  B and B  C.
8
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
More Preliminaries
• Theorem 1: For every set S
• S
• SS
Proof:
• Proper Subset
ICS 253: Discrete Structures I
9
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q6 pp 127: For each of the following sets,
determine whether 2 is an element of that set.
a) {xℝ | x is an integer greater than 1}
b) {xℝ | x is the square of an integer}
c) {2,{2}}
d) {{2},{{2}}}
e) {{2},{2,{2}}}
f) {{{2}}}
ICS 253: Discrete Structures I
10
Basic Structures: Sets, Functions, Sequences and Sums
More Preliminaries
• Definition: Let S be a set. If there are exactly
n distinct elements in S, where n is a nonnegative integer, we say that S is a finite set of
cardinality n, denoted by |S|=n. Otherwise, the
set is infinite.
•
What is the cardinality of the set of vowels in the
English language?
• Given a set S, the power set of S is the set of
all subsets of the set S, and is denoted by P(S).
•
If |S|=n, |P(S)|=2n elements
ICS 253: Discrete Structures I
11
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• What is the power set of
•
•
•
•
{1,2}

{}
{{1,2}}
• What is the cardinality of each of the following sets
•
•
•
•
{a}
{{a}}
{a,a,a,a}
{a,{a},{a,{a}}}
12
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
Cartesian Products
•
•
The ordered n-tuple (a1, a2,…, an) is the ordered collection
that has a1 as its first element, a2 as its second element, …,
an as its nth element.
Two ordered tuples (a1, a2,…,am) and (b1, b2,…, bn) are said
to be equal if and only if
1. m = n and
2. ai= bi for 1  i  n.
•
•
An ordered 2-tuple is called an ordered pair.
The Cartesian product of the sets A1, A2, …, An, denoted by
A1 A2  …  An is the set of ordered n-tuples (a1, a2,…,
an), where ai belongs to Ai, for i=1,2,…, n.
ICS 253: Discrete Structures I
13
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• What is the Cartesian product of A={1,2},
B={3,4} and C={5}?
• Q19 pp 128: Let A={a, b, c, d} and B={y, z}.
Find
a) A  B
b) B  A
ICS 253: Discrete Structures I
14
Basic Structures: Sets, Functions, Sequences and Sums
Using Set Notation with Quantifiers
• xS (P(x)) is shorthand for x(xS  P(x)).
• Similarly, xS (P(x)) is shorthand for
……………
Truth Sets of Quantifiers
• Note that x P(x) is true over the domain U if
and only if the truth set of P is the set U.
• Likewise, x P(x) is true over the domain U if
and only if the truth set of P is nonempty.
ICS 253: Discrete Structures I
15
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q26 pp128: Translate each of these
quantifications into English and determine its
truth value.
a) xℝ (x2  – 1)
b) xℤ (x2 = 2)
c) xℤ (x2 > 0)
d) xℝ (x2 = x)
ICS 253: Discrete Structures I
16
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q27 pp128: Find the truth set of each of these
predicates where the domain is the set of
integers, ℤ:
a) P(x): “x2 < 3”
b) Q(x): “x2 > x”
c) R(x): “2x + 1 = 0”
ICS 253: Discrete Structures I
17
Basic Structures: Sets, Functions, Sequences and Sums
Section 2.2: Set Operations
• Let A and B be sets.
•
•
•
•
The union of the sets A and B, denoted by AB, is the
set that contains those elements that are either in A or in
B, or in both.
The intersection of the sets A and B, denoted by AB,
is the set containing those elements in both A and B.
A and B are called disjoint sets if their intersection is the
empty set.
The difference of A and B, denoted by A  B, is the set
containing those elements that are in A but not in B.
•
The difference of A and B is also called the complement of B
with respect to A.
ICS 253: Discrete Structures I
18
Basic Structures: Sets, Functions, Sequences and Sums
Complement of a Set
• Let U be the universal set. The complement of
the set A, denoted by A, is the complement of A
with respect to U, i.e. U  A.
• Question 2 page 138: Let A={a,b,c,d,e} and
B={a,b,c,d,e,f,g,h}. Find:
•
•
•
•
AB
AB
AB
BA
ICS 253: Discrete Structures I
19
Basic Structures: Sets, Functions, Sequences and Sums
Example
• Q18 pp 138: The symmetric difference of A
and B, denoted by A  B, is the set
containing those elements in either A or B,
but not in both A and B.
Find the symmetric difference of { 1, 3, 5}
and {1, 2, 3}.
ICS 253: Discrete Structures I
20
Basic Structures: Sets, Functions, Sequences and Sums
Cardinality of Some Set Operations
• Given finite sets A and B,
|AB| = |A| + |B| – |A  B|.
• Can you come up with a law for the |A – B|?
21
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
Set Identities
A U  A
A   A
A U  U
A   
A A  A
A A  A
 
A A
A B  B A
A B  B A
Identity
Laws
Domination
Laws
Idempotent
Laws
Complementation
Law
Commutative
Laws
22
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
Set Identities (Cont.)
A   B C    A  B  C
A   B C    A  B  C
A   B C    A  B    A C 
A   B C    A  B    A C 
A B  A B
A B  A B
A  A  B   A  A  B   A
A  A U
A A  
Associative
Laws
Distributive
Laws
De Morgan’s
Laws
Absorption
Laws
Complement
Laws
ICS 253: Discrete Structures I
23
Basic Structures: Sets, Functions, Sequences and Sums
Set Identities Verification
• Prove that A  B  A  B
• Using the definitions
• Using membership tables
24
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
Examples
•
Q16 pp 138: Can we conclude that A = B if
A, B and C are sets such that
1. A  C = B  C ?
2. A  C = B  C ?
3. A  C = B  C and A  C = B  C?
ICS 253: Discrete Structures I
25
Basic Structures: Sets, Functions, Sequences and Sums
Generalized Union and Intersection
• The union of a collection of sets is the set
that contains those elements that are
members of at least one set in the collection.
• The intersection of a collection of sets is the
set that contains those elements that are
members of all the sets in the collection.
26
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
Examples
•
Q29 pp 139: Let Ai be the set of all nonempty bit
strings (i.e. bit strings of length at least one) of
length not exceeding i. Find
n
Ai
1.
i 1
n
2.
Ai
i 1
ICS 253: Discrete Structures I
27
Basic Structures: Sets, Functions, Sequences and Sums
Computer Representation of Sets
• Although sets are unordered, representing the universal
set in a specific order in computers has a lot of
advantages
•
•
U must be finite, with number of elements not exceeding
available memory
The members of U are given an arbitrary order,
i.e. {a1, a2, …, an}
• Any subset A of U is represented with a n-bit string S,
where n=|U|, such that for each element e  U at
position j:
•
•
•
If e  A then
Sj=1
else Sj=0
What is the representation of U and ?
What is the intersection, union, difference?
ICS 253: Discrete Structures I
28
Basic Structures: Sets, Functions, Sequences and Sums
Example
• Q35 (a,c) pp 139: Show how bitwise
operations on bit strings can be used to find
these combinations of A = {a, b, c, d, e},
B={b, c, d, g, p, t, v}, C = {c, e, i, 0, u, x , y, z}
and D = {d, e, h, i, n, o, t, u, x, y}.
a) A  B
c) (A  D)  (B  C)
*) A  B
ICS 253: Discrete Structures I
29
Basic Structures: Sets, Functions, Sequences and Sums
Section 2.3: Functions
•
•
The concept of a function is important in discrete mathematics
• Sequences and strings
• Algorithm efficiency in space and time
• Algorithm development through recursive functions
Let A and B be sets. A function f from A to B is an assignment of
exactly one element of B to each element of A
• f(a) = b
•
•
•
•
•
•
b is the image of a and a is the pre-image of b.
f : A  B (f maps A to B)
A: Domain of f.
B: Codomain of f.
Range of f: Set of all images of elements in A.
Functions are sometimes called mappings or transformations
ICS 253: Discrete Structures I
30
Basic Structures: Sets, Functions, Sequences and Sums
Examples
f ( x)  x  1
ICS 253: Discrete Structures I
31
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q4 pp 153: Find the domain and range of these
functions. Note that in each case, to find the
domain, determine the set of elements assigned
values by the function.
a) the function that assigns to each nonnegative integer
its last digit
b) the function that assigns the next largest integer to a
positive integer
c) the function that assigns to a bit string the number of
one bits in the string
d) the function that assigns to a bit string the number of
bits in the string
ICS 253: Discrete Structures I
32
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• The domain and codomain of functions are
often specified in programming languages.
For instance, the Java statement
int floor(float real) { . . .}
specifies that the domain and range of the
function floor are………………
ICS 253: Discrete Structures I
33
Basic Structures: Sets, Functions, Sequences and Sums
Some Operations on Functions
• Let f1 and f2 be functions from A to ℝ.
Then
• f1 + f2 is a function from A to ℝ.
• f1f2 is a function from A to ℝ.
• Is f1/f2 a function?
• Let f be a function from set A to set B and
let S be a subset of A. The image of S is a
subset of B that consists of the images of
the elements of S, denoted by f(S).
ICS 253: Discrete Structures I
34
Basic Structures: Sets, Functions, Sequences and Sums
Some Functional Properties
• A function f is said to be one-to-one or
injective if and only if f(x)=f(y) implies that
x=y for all x and y in the domain of f. The
function is said to be an injection.
• A function f from A to B is said to be onto or
surjective if and only if for every element
bB there is an element aA with f(a)=b. The
function is said to be a surjection.
• A function f is called a one-to-one
correspondence, or a bijection, if it is both
one-to-one and onto.
ICS 253: Discrete Structures I
35
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q6 and 7 pp 153: Determine whether each of these
functions from {a, b, c, d} to itself is one-to-one or
onto.
a) f(a) = b, f(b) = a, f(c) = c, f(d) = d
b) f(a) = b, f(b) = b, f(c) = d, f(d) = c
c) f(a) = d, f(b) = b, f(c) = c, f(d) = d
• Q8 and 9 pp 153: Determine whether each of these
functions from ℤ to ℤ is one-to-one or onto.
a) f(n) = n – 1
c) f(n) = n3
b) f(n) = n2 + 1
d) f(n) = n/2
ICS 253: Discrete Structures I
36
Basic Structures: Sets, Functions, Sequences and Sums
More Properties
• A function f whose domain and co-domain
are subsets of ℝ is called strictly increasing if
f(x) < f(y) whenever x < y and x and y are in
the domain of f.
• A function f whose domain and co-domain
are subsets of ℝ is called strictly decreasing
if f(x) > f(y) whenever x < y and x and y are
in the domain of f.
37
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
Inverse Functions
• Let f be a 1:1 correspondence from the set A
onto the set B. The inverse function of f,
denoted by f -1, is the function that assigns to an
element b  B the unique element aA such
that f(a)=b.
•
f –1(b)=a when f(a) = b
• Find the inverse
function for each 1:1
correspondence in the
previous slide.
ICS 253: Discrete Structures I
38
Basic Structures: Sets, Functions, Sequences and Sums
Composition of Functions
• Let g be a function from the set A to the set
B and let f be a function from the set B to the
set C. The composition of the functions f and
g, denoted by f  g is defined by
(f  g)(a) = f (g(a))
ICS 253: Discrete Structures I
39
Basic Structures: Sets, Functions, Sequences and Sums
Example
• Q22 pp 154: Find f  g and g  f, where
f(x)=x2 + 1 and g(x)=x + 2, are functions
from ℝ to ℝ.
ICS 253: Discrete Structures I
40
Basic Structures: Sets, Functions, Sequences and Sums
Graphs of Functions
• Let f be a function from the set A to the set
B. The graph of the function f is the set of
ordered pairs {(a,b) | a  A and f(a) = b}
ICS 253: Discrete Structures I
41
Basic Structures: Sets, Functions, Sequences and Sums
Graph of f(n)=1 – n2 from ℤ to ℤ
ICS 253: Discrete Structures I
42
Basic Structures: Sets, Functions, Sequences and Sums
Some Important Functions
• The floor function assigns to the real number x
the largest integer that is less than or equal to x,
denoted by x.
• The ceiling function assigns to the real number
x the smallest integer that is greater than or
equal to x, denoted by x.
• 1/2 =
1/2 =
• -1/2 =
-1/2 =
• The factorial function f: ℕ ℤ+, denoted by f(n)
= n!, is the product of the first n positive
integers, so f(n) = n (n – 1) … (2)(1) and f(0)=1.
ICS 253: Discrete Structures I
43
Basic Structures: Sets, Functions, Sequences and Sums
Graph of f(x)= x for x in ℝ
ICS 253: Discrete Structures I
44
Basic Structures: Sets, Functions, Sequences and Sums
Graph of f(x)= x for x in ℝ
ICS 253: Discrete Structures I
45
Basic Structures: Sets, Functions, Sequences and Sums
Graph of f(x)= x/2 for x in ℝ
ICS 253: Discrete Structures I
46
Basic Structures: Sets, Functions, Sequences and Sums
Useful Properties of the Floor and Ceiling Functions
ICS 253: Discrete Structures I
47
Basic Structures: Sets, Functions, Sequences and Sums
Example
• Prove that  x + n  =  x  + n, where x  ℝ
and n  ℤ
ICS 253: Discrete Structures I
48
Basic Structures: Sets, Functions, Sequences and Sums
Partial Functions
ICS 253: Discrete Structures I
49
Basic Structures: Sets, Functions, Sequences and Sums
Section 2.4: Sequences and Summations
• A sequence is a function from a subset of the
set of integers (usually either the set {0, 1, 2, . .
.} or the set {1, 2, 3, . . .}) to a set S.
• We use the notation an to denote the image of the
integer n.
• We call an a term of the sequence.
• The notation {an} is used to describe the sequence
ICS 253: Discrete Structures I
50
Basic Structures: Sets, Functions, Sequences and Sums
Notation
• A geometric progression is a sequence of the
form
a, ar, ar 2 ,..., ar n ,...
where the initial term a and the common ratio r
are real numbers.
• A geometric progression is a discrete analogue
of the exponential function f (x) = ar x .
ICS 253: Discrete Structures I
51
Basic Structures: Sets, Functions, Sequences and Sums
Notation
• An arithmetic progression is a sequence of
the form
a, a + d, a + 2d, . . . , a + n d, . . .
where the initial term a and the common
difference d are real numbers.
• An arithmetic progression is a discrete
analogue of the linear function ……
ICS 253: Discrete Structures I
52
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• What is the term a8 of the sequence {an} if an
equals
a) 2n – l?
b) 7?
c) 1 + (–1)n ?
d) –(–2)n?
ICS 253: Discrete Structures I
53
Basic Structures: Sets, Functions, Sequences and Sums
Recurrence Relations
• A recurrence relation for the sequence {an} is
an equation that expresses an in terms of one or
more of the previous terms of the sequence,
namely, a0, a1, . . . , an−1, for all integers n with
n ≥ n0, where n0 is a nonnegative integer.
• A sequence is called a solution of a recurrence
relation if its terms satisfy the recurrence
relation.
ICS 253: Discrete Structures I
54
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q6 pp 167: Find the first five terms of the
sequence defined by each of these recurrence
relations and initial conditions.
a) an = 6an – 1, a0 = 2
c) an = an – 1 + 3an – 2, a0 = 1, al = 2
e) an = an – 1 + an – 3, a0 = 1, al = 2, a2 = 0
ICS 253: Discrete Structures I
55
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Q8 pp 167: Show that the sequence {an} is a
solution of the recurrence relation
an = – 3an – 1 + 4an – 2
if
a) an = 0.
b) an = 1.
c) an = (– 4)n.
d) an = 2(– 4)n + 3.
ICS 253: Discrete Structures I
56
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Suppose that a person deposits $10,000 in a
savings account at a bank yielding 11% per
year with interest compounded annually. How
much will be in the account after 30 years?
ICS 253: Discrete Structures I
57
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Find a recurrence relation and give initial
conditions for the number of bit strings of
length n that do not have two consecutive 0s.
How many such bit strings are there of length
five?
ICS 253: Discrete Structures I
58
Basic Structures: Sets, Functions, Sequences and Sums
Sequence Generalization
• The problem is how to generalize a sequence
from its first few terms.
• Examples
•
•
•
•
•
1, 1/2, 1/4, 1/8, 1/16, …
1, 3, 5, 7, 9, …
1, –1, 1, –1 , 1, …
1, 2, 2, 3, 3, 3, 4, 4, 4, 4, …
5, 11, 17, 23, 29, 35, 41, 47, 53, 59, …
ICS 253: Discrete Structures I
59
Basic Structures: Sets, Functions, Sequences and Sums
A Table to Memorize!
nth term
First 10 terms
n2
1, 4, 9, 16, 25, 36, 49, 64, 81, 100, ...
n3
1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, ...
n4
1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, ...
2n
2, 4, 8, 16, 32, 64, 128, 256 , 512, 1024, ...
3n
3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, ...
n!
1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800,...
ICS 253: Discrete Structures I
60
Basic Structures: Sets, Functions, Sequences and Sums
More Examples
• For each of these lists of integers, provide a
simple formula or rule that generates the terms
of an integer sequence that begins with the
given list. Assuming that your formula or rule is
correct, determine the next three terms of the
sequence.
a) 1, 7, 25, 79, 241, 727, 2185, 6559, 19681, 59047,
…
ICS 253: Discrete Structures I
61
Basic Structures: Sets, Functions, Sequences and Sums
b) 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, ...
c) 1, 10, 11, 100, 101, 110, 111, 1000, 1001 , 1010,
1011, . . .
62
ICS 253: Discrete Structures I
Summations
n
a
j m
Basic Structures: Sets, Functions, Sequences and Sums

n
j
a
j m j
all represent

a
m j  n j
am  am1  ...  an
j : index of summation, can be replaced by any arbitrary variable
m: lower limit
n: upper limit
Important rule:
 n   n

ax j  by j    a  x j    b y j 

j m
 j m   j m 
n
ICS 253: Discrete Structures I
63
Basic Structures: Sets, Functions, Sequences and Sums
Examples
• Express the sum of the first 100 terms of the
sequence {an}, where an = 1/n for n = 1, 2, 3, …
2
What
is
the
value
of
the
sum
2
j
•
 j 1
3
7
• What is the value of the sum   1
j 2
j
ICS 253: Discrete Structures I
64
Basic Structures: Sets, Functions, Sequences and Sums
Index Changes in the Summation
n
• Consider the summation  j 2 and assume that
j 1
we want the index to start from 0 to n – 1
rather than 1 to n. How do we change the
index?
ICS 253: Discrete Structures I
65
Basic Structures: Sets, Functions, Sequences and Sums
Theorem 1
• If a and r are real numbers and r  0, then
n 1

ar
a
n

j
ar   r  1

j 0
n  1a

Proof
if r  1
if r  1
66
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
Examples
4
•
3
 ij
i 1 j 1
•

s 2,4,6
s
ICS 253: Discrete Structures I
67
Basic Structures: Sets, Functions, Sequences and Sums
Some Useful Summations
68
ICS 253: Discrete Structures I
Basic Structures: Sets, Functions, Sequences and Sums
More Examples
100
• Find

k2
k  50

n
x
• Let x be a real number with |x|<1. Find 
n 0

k 1
kx
• Find 
k 1
ICS 253: Discrete Structures I
69
Basic Structures: Sets, Functions, Sequences and Sums
More Examples
• For each of these lists of integers, provide a
simple formula or rule that generates the
terms of an integer sequence that begins with
the given list. Assuming that your formula or
rule is correct, determine the next three terms
of the sequence.
3, 6, 11, 18, 27, 38, 51, 66, 83, 102, ...
ICS 253: Discrete Structures I
70
Basic Structures: Sets, Functions, Sequences and Sums
Cardinality
• Definition: The sets A and B have the same
cardinality if and only if there is a one-to-one
correspondence from A to B.
• Definition: A set that is either finite or has the
same cardinality as the set of positive integers is
called countable. A set that is not countable is
called uncountable. When an infinite set S is
countable, we denote the cardinality of S by 0
(where 0 is aleph, the first letter of the Hebrew
alphabet). We write |S| = 0 and say that S has
cardinality "aleph null."
ICS 253: Discrete Structures I
71
Basic Structures: Sets, Functions, Sequences and Sums
Cardinality
• Question: What do we need to do to find
whether a set is countable or not?
• Example 1: Show that the set of odd positive
integers is a countable set.
ICS 253: Discrete Structures I
72
Basic Structures: Sets, Functions, Sequences and Sums
Cardinality
• Example 2: Show that the set of all integers is
countable.
ICS 253: Discrete Structures I
73
Basic Structures: Sets, Functions, Sequences and Sums
Cardinality
• Example 3: Show that the set of positive
rational numbers is countable.
ICS 253: Discrete Structures I
74
Basic Structures: Sets, Functions, Sequences and Sums
Cardinality
• Example 4: Show that the set of real numbers
is an uncountable set.
ICS 253: Discrete Structures I
75
Basic Structures: Sets, Functions, Sequences and Sums
Reading
• Hilbert’s Grand Hotel