DISCRETE STRUCTURES
(FUNCTION)
MARIO B. CADAY, MSIT
Instructor I
WHAT IS FUNCTION IN 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:
Let
A={1,2,3}
B={a,b,c}
If
f={(1,a),(2,b),(3,c)},
then f is a function because each element in A has only one corresponding
element in B.
EXAMPLE:
f={(1,a),(2,b),(3,c)},
then f is a 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.
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)
Notation:
If f(x)=y
then x is the input and y is the output.
We say “f maps x to y.”
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.
What is one-to-one, onto, and inverse,
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.
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.
3. Inverse Function
A function 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.
Summary Table
Type Meaning Example 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
What is Composition
In Discrete Structures 1, composition of functions means applying one function
after another.
If you have two functions:
● f:A→B
● g:B→C
Example
In SET Notation
Key Idea
More Example:
RESULT:
Step by Step Computation
Step by Step Computation Cont…
Step by Step Computation Cont…
END
ANY QUESTION?

CSC102: DISCRETE STRUCTURES (FUNCTIONS) - Module

  • 1.
  • 2.
    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.
  • 3.
    EXAMPLE: Let A={1,2,3} B={a,b,c} If f={(1,a),(2,b),(3,c)}, then f isa function because each element in A has only one corresponding element in B.
  • 4.
    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)
  • 6.
    Notation: If f(x)=y then xis the input and y is the output. We say “f maps x to y.”
  • 7.
    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.
  • 9.
    What is one-to-one,onto, and inverse,
  • 10.
    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
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
    Step by StepComputation
  • 20.
    Step by StepComputation Cont…
  • 21.
    Step by StepComputation Cont…
  • 22.
  • 23.