The Wayback Machine - https://web.archive.org/web/20261119001105/https://www.geeksforgeeks.org/theory-of-computation/minimization-of-dfa/

Minimization of DFA

Last Updated : 18 Nov, 2026

DFA minimization is the process of converting a given deterministic finite automaton (DFA) into an equivalent DFA with the minimum number of states. It is also known as DFA state minimization and can be performed using a partitioning algorithm.

Suppose an original DFA is represented as:

D = (Q, Σ, δ, q₀, F)

  • Q is the finite set of states.
  • Σ is the input alphabet.
  • δ is the transition function.
  • q₀ is the initial state.
  • F is the set of final states.

The minimized DFA is represented as:

Dₘᵢₙ = (Qₘᵢₙ, Σ, δₘᵢₙ, q₀ₘᵢₙ, Fₘᵢₙ)

It recognizes the same language as the original DFA while having the minimum possible number of states.

DFA Minimization Algorithm

Step 1: Remove all unreachable states from the DFA, as they do not affect the language recognized by the automaton.

Step 2: Divide the remaining states into two groups:

  • Final states.
  • Non-final states.

This initial partition is called P₀.

Step 3: Initialize k = 1. Examine each block of Pₖ₋₁ and compare the transitions of its states for every input symbol. If two states transition to different blocks of Pₖ₋₁ for at least one input symbol, separate them into different blocks to obtain Pₖ.

Step 4: Repeat the partitioning process until no block can be further divided, that is, Pₖ = Pₖ₋₁.

Step 5: Merge all states belonging to the same block into a single state. The resulting DFA is the minimized DFA, and its number of states equals the number of blocks in the final partition.

Determining Whether Two States in Partition P_k​ Are Distinguishable

Two states qᵢ and qⱼ belonging to the same block of Pₖ₋₁ are distinguishable if there exists at least one input symbol a ∈ Σ such that δ(qᵢ, a) and δ(qⱼ, a) belong to different blocks of Pₖ₋₁. If their transitions lead to the same blocks for every input symbol, they remain in the same block during that partitioning step.

Example: Consider the following DFA shown in Figure 1.

fig 1

Step 1: P₀ will have two sets of states. One set contains q₁, q₂, q₄, which are final states, and the other contains the remaining non-final states.

P₀ = {{q₁, q₂, q₄}, {q₀, q₃, q₅}}

Step 2: To calculate P₁, check whether the blocks of P₀ can be further partitioned.

(i) For the set {q₁, q₂, q₄}:

Compare the transitions of each state for input symbols 0 and 1.

Stateδ(0)δ(1)
q₁q₂q₅
q₂q₂q₅
q₄q₂q₅
  • On input 0, all states transition to q₂, which belongs to the same block of P₀.
  • On input 1, all states transition to q₅, which also belongs to the same block of P₀.

Therefore, this block cannot be divided further.

(ii) For the set {q₀, q₃, q₅}:

Compare the transitions of the states for input symbols 0 and 1.

Stateδ(0)δ(1)
q₀q₃q₁
q₃q₀q₄
q₅q₅q₅

For q₀ and q₃:

  • On input 0, the transitions go to q₃ and q₀, which belong to the same block of P₀.
  • On input 1, the transitions go to q₁ and q₄, which also belong to the same block of P₀.

Therefore, q₀ and q₃ are not distinguishable in this partition.

For q₀ and q₅:

  • On input 1, the transitions go to q₁ and q₅, which belong to different blocks of P₀.

Therefore, q₀ and q₅ are distinguishable.

Hence, the block {q₀, q₃, q₅} is divided into {q₀, q₃} and {q₅}.

The resulting partition is:

P₁ = {{q₁, q₂, q₄}, {q₀, q₃}, {q₅}}

Step 3: To calculate P₂, check whether any block of P₁ can be further divided.

(i) For the set {q₁, q₂, q₄}:

All three states transition to the same blocks of P₁ for both input symbols. Therefore, this block cannot be divided further.

(ii) For the set {q₀, q₃}:

  • On input 0, q₀ and q₃ transition to q₃ and q₀, respectively, which belong to the same block of P₁.
  • On input 1, they transition to q₁ and q₄, respectively, which also belong to the same block of P₁.

Therefore, q₀ and q₃ remain in the same block.

(iii) For the set {q₅}:

This block contains only one state and cannot be divided further.

Since no block can be divided further, P₁ = P₂. Therefore, the final partition is:

P₂ = {{q₁, q₂, q₄}, {q₀, q₃}, {q₅}}

Final Result

The states belonging to the same block are equivalent and can be merged:

  • States q₁, q₂, and q₄ are merged into one state.
  • States q₀ and q₃ are merged into one state.
  • State q₅ remains unchanged.

The resulting minimized DFA has three states.

fig 2

Example: Analyzing Statements About a DFA

Consider a DFA A over the alphabet {0, 1}. Analyze the following statements about A:

  • The complement of L(A) is context-free.
  • L(A) = L((110 + 0)(0 + 1)01)
  • A is the minimal DFA for the language it accepts.
  • A accepts all strings over {0, 1} of length at least two.

example

Analysis:

  • Statement 1: The complement of a regular language is also regular. Since every regular language is context-free, the statement is true.
  • Statement 2: The language equivalence can be checked by comparing the language accepted by the given DFA with the regular expression.
  • Statement 3: The initial partition is P₀ = {{q₂}, {q₀, q₁}}. After checking the transitions, P₁ = {{q₂}, {q₀, q₁}}. Since P₀ = P₁, q₀ and q₁ can be merged into one state. Therefore, the original DFA is not minimal, and the statement is false.
  • Statement 4: The DFA also accepts the string 0, which has length 1. Therefore, the statement is false.

Conclusion: Statements 3 and 4 are false.

Correct Option: D

Advantages of DFA Minimization

  • Reduced State Count: Removes equivalent states, producing a simpler automaton.
  • Lower Memory Requirements: A DFA with fewer states generally requires less memory to represent.
  • Simpler Analysis: Makes the automaton easier to understand, analyze, and maintain.
  • Language Preservation: Ensures that the minimized DFA recognizes exactly the same language as the original DFA.

Disadvantages of DFA Minimization

  • Computational Overhead: The minimization process requires comparing states and their transitions, which involves additional computation.
  • Implementation Complexity: Partitioning and checking state equivalence require careful handling of transitions.
  • Limited Scope of the Algorithm: The partitioning algorithm described here applies to DFAs. NFA minimization requires different techniques and considerations.
Comment

Explore