Finite automata are abstract machines used to recognize patterns in input sequences and form the basis for understanding regular languages in computer science.
- A finite automaton consists of states, transitions, and input symbols. It processes an input string one symbol at a time.
- If the machine ends in an accepting state after processing the entire input string, the string is accepted; otherwise, it is rejected.
- Finite automata are classified into deterministic finite automata (DFA) and non-deterministic finite automata (NFA), both of which recognize the same class of regular languages.
- They are widely used in text processing, compiler design, and pattern matching.
Features of Finite Automata

- Input: A sequence of symbols from the input alphabet provided to the machine.
- Acceptance: The machine accepts or rejects an input string based on its final state after processing the entire string.
- States: A finite set of states representing the possible configurations of the machine.
- Transitions: Define how the machine moves from one state to another based on the input symbols.
- Transition Function: Defines the next state or set of possible next states for a given current state and input symbol.
Formal Definition of Finite Automata
A finite automaton is formally defined as a five-tuple:
M = (Q, Σ, δ, q₀, F)
- Q: A finite set of states.
- Σ: A finite set of input symbols, called the input alphabet.
- δ: The transition function that defines state transitions.
- q₀: The initial state, where q₀ ∈ Q.
- F: A set of accepting (final) states, where F ⊆ Q.
Types of Finite Automata
1. Deterministic Finite Automata (DFA)
A Deterministic Finite Automaton (DFA) is a finite automaton in which every state has a unique transition for every input symbol (
Example: Construct a DFA that accepts all strings ending with 'a'.
Given:
- Σ = {a, b},
- Q = {q0, q1},
- F = {q1}

| State\Symbol | a | b |
|---|---|---|
| q0 | q1 | q0 |
| q1 | q1 | q0 |
In this example, if the string ends in 'a', the machine reaches state q1, which is an accepting state.
2. Non-Deterministic Finite Automata (NFA)
NFA is similar to DFA but includes the following features:
- It can transition to multiple states for the same input.
- It allows ε-transitions, where the machine can change states without consuming an input symbol (distinct from the empty set ∅, which indicates no transition).
Example: Construct an NFA that accepts strings ending in 'a'.
Given:
- Σ = {a, b},
- Q = {q0, q1},
- F = {q1}

State Transition Table for above Automaton,
| State\Symbol | a | b |
|---|---|---|
| q0 | {q0,q1} | q0 |
| q1 | φ | φ |
In an NFA, if any transition leads to an accepting state, the string is accepted.
NFA vs DFA
DFA | NFA |
|---|---|
Deterministic: exactly one transition per input symbol | Non-deterministic: multiple transitions per input symbol allowed |
No ε-transitions | Allows ε-transitions |
Simpler but sometimes larger in design | More flexible and easier to design |
Next state is uniquely determined | Next state may be multiple possibilities |
Recognizes regular languages; NFAs can be converted to DFA | Recognizes regular languages; equivalent in power to DFA |

