02-Basic Structures
02-Basic Structures
Basic Structures
Sets, Functions
Sequences, and Sums
Objectives
Sets
Setoperations
Functions
Sequences
Summations
2.1- Sets
An unordered collection of objects
The objects in a set are called the elements, or
members. A set is said to contain its elements.
Some important sets in discrete mathematics
N = { 0,1,2,3,4,… }
Z = { … , -2,-1,0,1,2,…} Z+ = {0,1,2,…}
R: the set of real numbers G. Cantor
p
r p , 0 q
q
V a, u , o, i, e
SETS
Definitions:
Finite set: Set has n elements, n is a nonnegative integer
A set is an infinite set if it is not finite
Cardinality of a set |S|: Number of elements of S
: empty set (null set), the set with no element
Two sets are equal they have the same elements
A = B if and only if x (xA x B)
A B: the set A is a subset of the set B
A B if and only if x (xA x B)
A B: A is a proper subset of B
A B if and only if (A B) ^ (A ≠ B) Venn diagram shows that A
is a subset of B
2.2- Set Operations
The Union of sets A and B, denoted by A B
A B x x A x B
The difference of A and B, denoted by A-B
A-B= x x A x B
The symmetric difference of A and B, denoted by A B
A B=A B-A B= x ( x A x B ) ( x A B)
Inter sec tion : A B x x A x B
U is the universal set, complement of A is denoted by A
A=U-A= x x A
Set Identities
Identity – See proofs : pages 125, 126 Name
{Ø,
{1}, {2},{3},
{1,2}, {1,3},{2,3},
{1,2,3}}.
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, …, and an as its nth element.
Let A and B be sets. The Cartesian product of A and B,
denoted by AxB,
A B a, b a A, b B
For example
A= a, b B= 1, 2, 3
A B a,1, a, 2 , a,3 , b,1, b, 2 , b, 3
Cartesian Products…
AxBxC= {(a,1,0),(a,1,1),(a,2,0),(a,2,1),(a,3,0),(a,3,1),
(b,1,0),(b,1,1),(b,2,0),(b,2,1),(b,3,0),(b,3,1) }
Computer Representation of Sets
f is not one-to-one
(we have f(-1) = f(1))
Onto Functions – Ánh xạ lên
( toàn ánh)
A function f from A to B is called onto, or
surjective, iff
for every element b in B there is an element
a in A with f(a)=b.
f: → , f(m) =m-1
Example:
f: →, f(x)=x+1
g:→, g(x)= x2
(fg)(x)= f(g(x))= f(x2) = x2+1
(gf)(x) = g(f(x)) = g(x+1)= (x+1)2
2.4- Sequences
j m
a : Sequence
j : Index of summation // 1 + 2 +3+4+…+n
m: Lower limit long sum1 ( int n) // n additions
{ long S=0;
n : Upper limit for (int i=1; i<=n; i++) S+= i;
return S;
}
// 1 addition, 1 multiplication, 1 division
long sum2 (int n)
{ return ((long)n) * (n+1)/2;
}
{0, 2, 4, …, } 0א
Hence,
Summary
Sets
Setoperations
Functions
Sequences
Summations