Advanced Algorithms
Lecture Outline
January 05, 2011
Counting
Counting is a part of combinatorics, an area of mathematics which is concerned with the
arrangement of objects of a set into patterns that satisfy certain constraints. We will mainly
be interested in the number of ways of obtaining an arrangement, if it exists.
Before we delve into the subject, let’s take a small detour and understand what a
set
is.
Below are some relevant deFnitions.
•
A
set
is an
unordered
collection of objects. The objects of a set are sometimes referred
to as its elements or members. If a set is Fnite and not too large it can be described
by listing out all its elements, e.g.,
{
a,e,i,o,u
}
is the set of vowels in the English
alphabet. Note that the order in which the elements are listed is not important.
Hence,
{
a,e,i,o,u
}
is the same set as
{
i,a,o,u,e
}
. If
V
denotes the set of vowels
then we say that
e
belongs to the set
V
, denoted by
e
∈
V
or
e
∈ {
a,e,i,o,u
}
.
•
Two sets are
equal
if and only if they have the same elements.
•
The
cardinality
of
S
, denoted by

S

, is the number of distinct elements in
S
.
•
A set
A
is said to be a
subset
of
B
if and only if every element of
A
is also an element
of
B
. We use the notation
A
⊆
B
to denote that
A
is a subset of the set
B
, e.g.,
{
a,u
} ⊆ {
a,e,i,o,u
}
. Note that for any set
S
, the empty set
{}
=
∅ ⊆
S
and
S
⊆
S
.
If
A
⊆
B
and
A
n
=
B
the we say that
A
is a
proper subset
of
B
; we denote this by
A
⊂
B
. In other words,
A
is a proper subset of
B
if
A
⊆
B
and there is an element
in
B
that does not belong to
A
.
•
A
power set
of a set
S
, denoted by
P
(
S
), is a set of all possible subsets of
S
. ±or
example, if
S
=
{
1
,
2
,
3
}
then
P
(
S
) =
{∅
,
{
1
}
,
{
2
}
,
{
3
}
,
{
1
,
2
}
,
{
2
,
3
}
,
{
1
,
3
}
,
{
1
,
2
,
3
}}
.
In this example

P
(
S
)

= 8.
•
Another way to describe a set is by explicitly stating the properties that all members
of the set must have. ±or instance, the set of all positive even numbers less than 100
can be written as
{
x

x
is a positive integer less than 100
}
.
•
Some of the commonly used sets in discrete mathematics are:
N
=
{
0
,
1
,
2
,
3
,...
}
,
Z
=
{
... ,
−
2
,
−
1
,
0
,
1
,
2
,...
}
,
Q
=
{
p/q

p
∈
Z
and
q
∈
Z
,and
q
n
= 0
}
, and
R
is the
set of real numbers.
Understanding the above terminology related to sets is enough to get us started on counting.
Theorem.
If
m
and
n
are integers and
m
≤
n
, then there are
n
−
m
+ 1 integers from
m
to
n
inclusive.