Professional Documents
Culture Documents
02-Basic Structures
02-Basic Structures
Basic Structures
Sets, Functions
Sequences, and Sums
Objectives
⚫ Sets
⚫ Set operations
⚫ 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
p G. Cantor
Q = r = p Z , 0 q Z
q
V = a, u, o, i, e
aA : a is an element of the set A // a belongs to A
aA: a is not an element of A
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
Venn diagram shows that A
A B if and only if (A B) ^ (A ≠ B) is a subset of B
Theorem 1
For every set S ,
i) S ii) S S
Pr oof
i ) (x ) False
So x ( x → x S ) True
ii) x ( x S → x S ) True
Power Sets
A1 A2 ... An = ( a1 , a2 ,..., an ) ai Ai , i = 1, n
For example
A= a, b B= 1, 2,3 , C = 0,1
⚫ 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) }
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
A = A A U = A Identity laws
A U= U A = Domination laws
A A=A AA=A Idempotent laws
A= A Complementation law
AB = B A AB=B A Commutative laws
A (B C) = (A B) C A (B C)= (A Associative laws
B) C
A (B C) = (A B) (A C) Distributive laws
A (B C) = (A B) (A C)
A B =A B A B = A B De Morgan laws
A (A B) = A A (AB) = A Absorption
A A =U A A = Complement laws
Generalized Unions and Intersections
Ai = x x Ai , i = 1, 2,..., n
n
A1 A2 A3 ... An =
i =1
n
A1 A2 A3 ... An = Ai
i =1
= x x A1 x A2 x A3 ... x An
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
// 1 + 2 +3+4+…+n
a : Sequence long sum1 ( int n) // n additions
j : Index of summation { long S=0;
for (int i=1; i<=n; i++) S+= i;
m: Lower limit
return S;
n : Upper limit }
// 1 addition, 1 multiplication, 1 division
long sum2 (int n)
{ return ((long)n) * (n+1)/2;
}