
- Automata Theory - Applications
- Automata Terminology
- Basics of String in Automata
- Set Theory for Automata
- Finite Sets and Infinite Sets
- Algebraic Operations on Sets
- Relations Sets in Automata Theory
- Graph and Tree in Automata Theory
- Transition Table in Automata
- What is Queue Automata?
- Compound Finite Automata
- Complementation Process in DFA
- Closure Properties in Automata
- Concatenation Process in DFA
- Language and Grammars
- Language and Grammar
- Grammars in Theory of Computation
- Language Generated by a Grammar
- Chomsky Classification of Grammars
- Context-Sensitive Languages
- Finite Automata
- What is Finite Automata?
- Finite Automata Types
- Applications of Finite Automata
- Limitations of Finite Automata
- Two-way Deterministic Finite Automata
- Deterministic Finite Automaton (DFA)
- Non-deterministic Finite Automaton (NFA)
- NDFA to DFA Conversion
- Equivalence of NFA and DFA
- Dead State in Finite Automata
- Minimization of DFA
- Automata Moore Machine
- Automata Mealy Machine
- Moore vs Mealy Machines
- Moore to Mealy Machine
- Mealy to Moore Machine
- Myhill–Nerode Theorem
- Mealy Machine for 1’s Complement
- Finite Automata Exercises
- Complement of DFA
- Regular Expressions
- Regular Expression in Automata
- Regular Expression Identities
- Applications of Regular Expression
- Regular Expressions vs Regular Grammar
- Kleene Closure in Automata
- Arden’s Theorem in Automata
- Convert Regular Expression to Finite Automata
- Conversion of Regular Expression to DFA
- Equivalence of Two Finite Automata
- Equivalence of Two Regular Expressions
- Convert Regular Expression to Regular Grammar
- Convert Regular Grammar to Finite Automata
- Pumping Lemma in Theory of Computation
- Pumping Lemma for Regular Grammar
- Pumping Lemma for Regular Expression
- Pumping Lemma for Regular Languages
- Applications of Pumping Lemma
- Closure Properties of Regular Set
- Closure Properties of Regular Language
- Decision Problems for Regular Languages
- Decision Problems for Automata and Grammars
- Conversion of Epsilon-NFA to DFA
- Regular Sets in Theory of Computation
- Context-Free Grammars
- Context-Free Grammars (CFG)
- Derivation Tree
- Parse Tree
- Ambiguity in Context-Free Grammar
- CFG vs Regular Grammar
- Applications of Context-Free Grammar
- Left Recursion and Left Factoring
- Closure Properties of Context Free Languages
- Simplifying Context Free Grammars
- Removal of Useless Symbols in CFG
- Removal Unit Production in CFG
- Removal of Null Productions in CFG
- Linear Grammar
- Chomsky Normal Form (CNF)
- Greibach Normal Form (GNF)
- Pumping Lemma for Context-Free Grammars
- Decision Problems of CFG
- Pushdown Automata
- Pushdown Automata (PDA)
- Pushdown Automata Acceptance
- Deterministic Pushdown Automata
- Non-deterministic Pushdown Automata
- Construction of PDA from CFG
- CFG Equivalent to PDA Conversion
- Pushdown Automata Graphical Notation
- Pushdown Automata and Parsing
- Two-stack Pushdown Automata
- Turing Machines
- Basics of Turing Machine (TM)
- Representation of Turing Machine
- Examples of Turing Machine
- Turing Machine Accepted Languages
- Variations of Turing Machine
- Multi-tape Turing Machine
- Multi-head Turing Machine
- Multitrack Turing Machine
- Non-Deterministic Turing Machine
- Semi-Infinite Tape Turing Machine
- K-dimensional Turing Machine
- Enumerator Turing Machine
- Universal Turing Machine
- Restricted Turing Machine
- Convert Regular Expression to Turing Machine
- Two-stack PDA and Turing Machine
- Turing Machine as Integer Function
- Post–Turing Machine
- Turing Machine for Addition
- Turing Machine for Copying Data
- Turing Machine as Comparator
- Turing Machine for Multiplication
- Turing Machine for Subtraction
- Modifications to Standard Turing Machine
- Linear-Bounded Automata (LBA)
- Church's Thesis for Turing Machine
- Recursively Enumerable Language
- Computability & Undecidability
- Turing Language Decidability
- Undecidable Languages
- Turing Machine and Grammar
- Kuroda Normal Form
- Converting Grammar to Kuroda Normal Form
- Decidability
- Undecidability
- Reducibility
- Halting Problem
- Turing Machine Halting Problem
- Rice's Theorem in Theory of Computation
- Post’s Correspondence Problem (PCP)
- Types of Functions
- Recursive Functions
- Injective Functions
- Surjective Function
- Bijective Function
- Partial Recursive Function
- Total Recursive Function
- Primitive Recursive Function
- μ Recursive Function
- Ackermann’s Function
- Russell’s Paradox
- Gödel Numbering
- Recursive Enumerations
- Kleene's Theorem
- Kleene's Recursion Theorem
- Advanced Concepts
- Matrix Grammars
- Probabilistic Finite Automata
- Cellular Automata
- Reduction of CFG
- Reduction Theorem
- Regular expression to ∈-NFA
- Quotient Operation
- Parikh’s Theorem
- Ladner’s Theorem
Surjective Function in Automata Theory
What is a Surjective Function?
Consider there are two sets A and B, A is the domain and B is the codomain. A surjective function, also known as onto function, is a type of function where every element of the codomain (Set B) is mapped by at least one element from the domain (Set A).
In simple terms, a function is onto if all elements of Set B have a corresponding element in Set A.

Formally we can say a function f from Set A to Set B is said to be onto if each element of Set B is mapped by at least one element of Set A.
Note − In an Onto Function, no element of Set B is left out. Every element in Set B has a pre-image in Set A.
Visualizing Onto Function
Consider the following example to understand the concept better −
- Set A contains the elements {1, 2, 3, 4}
- Set B contains the elements {a, b, c, d}
We map the elements as shown in this figure −

In this case, each element of Set B (a, b, c) is mapped by some element of Set A, but d is not pre-image of any element in A. So, this is not an onto function.
Key Concepts: Image and Pre-Image
To fully understand onto functions, it's essential to get the concepts of image and pre-image.
- The image of an element in Set A under the function f is the corresponding element in Set B. For example − If 1 maps to a, then a is the image of 1.
- The pre-image is the element in Set A that maps to an element in Set B. For example − If a is the image of 1, then 1 is the pre-image of a.
Let's look at an example to understand the concept of Image and Pre-Image.
- Set A = {1, 2, 3, 4}
- Set B = {a, b, c, d}

If we map as shown in the figure −
- Image of 1 is a,
- Pre-image of a is 1,
- Pre-image of d is 4.
If every element in Set B has a pre-image, then the function is onto.
Criteria for Surjectivity
For a function to be surjective, it must satisfy this criteria −
- Every element in Set B must have at least one pre-image in Set A.
- No element in Set B should be left unmapped. If even one element in Set B does not have a pre-image in Set A, the function is not onto.
Necessary Condition: Size of Sets
If we are considering whether a function from Set A to Set B can be onto, the following condition must hold −
- The number of elements in Set A must be greater than or equal to the number of elements in Set B.
- This is a necessary condition, but it is not sufficient on its own. Even if Set A has more elements than Set B, we need to ensure that all elements in Set B are actually mapped by elements in Set A.
Example − If Set A has 4 elements and Set B has 3 elements, we might think the function could be onto. But if one element in Set B does not get mapped, then the function is not onto.
Example: Checking If a Function Is Onto
Let us see the previous image −
- Set A = {1, 2, 3, 4}
- Set B = {a, b, c, d}

Then, this function is onto because every element of Set B has a pre-image in Set A. However, if we map −

Then this function is not onto because d in Set B has no pre-image in Set A. According to the definition, this function fails to be onto.
Surjective Functions and Range
Let us see important characteristic of onto functions is the relationship between the range and the codomain.
Range and Codomain
For an onto function, the range is equal to the codomain. In other words, all elements in the codomain must be part of the range.
- The range of a function is the set of all images of elements in Set A.
- The codomain is the set B where the function maps elements from Set A.
Into Function: A Contrast
The into function is the opposite of onto function. In an into function −
- The range is a proper subset of the codomain.
- Not all elements in the codomain are mapped by elements from the domain.
Example of Into Function
If we have, Set A = {1, 2, 3, 4} and Set B = {a, b, c, d} and map −

Then, d in Set B has no pre-image in Set A. The function is not onto but is an into function because the range (a, b, c) is a proper subset of the codomain (a, b, c, d).
Real-World Examples of Surjective Function
Take a look at the following real-world examples of surjective functions −
Example 1: Mathematical Function
Consider the function f(x) = 2x + 1 with domain and codomain as real numbers. For every real number y, there exists a corresponding real number x such that y = 2x + 1. Therefore, this function is onto.
Example 2: Non-Onto Function
Consider f(x) = 2x + 1 where the domain is the set of natural numbers, and the codomain is the set of real numbers. If we pick a real number like 0.5, there is no natural number x such that 2x + 1 equals 0.5. Therefore, this function is not onto.
Conclusion
In this chapter, we covered surjective functions, mainly focusing on their definition, key characteristics, and the difference between onto and into functions. We presented a set of examples to illustrate these concepts clearly. Proceed to the next chapter to learn the concept of bijective functions.