Lecture 1.2
Lecture 1.2
Unit 1 : Mathematical
Preliminaries
Topics to be covered
• Sets
• Functions
• Relations
2
SETS
A set is a collection of elements
A {1, 2, 3}
B {train, bus, bicycle, airplane}
We write
1 A
ship B
3
Set Representations
C = { a, b, c, d, e, f, g, h, i, j, k }
C = { a, b, …, k } finite set
S = { 2, 4, 6, … } infinite set
U = { 1 , … , 10 }
5
Set Operations
A = { 1, 2, 3 } B = { 2, 3, 4, 5}
A B
• Union 1
2 4
3 5
A U B = { 1, 2, 3, 4, 5 }
• Intersection
U
2
A B = { 2, 3 } 3
• Difference
A-B={1} 1
B - A = { 4, 5 }
Venn diagrams
6
• Complement
Universal set = {1, …, 7}
A = { 1, 2, 3 } A = { 4, 5, 6, 7}
4
A
A 3 6
1
2
5 7
A=A
7
{ even integers } = { odd
integers }
Integers
1 odd
even 5
2 6
0
4
3 7
8
DeMorgan’s Laws
U
AUB=A B
U
A B=AUB
9
Empty, Null
Set:
={}
SU =S
U
S = = Universal Set
S- =S
-S=
10
Subset
A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 }
A B
U
Proper Subset: A B
U
B
A
11
Disjoint Sets
A = { 1, 2, 3 } B = { 5, 6}
U
A B=
A B
12
Set Cardinality
• For finite sets
A = { 2, 5, 7 }
|A| = 3
(set size)
13
Powersets
S = { a, b, c }
={ , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c
Observation: | 2S | = 2|S| ( 8 = 23 )
14
Cartesian Product
A = { 2, 4 } B = { 2, 3, 5 }
A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) }
|A X B| = |A| |B|
AXBX…XZ
15
FUNCTIONS
domain range
4 A B
f(1) = a a
1
2 b
3 c
5
f : A -> B
If A = domain
then f is a total function
otherwise f is a partial function
16
RELATIONS
R = {(x1, y1), (x2, y2), (x3, y3), …}
xi R y i
17
Equivalence Relations
• Reflexive: xRx
• Symmetric: xRy yRx
• Transitive: x R y and y R z x
Rz
Example: R = ‘=‘
•x=x
•x=y y=x
• x = y and y = z x=z
18
Equivalence Classes
For equivalence relation R
equivalence class of x = {y : x R y}
Example:
R = { (1, 1), (2, 2), (1, 2), (2, 1),
(3, 3), (4, 4), (3, 4), (4, 3) }
Any Query
20