Introduction
A nondeterministic finite automaton (NFA) may have zero, one or many next states for a given state and symbol. It accepts a string if some sequence of choices leads to an accepting state. Allowing -transitions (moves without reading input) gives an -NFA. Despite the extra freedom, NFAs and -NFAs recognize exactly the same languages as DFAs: the regular languages.
The constructive proof is the subset construction (powerset construction): each DFA state is a set of NFA states, recording every place the NFA could be. The working skills are (a) drawing a small NFA, (b) building the subset DFA, and (c) knowing that the DFA may need up to states for an -state NFA.
Prerequisites
- Deterministic Finite Automata: DFA tuple, acceptance, transition diagrams.
Core concepts
NFA without
An NFA is where (the power set of ). From state on symbol , the machine may move to any state in . If , that branch dies.
Acceptance. Extend to sets of states and to strings: the NFA accepts if there exists a sequence of states with and . Equivalently, .
NFA versus DFA. Every DFA is an NFA whose values are always singletons. The converse simulation needs the subset construction.
-NFA
An -NFA allows transitions on as well: .
The -closure of a set of states is the set of states reachable from by zero or more -moves (including the states in themselves). For an epsilon-closed current set , reading a symbol goes to the expression below; for arbitrary , first take its epsilon-closure:
Acceptance: after processing , the resulting -closed set intersects .
Why nondeterminism helps design
To accept strings ending with 01, an NFA can stay in a looping start state on and , and also "guess" that the current starts the final 01 by moving to a progress state. Here the saving is nothing (the minimal DFA also has 3 states), but for "the -th symbol from the end is 1" the NFA has states and the minimal DFA .
How it works
Subset construction (no )
Input: NFA .
Output: DFA .
- States of are subsets of . Only reachable subsets from are needed.
- Start state .
- .
- is accepting iff .
At most DFA states; many are often unreachable.
Subset construction with
Same, but the start state is , and
Eliminating -transitions alone
An -NFA converts to an ordinary NFA (still nondeterministic) by: for each state and symbol , put an -transition from to every state in after adjusting acceptance so that is accepting if meets . The subset construction already folds this in, so separate elimination is optional.
Algorithms and pseudocode
EPSILON-CLOSURE(N, S)
1 T <- set(S); stack <- list(S)
2 while stack not empty
3 q <- pop(stack)
4 for each p in N.delta[q][eps]
5 if p not in T
6 add p to T; push p
7 return T
SUBSET-CONSTRUCT(N)
1 qD <- EPSILON-CLOSURE(N, {N.q0})
2 QDmark <- {qD}; work <- queue(qD); deltaD <- empty map
3 while work not empty
4 S <- dequeue(work)
5 for each a in Sigma
6 T <- EPSILON-CLOSURE(N, union of N.delta[q][a] for q in S)
7 deltaD[S][a] <- T
8 if T not in QDmark
9 add T to QDmark; enqueue T
10 FD <- { S in QDmark | S intersects N.F }
11 return DFA(QDmark, Sigma, deltaD, qD, FD)Correctness: by induction on , the DFA state after equals the set of NFA states reachable on . Hence the languages coincide.
Mathematical explanation
Worst-case blow-up
For , the language over whose -th symbol from the end is 1 has an -state NFA: a looping start state guesses that 1, then uses states to count through the remaining symbols to acceptance. Its minimal reachable subset DFA has states, remembering the last bits (with appropriate leading-zero padding for short strings). This witness proves exponential worst-case growth; the general subset upper bound remains valid.
Equivalence chain
(the last inclusion via subset construction), so all three models define the regular languages.
Worked examples
Example 1: NFA for strings ending with 01
States with accepting.
- , .
- , .
- .
For a cleaner total NFA that continues matching, send on to and on to . The extra edges change nothing: is active after every prefix and already offers the same moves.
Example 2: subset construction
Using the NFA above (with or without the continuation edges from ), the reachable subsets are exactly , and . Accepting subsets are those containing , here only . The subset is never reached: the only way into is on 1, and no state moves to on 1. The resulting 3-state DFA is already minimal and accepts exactly the strings ending in 01.

Example 3: -NFA for
Start , accept . Edges: , , , . Then . On the DFA moves to . Language .
Example 4: exponential lower bound sketch for
Language: second bit from the end is . NFA with 3 states guesses; minimal DFA needs 4 states (all length-2 binary memories). For general , DFA needs states.
Example 5: step-by-step subset table for a 3-state NFA
Take the NFA with transitions from q0 on 0 to {q0,q1}, from q0 on 1 to {q0}, from q1 on 1 to {q2}, and continuation from q2 on 0 to {q0,q1}, from q2 on 1 to {q0}; accept {q2}.
| Subset S | on 0 | on 1 | Accept? |
|---|---|---|---|
| {q0} | {q0,q1} | {q0} | no |
| {q0,q1} | {q0,q1} | {q0,q2} | no |
| {q0,q2} | {q0,q1} | {q0} | yes |
Start at {q0}. String 01 visits {q0} then {q0,q1} then {q0,q2} (accept). String 010 continues to {q0,q1} (reject). Only these 3 subsets are reachable; a subset such as {q0,q1,q2} can be written down but no input leads to it, so it is not part of the DFA. Listing unreachable subsets gives a wrong state count.
Example 6: subset construction with -moves
The -NFA has states 0, 1, 2 (only state 2 accepts) with , , , , . It accepts .
Closures first: , , .
| DFA state | on a | on b | on c | Accept? |
|---|---|---|---|---|
| (start) | yes | |||
| yes | ||||
| yes | ||||
| no |
Four DFA states including the dead set. The start state accepts because its closure already contains 2, so is accepted. abc goes and is accepted; ba goes and is rejected.
Example 7: the blow-up family, exactly
. The NFA loops on , guesses the critical 1 by moving to , then reads any symbols through : states. Subset construction reaches exactly subsets (each records which of the last positions held a 1), and all are pairwise distinguishable: if and of length differ at position , append any symbols and the -th position becomes the -th from the end. For : NFA 2, 3, 4, 5 states; minimal DFA 2, 4, 8, 16 states.
Different count: the reverse language. "The -th symbol from the start is 1" needs only DFA states (count to , then an accepting sink or a dead state). Reversal can change DFA size exponentially, which is why the reversal construction goes through an NFA.
Related material. Alternating finite automata and two-way NFAs also recognize only regular languages; they are not required for GATE CSE.
Important properties and observations
- Acceptance is existential ("some path"), not universal.
- -closure must be applied after every real symbol move and at the start.
- Empty transition sets are legal in NFAs; they just kill that branch.
- The subset DFA may include a sink if some NFA moves die.
- NFAs do not accept "more languages" than DFAs; they accept more succinctly.
Constructions that stay inside NFAs.
| Operation | NFA construction | Extra states |
|---|---|---|
| Union | new start with to both starts | 1 |
| Concatenation | from every accept of to the start of ; only 's accepts remain | 0 |
| Star | new accepting start with to the old start; from old accepts back to the old start | 1 |
| Reversal | reverse every edge, old start becomes the only accept, new start with to every old accept | 1 |
| Complement | not available directly: determinize first, complete, then swap | up to |
| Intersection | product of the two NFAs (pairs of states) | total |
Swapping accept states of an NFA is not complement. Take the 3-state NFA for "ends with 01" and make accepting and non-accepting. On input 01 the run that stays in still accepts, so the swapped NFA accepts a string that is in . It actually accepts every string, since is always active. An NFA accepts if some run accepts; complement needs every run to reject, which only a DFA expresses by a single run.
Star needs a new start state. Making the old start state accepting and adding -edges back to it can accept extra strings when the old start has incoming edges. For example, with an NFA for whose start state loops on , that shortcut accepts a, which is not in .
NFA versus DFA counts. Same language class; state complexity can differ exponentially.
Common misconceptions.
- "Nondeterminism means the machine randomly rejects." In language theory it means existence of an accepting computation, not probability.
- "-transitions read the empty symbol as input consuming time." They consume no input symbol.
- "Subset construction always produces states." Only reachable subsets matter; often far fewer.
GATE examination perspective
- BUILD THE SUBSET TABLE. Rows = subsets found so far; columns = symbols; close under if present.
- MARK ACCEPTING SUBSETS. Any subset meeting , not only .
- EXPONENTIAL EXAMPLE. "-th from end is 1" is the standard blow-up witness.
- DESIGN WITH GUESSING. NFAs for "contain substring " or "end with " are often easier than DFAs; convert if a DFA is required.
- DEAD EMPTY SET. If the powerset DFA has , it is a rejecting sink, and it counts as a state of the complete DFA.
- REACHABLE ONLY. "How many states does the subset construction produce" means reachable subsets from the start closure; never answer unless every subset is reached.
- START CLOSURE. With -moves the DFA start is , not . If the closure meets , is accepted.
- COMPLEMENT TRAP. Flipping accept states of an NFA does not complement it.
- STATE BOUNDS. NFA to DFA: at most states and the bound is reached; DFA to NFA: no increase.
Summary
Sources
- J. E. Hopcroft, R. Motwani, J. D. Ullman, Introduction to Automata Theory, Languages, and Computation, 3rd ed., Pearson Addison-Wesley, Section 2.3 (nondeterministic finite automata, including 2.3.6 "A Bad Case for the Subset Construction"), Section 2.5 (finite automata with epsilon-transitions, epsilon-closures, eliminating epsilon-transitions).
- M. Sipser, Introduction to the Theory of Computation, 3rd ed., Cengage Learning: Section 1.2 (nondeterminism, equivalence of NFAs and DFAs, closure under the regular operations).
- P. Linz, An Introduction to Formal Languages and Automata, 6th ed., Jones & Bartlett Learning: Sections 2.2 and 2.3 (nondeterministic accepters and their equivalence with deterministic ones).