Hello! Welcome to the third lesson in our course on finite state machines.
In the previous lesson, we took our first step into the formal world of automata theory by learning to identify the five components of a Deterministic Finite Automaton (DFA): the set of states (), the alphabet (), the transition function (), the start state (), and the set of accept states ().
Today, we will take the next logical step. Our goal is to consolidate this knowledge and learn how to express a complete DFA using its formal 5-tuple definition. While a state diagram is an excellent visual tool, the 5-tuple is the precise, unambiguous mathematical description. As a mathematics student, you'll find this formalism is what allows us to reason about these machines with rigor.
From Identification to Formal Expression
In the last lesson, we pulled the five components out of a diagram. Now, we'll learn how to package them into a single, formal statement: . This formal definition is essential—it's what you would provide to a computer program or use as the basis for a mathematical proof.
To see this process in action, let's watch a detailed walkthrough.
How do we formally define a DFA?
This video from the Easy Theory channel provides an excellent, detailed walkthrough of how to formally define a DFA. It explains why a formal definition is necessary and then constructs one, component by component, for a specific example.
Watch from 03:00 to 14:25. Pay close attention to how each of the five components is specified. In particular, notice how a 'transition table' is introduced as a compact and formal way to represent the transition function, δ.
Anatomy of the 5-Tuple
The video did a great job of constructing the formal definition from a diagram. Let's crystallize what we saw. For the DFA in the video, the full 5-tuple definition is written as:
Where:
-
- This is the finite set of all states, which you identify from the circles in the diagram.
-
- This is the finite set of input symbols, identified from the labels on the transition arrows.
-
- This is the designated start state, a single element from .
-
- This is the set of accept states, a subset of .
-
- This is the transition function. As the video highlighted, the most common and clearest way to formally define is with a transition table. The table is a direct representation of the function . For each state (row) and input symbol (column), the table entry gives the resulting state.
| 0 | 1 | |
|---|---|---|
(Note: The arrow denotes the start state, and the asterisk denotes an accept state. This is a common convention when presenting transition tables.)
By defining these five parts, we have a complete, formal specification of the machine.
An Alternative View and Example
The transition table is a great way to define . Another way, which you might see in more theoretical texts, is to simply list all the input-output pairs of the function. Let's look at a resource that uses this style.
Lecture 3 - Finite Automata - CS 360 Course Notes
For a concise, text-based summary and another example, let's look at these course notes from the University of Waterloo. They provide the formal definition and then immediately apply it to a DFA that checks if a binary string has an odd number of 1s (odd parity).
Read the sections 'Formally, a deterministic finite automaton...' and 'As an example...'. Notice how the transition function δ is defined by explicitly listing each mapping, such as δ(q₀, 0) = q₀. This is an alternative to using a transition table.
In the parity-checker example from the notes, the transition function was defined as:
This list fully defines the function . For a machine with many states and a large alphabet, a transition table is generally more readable, but both methods are valid ways to express the function.
Your Turn: Formalize a DFA
Now it's time to put this into practice. Your task is to provide the complete 5-tuple definition for the DFA shown in the diagram below.

Please write out the full formal definition .
- Define the set of states, .
- Define the alphabet, .
- Identify the start state, .
- Define the set of accept states, .
- Define the transition function, , using a transition table.
Take a few minutes to write this down. Once you're ready, you can check your answer against the solution below.
Click here to see the solution
Here is the formal 5-tuple definition for the DFA in the image.
, where:
- States:
- Alphabet:
- Start State:
- Accept States:
- Transition Function ():
| 0 | 1 | |
|---|---|---|
| 0 | 1 | |
| 1 | 2 | 0 |
| 2 | 1 | 2 |
Conclusion
In this lesson, we solidified your understanding of the formal definition of a DFA. You learned how to take the components identified in a state diagram and express them as a complete and unambiguous 5-tuple, .
Key Takeaways:
- A DFA is formally specified by its 5-tuple. This definition is precise and forms the basis for all theoretical analysis.
- The transition function can be defined by listing all its mappings, but is most clearly and compactly represented by a transition table.
- Expressing a DFA formally involves defining each of the five components correctly using mathematical notation (e.g., sets for , , and ).
Now that we have a solid grip on how to define a DFA, we are ready to see it in action. In the next lesson, we will trace the computation of a DFA on an input string. This will allow us to determine precisely whether a given string is accepted or rejected by the machine.