Converting a Given ε\varepsilon-NFA to a DFA via ε\varepsilon-Closures

Converting a Given ε\varepsilon-NFA to a DFA via ε\varepsilon-Closures

Verified Sources
Sep 13, 2026

NFA to DFA Conversion (Subset Construction) with $\varepsilon$-Closures

You are given the following ε\varepsilon-NFA (states: {p,q,r}\{p,q,r\}; alphabet: {a,b}\{a,b\}):

  • Start state: pp
  • Accepting (final) states: not explicitly stated in the prompt, so conversion is about the transition structure only (final states can be derived if you later specify which are accepting).

Transitions:

Stateε\varepsilon-transitionaa-transitionbb-transition
\to (start) pp{r}\{r\}{q}\{q\}{p,r}\{p,r\}
qq\emptyset{p}\{p\}\emptyset
rr{p,q}\{p,q\}{r}\{r\}{p}\{p\}

We will:

  1. Compute all reachable ε\varepsilon-closures of NFA state sets.
  2. Use subset construction to build the equivalent DFA, where each DFA state is a set of NFA states (a subset).

Key definitions used throughout:

  • [epsilon-closure]{def="The set of NFA states reachable from a state (or set) using only ε\varepsilon-moves"}
  • subset construction
  • DFA transition function

Core conversion rule (what we compute)

For any set of NFA states SS and input symbol x{a,b}x\in\{a,b\}, the DFA transition is:

δDFA(S,x)=ε-closure(sSδNFA(s,x))\delta_{\text{DFA}}(S,x) = \varepsilon\text{-closure} \Big( \bigcup_{s\in S}\delta_{\text{NFA}}(s,x) \Big)

So the workflow is:

  • Move on symbol xx using the NFA’s labeled transitions: sSδNFA(s,x)\bigcup_{s\in S}\delta_{\text{NFA}}(s,x)
  • Then “expand” by following any number of ε\varepsilon-moves via ε\varepsilon-closure.

We’ll compute these exactly for the given machine.

Step 1 — Compute $\varepsilon$-closures of individual states

  1. 1
    Step 1

    For each state s{p,q,r}s\in\{p,q,r\}, start with the set containing only ss.

  2. 2
    Step 2

    From any state already in the closure, follow its 0˘3b5\u03b5-transition(s) (if any), and repeat until no new states are added.

  3. 3
    Step 3

    Given pε{r}p\xrightarrow{\varepsilon}\{r\}, include rr. From rr, add {p,q}\{p,q\} via rε{p,q}r\xrightarrow{\varepsilon}\{p,q\}. Thus you reach {p,q,r}\{p,q,r\}.

  4. 4
    Step 4

    Given qεq\xrightarrow{\varepsilon}\emptyset, you can’t reach any new state; closure is just {q}\{q\}.

  5. 5
    Step 5

    From rr, you can go to {p,q}\{p,q\} via ε\varepsilon-transitions. From pp, you can go to {r}\{r\} via ε\varepsilon, so ultimately you reach {p,q,r}\{p,q,r\}.

  6. 6
    Step 6

    So: ε-closure(p)={p,q,r}\varepsilon\text{-closure}(p)=\{p,q,r\}, ε-closure(q)={q}\varepsilon\text{-closure}(q)=\{q\}, ε-closure(r)={p,q,r}\varepsilon\text{-closure}(r)=\{p,q,r\}.

Closure intuition

Think of 0˘3b5\u03b5-closure as “all states you can be in right now without consuming input.” When converting to a DFA, every DFA state must represent such an 0˘3b5\u03b5-expanded set.

Step 1 results (individual closures)

ε-closure(p)={p,q,r}\varepsilon\text{-closure}(p)=\{p,q,r\} ε-closure(q)={q}\varepsilon\text{-closure}(q)=\{q\} ε-closure(r)={p,q,r}\varepsilon\text{-closure}(r)=\{p,q,r\}

Now we must compute closures of sets that arise during subset construction. (A set closure is the union of closures of its members, then expanded consistently.)

[set 0˘3b5\u03b5-closure]{def="Closure of a set S is the union of individual closures of states in S"}

Step 2 — DFA construction via subset construction

  1. 1
    Step 1

    is S0=ε-closure({p})={p,q,r}.S_0=\varepsilon\text{-closure}(\{p\})=\{p,q,r\}.

  2. 2
    Step 2

    Compute T=sS0δNFA(s,a)T=\bigcup_{s\in S_0}\delta_{\text{NFA}}(s,a), then take ε-closure(T)\varepsilon\text{-closure}(T). We compute it explicitly below.

  3. 3
    Step 3

    Similarly compute T=sS0δNFA(s,b)T=\bigcup_{s\in S_0}\delta_{\text{NFA}}(s,b), then take ε-closure(T)\varepsilon\text{-closure}(T).

  4. 4
    Step 4

    If the resulting subsets are new, add them to the DFA state set and repeat for each.

  5. 5
    Step 5

    In this machine, the DFA stabilizes quickly because many transitions lead back into {p,q,r}\{p,q,r\}.

Step 2 details: transitions

Let the current DFA state be the subset SS of NFA states.

From S0={p,q,r}S_0=\{p,q,r\} on input aa

First compute the NFA move on aa:

  • δ(p,a)={q}\delta(p,a)=\{q\}
  • δ(q,a)={p}\delta(q,a)=\{p\}
  • δ(r,a)={r}\delta(r,a)=\{r\}

So:

Ta=s{p,q,r}δ(s,a)={q}{p}{r}={p,q,r}T_a=\bigcup_{s\in\{p,q,r\}}\delta(s,a)=\{q\}\cup\{p\}\cup\{r\}=\{p,q,r\}

Now take ε\varepsilon-closure:

δDFA({p,q,r},a)=ε-closure({p,q,r})\delta_{\text{DFA}}(\{p,q,r\},a) = \varepsilon\text{-closure}(\{p,q,r\})

Since pp and rr already have closure {p,q,r}\{p,q,r\} and qq closes to {q}\{q\}, we get:

ε-closure({p,q,r})={p,q,r}\varepsilon\text{-closure}(\{p,q,r\})=\{p,q,r\}

Therefore:

δDFA(S0,a)={p,q,r}\delta_{\text{DFA}}(S_0,a)=\{p,q,r\}

From S0={p,q,r}S_0=\{p,q,r\} on input bb

Compute NFA move on bb:

  • δ(p,b)={p,r}\delta(p,b)=\{p,r\}
  • δ(q,b)=\delta(q,b)=\emptyset
  • δ(r,b)={p}\delta(r,b)=\{p\}

So:

Tb=s{p,q,r}δ(s,b)={p,r}{p}={p,r}T_b=\bigcup_{s\in\{p,q,r\}}\delta(s,b)=\{p,r\}\cup\emptyset\cup\{p\}=\{p,r\}

Now take ε\varepsilon-closure:

We use set closure:

ε-closure({p,r})=ε-closure(p)ε-closure(r)={p,q,r}{p,q,r}={p,q,r}\varepsilon\text{-closure}(\{p,r\}) = \varepsilon\text{-closure}(p)\cup \varepsilon\text{-closure}(r) = \{p,q,r\}\cup\{p,q,r\} = \{p,q,r\}

Therefore:

δDFA(S0,b)={p,q,r}\delta_{\text{DFA}}(S_0,b)=\{p,q,r\}

About accepting states

The DFA final/accepting states depend on which NFA states are final. The prompt doesn’t specify them, so only the DFA transition structure is determined here. If you later specify final NFA states, DFA finals are exactly subsets that intersect those states.

Result: The DFA transition table

We started from S0={p,q,r}S_0=\{p,q,r\}. Both inputs loop back to the same subset, so the DFA has only one reachable DFA state:

S0={p,q,r}S_0=\{p,q,r\}

Thus the DFA transition function is:

DFA state (subset of NFA states)on aaon bb
{p,q,r}\{p,q,r\}{p,q,r}\{p,q,r\}{p,q,r}\{p,q,r\}

Accepting states (conditional)

Let FNFAF_{\text{NFA}} be the set of accepting states of the ε\varepsilon-NFA. Then the accepting DFA states are:

  • SS is accepting iff SFNFAS\cap F_{\text{NFA}}\neq\emptyset
  • (and if you treat acceptance as “some path accepts after ε\varepsilon-closure”, you can equivalently test SS’s elements.)

Because the only DFA state is S0={p,q,r}S_0=\{p,q,r\}, the DFA accepts all strings iff any of {p,q,r}\{p,q,r\} is accepting in the NFA; otherwise it accepts none.

From 0˘3b5\u03b5-NFA to DFA (what you do in practice)

Compute $\u03b5$-closures

1

Find ε-closure(p),ε-closure(q),ε-closure(r)\varepsilon\text{-closure}(p),\varepsilon\text{-closure}(q),\varepsilon\text{-closure}(r)."

Initialize DFA start state

2

Set S0=ε-closure({NFA start})S_0=\varepsilon\text{-closure}(\{\text{NFA start}\})."

Subset transitions

3

For each DFA state SS and symbol xx, compute T=sSδ(s,x)T=\bigcup_{s\in S}\delta(s,x) then 0˘3b5\u03b5-close it."

Finalize reachable subsets

4

Stop when no new subsets appear; mark accepting subsets if given NFA finals."

Quick verification with a state-based view

Even without running more iterations:

  • From pp, an ε\varepsilon-move gets you to rr.
  • From rr, an ε\varepsilon-move gets you to pp and qq.
  • From qq, ε\varepsilon does nothing.
  • So as soon as you start, the ε\varepsilon-closure is already the full set {p,q,r}\{p,q,r\}.
  • On aa and bb, the NFA transitions from states inside this full set always return you (after ε\varepsilon-closure) to the same full set.

Mermaid sketch of “closure collapse”:

Common edge-cases & checks

Knowledge Check

Question 1 of 4
Q1Single choice

What is the 0˘3b5\u03b5-closure of state qq in the given 0˘3b5\u03b5-NFA?