Hello! Welcome back to our course on finite state machines.
In our last lesson, we developed an intuition for finite automata by looking at real-world systems like turnstiles and vending machines. We informally identified their key parts: states, inputs, transitions, a start state, and sometimes a final or "accept" state.
Today, we will build directly on that foundation. Our goal is to formalize these concepts by learning the precise mathematical definition of a specific type of automaton called a Deterministic Finite Automaton (DFA). By the end of this lesson, you will be able to identify the five components of a DFA—states, alphabet, transition function, start state, and accept states—from a visual diagram and express them using formal notation. This formal precision is the bedrock upon which all analysis and design of these machines are built.
From a Problem to a Formal Machine
Let's start with an example that bridges our informal understanding with the formal definition. In the previous lesson, we saw machines that responded to discrete events like 'coin inserted'. Now, let's consider a machine that processes a string of data.
Regular Languages: Deterministic Finite Automaton (DFA)
This video from the 'lydia' channel constructs a DFA to detect a heatwave from a sequence of weather data. It's a great example of how we can model a simple pattern-matching problem. Notice how it builds the state diagram first and then introduces the formal components.
Please watch from 00:11 to 05:26. Pay close attention to how the informal ideas of states ('q0', 'q1', 'q2'), inputs ('0' for a normal day, '1' for a hot day), start state, and accept state are translated into a formal 'five-tuple' definition at the end.
The video did an excellent job of showing the complete process: starting with a problem, creating an intuitive state diagram, and then abstracting that diagram into a formal mathematical object. This formal object is called a 5-tuple.
The Formal Definition of a DFA
As a mathematics student, you'll appreciate that to work with these machines rigorously, we need a precise definition. A Deterministic Finite Automaton (DFA) is formally defined as a 5-tuple .
Let's break down each component.
Lecture 3 - Finite Automata - CS 360 Course Notes
This PDF from a University of Waterloo course gives a concise, formal definition of each component of the 5-tuple. It's a great reference that clearly lays out the mathematical notation.
Read the first paragraph of the document, which formally defines a DFA and lists its five components.
As the resource explains, the five components are:
-
: A finite set of states. These are the nodes in the state diagram. In the heatwave example, . The requirement that this set be finite is what gives the automaton its name.
-
(Sigma): A finite set called the alphabet. This defines all the possible input symbols the machine can read. For the heatwave DFA, the alphabet was .
-
(delta): The transition function. This function is the "program" or the "wiring" of the machine. It dictates where to go next.
- Its signature is .
- This means it takes two arguments: the current state (an element from ) and the current input symbol (an element from ).
- It returns a single state (an element from ) as the result.
- The fact that it returns exactly one state is why this automaton is deterministic. There is no ambiguity about the next state.
-
: The start state. This is the state the machine is in before it has processed any input. It must be one of the states in (i.e., ).
-
: The set of accept states (or final states). This is a subset of the total set of states (). If the machine finishes processing its input string and is in one of these states, the string is "accepted." Otherwise, it is "rejected." A DFA can have zero, one, or multiple accept states.
Identifying the 5-Tuple from a State Diagram
Now that we have the formal definition, let's practice extracting it from a state diagram. This is a fundamental skill.
Deterministic Finite State Machines - Theory of Computation
This video from TrevTutor provides a very clear, step-by-step walkthrough of identifying the five components from a diagram. He methodically fills out each part of the 5-tuple.
Watch from 03:04 to 09:13. Observe how he identifies the states, alphabet, start state, and final states, and then carefully constructs the transition function, \delta.
This process of translating the visual diagram into its formal 5-tuple definition is central to the theory of computation. It allows us to move from an intuitive picture to an object we can reason about mathematically.
Let's practice this ourselves. Consider the following state diagram for a DFA:

Our task is to identify the 5-tuple for this machine.
-
1. States (Q): We find the set of states by listing all the circles in the diagram.
-
2. Alphabet (): We find the alphabet by collecting all the unique symbols on the transition arrows.
-
3. Start State (): The start state is indicated by the arrow labeled "start".
-
4. Accept States (F): Accept states are marked with a double circle. In this case, there is only one.
-
5. Transition Function (): This is the most detailed part. We list where each state goes for each symbol in the alphabet.
And that's it! We have successfully identified all five components and formally described the machine. The state is often called a "trap state" or "sink state" because once entered, it's impossible to leave.
Conclusion
In this lesson, we transitioned from an informal, example-based understanding of finite automata to the precise, mathematical definition of a Deterministic Finite Automaton. You learned how to define a DFA as a 5-tuple and, most importantly, how to identify each of its components from a standard state diagram.
Key Takeaways:
- A DFA is formally defined by five components: .
- Q is the finite set of states.
- is the finite alphabet of input symbols.
- is the transition function, which uniquely determines the next state from a given state and input symbol ().
- is the single start state.
- is the set of accept states, which can be empty.
With this formal definition in hand, we are now equipped to analyze the behavior of these machines precisely.
In our next lesson, we will put this structure to use. We will learn how to trace the computation of a DFA on an input string to determine whether the machine accepts or rejects it. This will show us how the machine "runs" and processes information.