WHAT IS FUNCTIONIN DISCRETE STRUCTURES?
● In Discrete Structures 1, a function is a special kind of relation that connects
elements from one set to another in a precise way.
● A function from set A to set B (written as 𝑓 : A→B) is a relation that assigns
exactly one element of B to each element of A.
EXAMPLE:
f={(1,a),(2,b),(3,c)},
then f isa function because each element in A has only one corresponding
element in B.
But if
g={(1,a),(1,b),(2,c)},
then g is not a function, because 1 is assigned to both a and b.
5.
Terminology:
● Domain →the set of all possible inputs (e.g., A)
● Codomain → the set that contains all possible
outputs (e.g., B)
● Range → the set of actual outputs (subset of
codomain)
Types of Functions:
●One-to-one (Injective): No two elements in A map to the
same element in B.
● Onto (Surjective): Every element in B is mapped by
some element in A.
● Bijective: Both one-to-one and onto — perfect pairing.
1. One-to-One Function(Injective)
A function is one-to-one if each element in the domain maps to a unique element
in the codomain.
No two different inputs have the same output.
11.
2. Onto Function(Surjective)
A function is onto if every element of the codomain has at least one pre-image in
the domain.
In other words, the range = codomain.
12.
3. Inverse Function
Afunction has an inverse if and only if it is both one-to-one and onto (bijective).
The inverse “reverses” the direction of mapping — it swaps domain and codomain.
13.
Summary Table
Type MeaningExample Condition
One-to-One
(Injective)
Each input →
unique output
1→a, 2→b, 3→c No two x map to
same y
Onto (Surjective) Every output has an
input
1→a, 2→b, 3→c Range = Codomain
Inverse (Bijective) Reversible function f⁻¹ exists Must be both
one-to-one and onto
14.
What is Composition
InDiscrete Structures 1, composition of functions means applying one function
after another.
If you have two functions:
● f:A→B
● g:B→C