Exercises — NFA to DFA conversion — subset construction
Level 1 — Recognition
Exercise 1.1
An NFA has ε-edges and , and no other ε-edges. Compute and .
Recall Solution
What ECLOSE asks: "starting from these states, where can I silently drift using only ε-arrows?" — and you always include where you started.
From : an ε-edge takes you to ; from another ε-edge takes you to ; from nothing. So you collect . From : no ε-edges leave it, so you collect only itself. Why is included in its own closure: ECLOSE always contains its input set — "reachable in zero ε-steps" counts.
Exercise 1.2
NFA over with , , and no -edge from . Compute and .
Recall Solution
What MOVE asks: "reading exactly one , which states could each member of my set jump to?" — then pool all those together.
, because has no -edge. An empty MOVE is legal — it signals the machine "dies" on that step.
Exercise 1.3
An NFA has states. What is the maximum possible number of DFA states the subset construction can create, and what does the state represent?
Recall Solution
Each DFA state is a subset of the NFA states, and the number of subsets of a 4-element set is (see Power Set and Subsets). = the dead/trap state: no NFA states are alive, so nothing can ever accept again. It loops to itself on every symbol and rejects.
Level 2 — Application
Exercise 2.1
NFA over , states , start , final , no ε: , , , , . Build the DFA transition table (reachable states only) and list its accepting states.
Recall Solution
Start: no ε-edges, so . Call it .
:
- on : → new state .
- on : .
:
- on : .
- on : → new state .
:
- on : → new state .
- on : .
:
- on : .
- on : .
| DFA state | on | on | accept? |
|---|---|---|---|
| (start) | no | ||
| no | |||
| yes () | |||
| yes () |
Accepting states = those whose subset touches , i.e. and . Only of the subsets are reachable.
Exercise 2.2
Using the ε-NFA below over , compute the DFA start state, then trace the string . States , start , final : , , , .
Recall Solution
Start: (ε-edge ; from none). Call .
Read first from : (only has an -edge). Then (ε-edge ). So .
Read second from : (only has an -edge; has none). . Self-loop .
Trace: . Is accepting? → yes. So is accepted. (This DFA accepts .)
Level 3 — Analysis
Exercise 3.1
An NFA has states, yet its subset-construction DFA has only reachable states, not . Explain in one sentence what property of the NFA guarantees fewer than reachable subsets, and give the exact count for .
Recall Solution
is the ceiling; reachability is what actually decides the count. Property: only subsets that appear as starting from are ever created — if the NFA's branching never produces certain combinations of states, those subsets are unreachable and are simply never generated. The blow-up to the full happens only when the NFA can, for each subset, force the DFA into it.
Exercise 3.2
Consider the classic "-th symbol from the end is " language over . It is a standard result that this language needs an NFA of states, while its minimal DFA needs states. For : how many states does the compact NFA have, and how many states does the exponentially-blown-up minimal DFA have?
Recall Solution
NFA states: (one state to "guess" the marked position, then more to count to the end — the standard compact NFA for this language). Minimal DFA states: . Why the exponential gap is real here: to decide the -th-from-end symbol, the DFA must remember the last symbols exactly. There are distinct length- windows, and every pair of them can be told apart by some continuation — so each is a genuinely different Myhill–Nerode class (see DFA Minimization — Myhill–Nerode) and none can be merged. This is the textbook example showing that subset construction's blow-up can genuinely be forced.
Exercise 3.3
The DFA from Worked Example 2 (parent note) accepts . Suppose a student claims the same DFA also accepts the empty string . Refute this using the accept condition, showing the exact intersection.
Recall Solution
On input the DFA stays in its start state (it reads no symbols). Accept test: . Since the intersection is empty, is not accepting → is rejected. The claim is false. The language is , not ; would require , which it is not.
Level 4 — Synthesis
Exercise 4.1
From the regular expression (all strings over ending in ), build an NFA by Thompson's idea (states ), then fully convert it to a DFA. Use this NFA: start , final , no ε: , , , and . Build the DFA table and state its accepting states.
Recall Solution
Start: (no ε).
:
- : .
- : .
:
- : .
- : .
:
- : .
- : .
| DFA state | on | on | accept? |
|---|---|---|---|
| (start) | no | ||
| no | |||
| yes () |
Sanity trace of : → accept (ends in ). ✔ Trace : → reject (ends in ). ✔ Accepting states: . See Regular Expressions to NFA — Thompson's construction for the NFA build step.
Exercise 4.2
Convert this ε-NFA over fully. States , start , final : , , , . Give the DFA table and accepting states.
Recall Solution
Start: .
:
- : ; ECLOSE.
- : ; ECLOSE.
:
- : ; ECLOSE.
- : ; ECLOSE.
:
- : → dead state .
- : .
: on → (trap).
| DFA state | on | on | accept? |
|---|---|---|---|
| (start) | no | ||
| no | |||
| yes | |||
| no |
Language: . Accepting: ; the dead state appears because dies on .
Level 5 — Mastery
Exercise 5.1
The "nd symbol from the end is " NFA over : states , start , final , , , , . This is the tight-blow-up family with , whose minimal DFA has states. Convert it fully and confirm the reachable subset DFA also has exactly states. Give the table, then read the state diagram below.
Recall Solution
Start: .
:
- : .
- : .
:
- : .
- : .
:
- : .
- : .
:
- : .
- : .
| DFA state | on | on | accept? |
|---|---|---|---|
| (start) | no | ||
| no | |||
| yes | |||
| yes |
Exactly reachable states — matching the minimal-DFA bound . Both are accepting (each contains ). Trace : → reject (2nd-from-end of "ba" is "b"). Trace : → accept (2nd-from-end is "a"). ✔

Exercise 5.2
Verify the accept-condition edge case: an NFA whose start state is also final, e.g. start final , with . Convert and determine whether the DFA accepts .
Recall Solution
Start: (no ε). Accept test on : → is accepting. Since the start state is accepting, the DFA accepts (empty input never leaves the start). Transition: . Language , which includes . This shows the general rule: iff — the start subset touches a final state.
Exercise 5.3
Degenerate NFA: start , final , but is unreachable (no edges into it), and , . Convert and state .
Recall Solution
Start: (no ε).
:
- : ; ECLOSE.
- : ; ECLOSE.
| DFA state | on | on | accept? |
|---|---|---|---|
| (start) | no |
Only the single DFA state is reachable. Accept test: → not accepting. Why: although is a declared final state, no reachable subset ever contains it, so nothing is ever accepted. Unreachable NFA finals contribute nothing — and is itself a perfectly valid regular language (see Closure Properties of Regular Languages).
Recall Quick self-check reveals
Max DFA states for ? ::: . Minimal DFA states for the "rd-from-end is " language ()? ::: ; the compact NFA has . Does an NFA with start = final accept after conversion? ::: Yes — the start subset touches . Where do you send a transition whose MOVE is empty? ::: To the dead/trap state , which self-loops and rejects.
Connections
- 4.6.04 NFA to DFA conversion — subset construction (Hinglish)
- Finite Automata — DFA basics
- Finite Automata — NFA and ε-NFA
- Regular Expressions to NFA — Thompson's construction
- DFA Minimization — Myhill–Nerode
- Power Set and Subsets
- Closure Properties of Regular Languages
- Pumping Lemma for Regular Languages