1. Gyanastra
  2. Theory of Computation
  3. Minimization of DFA
  4. Introduction to DFA Minimization and State Equivalence
Free lesson, no account needed 5 min read 13 practice questions after it
Asked in past papers25 times
  • GATE CSE202620252024202320212020201520132011200920082007200620012000199919981997
  • ISRO20202017
  • UGC NET20192018201520132012

Theory of Computation · Minimization of DFA

Introduction to DFA Minimization and State Equivalence

Overview

Minimization of a DFA is a procedure that decreases the number of states in a given DFA, either proving the DFA is already minimal or producing a smaller DFA that accepts the same language.
It applies to DFAs only, not NFAs, and replaces reliance on experience with a systematic guarantee of minimality. The key prerequisite is a precise notion of when two states may be merged: state equivalence.

Key concepts

  • Minimization of a DFA: A procedure that decreases the number of states in a given DFA. The goal is either to prove the DFA is already minimal or to produce a DFA with fewer states that accepts the same language.
    Minimization applies to DFAs only, not NFAs.
  • Why it matters: DFAs constructed by experience or insight were already minimal in earlier examples; minimization gives a systematic procedure to guarantee minimality instead of relying on experience.
  • Equivalent states: Two states PP and QQ of a DFA are equivalent, and can be replaced by a single state, if for every input string ww: if PP on seeing ww goes to a final state, then QQ on seeing ww also goes to a final state; and if PP on seeing ww does not go to a final state, then QQ on seeing ww also does not go to a final state.
  • Same type, not same state: The two states need not go to the same final state — only to some final state (or, correspondingly, both to non-final states).

How it works

  1. Start with any DFA. The question minimization answers: can this DFA be minimized, and how?
  2. Before minimizing, fix a notion of when two states may be merged: state equivalence.
  3. Take two states PP and QQ and consider any input string ww. Run PP on ww and run QQ on ww.
    If PP ends in a final state, QQ must also end in a final state; if PP ends in a non-final state, QQ must also end in a non-final state.
  4. If this holds for all strings ww, then PP and QQ are equivalent, and the two states can be replaced by a single state in the minimized DFA.
  5. The condition concerns the type of the ending state (final vs non-final), not reaching the identical state.
Figure. P and Q must both end final or both end non final for the same string w. Equivalence requires this matching outcome for every string w, after which P and Q can be merged.

Formulas

  • P≡Q  ⇔  for every string w:  δ^(P,w)∈F  ⇔  δ^(Q,w)∈FP \equiv Q \;\Leftrightarrow\; \text{for every string } w:\; \hat{\delta}(P, w) \in F \;\Leftrightarrow\; \hat{\delta}(Q, w) \in F

  • P,QP, Q = states of the DFA

  • ww = any input string

  • δ^\hat{\delta} = extended transition function (state reached after reading ww)

  • FF = set of final states

  • ≡\equiv = "is equivalent to"

  • Equivalently: P≡QP \equiv Q iff for every ww, δ^(P,w)\hat{\delta}(P, w) and δ^(Q,w)\hat{\delta}(Q, w) are both final or both non-final.

Worked examples

No numerical example is worked in this section. The concept is illustrated only by the definition: two states PP and QQ are equivalent exactly when, for every input string ww, either both reach final states or both reach non-final states (they need not reach the same final state).

Revision summary

  • Minimization reduces the number of states of a given DFA; it is defined for DFAs only, not NFAs.
  • Two states PP and QQ are equivalent if for every input string ww, PP reaches a final state exactly when QQ reaches a final state.
  • "Both final" or "both non-final" is required; the final states reached need not be the same.
  • Equivalent states can be merged into a single state.
  • Hand-constructed DFAs were minimal by experience; minimization provides the systematic guarantee.
  • The equivalence condition is about the type of the ending state (final vs non-final), not about reaching the identical state.

Previous-year exam insights

  • Myhill–Nerode / distinguishability: two states are distinguishable if some string w takes exactly one of them to a final state; the minimal DFA is unique up to isomorphism and its states are exactly the equivalence classes of the right-invariant relation (the Myhill–Nerode classes).
    Asked inGATE 2024GATE 2013GATE 2021
  • Table-filling (partition refinement) procedure: start with the partition {F, Q−F}; repeatedly split blocks by the transition behaviour on each symbol (states p,q stay together only if δ(p,a) and δ(q,a) lie in the same block for every a); stop when no block splits — the resulting blocks are the states of the minimal DFA. Unreachable states must be removed first.
    Asked inGATE 2024GATE 2013GATE 2015
  • An NFA with n states can be converted to a DFA with at most 2n2^{n} states (subset construction), and every minimal DFA size from 1 up to 2n2^{n} is achievable, so a minimal DFA can never have more than 2n2^{n} states.
    Asked inGATE 2026GATE 2025
  • Counting states for modular conditions: a condition such as 'number of a's divisible by m but not by k' can be decided by counting a's modulo lcm(m,k), so at most lcm(m,k) states are needed (the accepting residues form the required set); the minimal DFA can have fewer, e.g. if k divides m the language is empty and one state suffices.
    A single modular condition 'value mod m' needs m states.
    Asked inGATE 2025GATE 2020
  • Complement of a language: if the minimal DFA for L has k states (complete DFA, all states reachable), the minimal DFA for its complement also has exactly k states — just swap final and non-final states.
    Asked inGATE 2021GATE 2015
  • For a pattern language (strings containing/not containing a fixed substring, or avoiding k consecutive identical symbols), the minimal DFA needs one state per prefix matched plus a dead/trap state; the minimal DFA for the complement of Σ*·x·Σ* has |x|+1 states.
    Asked inGATE 2023GATE 2015
Pages 1–2 of 2