3.2 Functions
3.2 Functions
Discrete Mathematics
3.2- Functions
Course Teacher:
Shoeb Mohammad Shahriar
Assistant Professor, Department of CSE, AUST
Functions [Basics]
• A function, f from a set A to a set B associates or assigns exactly one
element b ∈ B to each and every element a ∈ A.
• f is a function from A to B if it is a binary relation defined in the following
way:
f = {(a,b) | a ∈ A ∧ b ∈ B ∧ there exists exactly one b ∈ B, a ∈ A}
1-2
CSE1203: Discrete Mathematics
Functions [Basics] (Cont.)
• Explanation:
▪ b – the image of a.
a b ▪ a – a preimage of b.
▪ A – the domain of f.
A B ▪ B – the co-domain of f.
f ▪ Range of f : {x | x ∈ B and x is an image of some element of A}
1-3
CSE1203: Discrete Mathematics
Functions [Basics] (Cont.)
• Examples-
1) Idealized/ Abstract:
a
1
b
2 ▪ A – the domain of f.
c ▪ B – the co-domain of f.
3
d ▪ Range of f : {a, b, e }
4
e
A B
f
1-4
CSE1203: Discrete Mathematics
Functions [Basics] (Cont.)
• Examples-
2)
A ▪ S1 – Student
1 ▪ S2 – Grades obtained in a Course
B ▪ S1 – the domain of f.
2
C ▪ S2 – the co-domain of f.
3
D ▪ Range of f : {A, C, D }
4 ▪
E f : S1 → S2 It means D is a value
▪ f(1) = D of 1 or, D is the
S1 S2 ▪ f(2) = A ……….. image of 1;
f 1 is a preimage of D
1-5
CSE1203: Discrete Mathematics
Functions [Basics] (Cont.)
• Examples-
3) f(x) = x2 on Z [from Z to Z]
▪ Domain = Co-domain = Z
▪ Range of f : {x | x ∈ Z ^ x = y2, for y ∈ Z }
1-6
CSE1203: Discrete Mathematics
Functions [Basics] (Cont.)
• Not Examples-
a 1 x
b 2 a y
c 3 b z
d 4 c w
c excluded b has multiple images
1-7
CSE1203: Discrete Mathematics
Functions [Basics] (Cont.)
• Not Examples-