DFA Complement and Minimization: Two Worked Examples for GATE
Learn the safe order for complementing and minimizing finite automata through a partial-DFA trace and a five-state partition-refinement example.
KnowledgeGate Team
Exam prep & CS education

Complement can look like a one-step final-state flip, while minimization can look like arbitrary state merging. Both impressions hide the checks that decide whether the answer is correct. The two worked DFAs below make the order precise: determinize if needed, complete, complement, remove unreachable states, refine partitions, and form quotient states.
DFA complement: what changes and what stays fixed
A complete DFA is M = (Q, Sigma, delta, q0, F), where every state has a defined transition for every symbol in Sigma. Over that same fixed alphabet, its complement is M_bar = (Q, Sigma, delta, q0, Q minus F). The states, alphabet, start state, and transitions stay unchanged. Only accepting status flips.
The rule applies directly only to a complete DFA. If the machine is an NFA, first use subset construction to obtain a DFA. Then add a sink state for any transition still missing. When you need more practice reading transitions before transforming a machine, DFA: Design, Trace and Minimise with Worked Examples develops that tracing habit.
This construction also proves that regular languages are closed under complement. A completed DFA has finitely many states, and swapping final with non-final states produces another finite automaton. Regular Language Properties: Closure and Decision Tests connects this idea with the other closure operations.
Complete a partial DFA before taking its complement
Take alphabet {0,1}, states {q0,q1}, start state q0, and accepting set {q1}. The partial transition function is:
State | on 0 | on 1 |
|---|---|---|
q0 | q0 | q1 |
q1 | missing | q1 |
As a partial machine, it accepts 0*1+: zero or more 0s followed by one or more 1s. It is not ready for the final-state-flip construction because delta(q1,0) is undefined.
Add a non-accepting sink qd. Set delta(q1,0)=qd, and make both delta(qd,0) and delta(qd,1) equal to qd. The completed original DFA still has accepting set {q1}. Its complement has accepting set {q0,qd}.
Now trace 0011 in the completed machine:
q0 -> q0 -> q0 -> q1 -> q1
The run ends in q1, so the original accepts and the complement rejects. For 10, the trace is:
q0 -> q1 -> qd
The original rejects, while the complement accepts because qd is final after the flip. If you flipped before adding qd, the run on 10 would stop at the missing transition and remain rejected. That would not be the complement language.

DFA minimization: remove, partition, refine, quotient
Use this order when minimizing a DFA:
Remove states unreachable from the start state.
Partition the reachable states into final and non-final blocks.
Split a block if its states move to different blocks on any input symbol.
Repeat until no block splits.
Replace each stable block with one quotient state.
States p and q are distinguishable if some suffix z makes exactly one of delta*(p,z) and delta*(q,z) accepting. If no suffix can separate them, they are equivalent and may be merged. Sharing final or non-final status is only the first test, not proof of equivalence. Table filling applies the same test pair by pair; the next example uses partition refinement.
DFA minimization worked example: five named states become two
Consider this total DFA with start state A and accepting set {B,D}:
State | on 0 | on 1 | Status |
|---|---|---|---|
A | C | B | start, non-final |
B | C | B | final |
C | A | D | non-final |
D | A | D | final |
E | E | E | non-final, unreachable |
First prove reachability. A is initial, C is reached by 0, B by 1, and D by 01. No transition from A, B, C, or D reaches E, so remove E before partitioning.
The initial partition is P0 = {{B,D},{A,C}}. For B and D, input 0 reaches the {A,C} block and input 1 reaches {B,D}. The same block signature holds for both A and C: 0 reaches {A,C}, while 1 reaches {B,D}. Neither block splits, so P0 is stable.
Let X={A,C} and Y={B,D}. The quotient DFA is:
Quotient state | on 0 | on 1 | Status |
|---|---|---|---|
X | X | Y | start, non-final |
Y | X | Y | final |
Every 0 places the machine in X, and every 1 places it in Y. Therefore, the minimized DFA recognises exactly the binary strings ending in 1. For another full partition exercise, continue with DFA Minimization for GATE: Minimum States, Step by Step.

Complement then minimize, or minimize then complement?
Reuse the reachable four-state DFA. Complementing changes its accepting set from {B,D} to {A,C} and changes no transition. The stable equivalence classes remain {A,C} and {B,D}. The quotient graph is still X --0--> X, X --1--> Y, Y --0--> X, and Y --1--> Y, but its accepting set is now {X}.
The original minimal DFA accepts strings ending in 1. Its complement accepts the empty string and every non-empty binary string ending in 0.
The reason is simple. Complement negates acceptance after every possible continuation. Two states that agreed for every suffix before complement still agree afterwards, while a suffix that separated two states still separates them. A complete DFA and its complement therefore have the same state-equivalence classes; only the accepting quotient blocks swap. Determinize and complete the machine before using this result.
Complement and minimization mistakes that cost marks
Flipping an incomplete DFA. It happens because the flip rule looks purely local. In the first example,
10would remain incorrectly rejected when the run stops. Addqdand complete every transition first.Flipping final states directly in an NFA. NFA acceptance is existential: one accepting run is enough. Negating that condition is not the same as finding one run to an old non-final state. Apply subset construction, complete the resulting DFA, then flip.
Keeping unreachable states in the minimization problem. State
Eis distinguishable fromAandCbecause suffix1reaches a final state from either of them but never fromE. Even so,Emust simply be removed because no input from start stateAreaches it.Merging all states with the same initial status. Final versus non-final is only round zero. Compare destination blocks for every alphabet symbol until the partition stops changing.
How GATE-style questions test DFA complement and minimization
Common question forms ask you to identify a complement language over a stated alphabet, detect a missing sink, count reachable subset states, find equivalent or distinguishable pairs, compute the minimum number of states, or decide whether complement changes that minimum.
Use one repeatable solve order: write the alphabet, determinize if necessary, complete missing transitions, flip finals only when complement is required, mark reachable states, refine partitions, and count quotient blocks. These problems sit inside the broader automata track covered by GATE CS Exam Preparation.
KnowledgeGate has over 20 published questions on Complement & Minimization. Use them to practise the sequence, but keep the construction visible on paper rather than trying to guess equivalent states by appearance.
DFA complement and minimization: the short version
For complement, remember NFA -> DFA -> complete -> complement. For minimization, remember reachable states -> final/non-final partition -> refine -> quotient. A missing transition requires a sink, and a valid merge requires agreement for every possible suffix.
If you want the wider sequence linking automata, regular languages, constructions, and practice, use Theory Of Computation / Automata Theory as the next step.
Keep learning

NFA Interview Questions and Answers: Basics, Design and Worked Traces
Build interview-ready NFA answers from first principles. Design a machine for strings ending in 01, trace active states, handle epsilon-closure, and derive its reachable DFA subsets.

Turing Machine Variations and UTM: Equivalence, Simulation and Worked Examples
Compare major Turing machine variants, trace a two-tape decider, and decode one transition of a universal Turing machine without confusing simulation with decidability.

Regex Design and Algebra Explained: Identities, Arden's Theorem, and Worked Examples
Build regular expressions from language constraints, simplify them with safe identities, prove the result, and solve a recursive equation with Arden's theorem.

Regex Basics and Definitions: Operators, Worked Examples and Exam Patterns
Learn how regular expressions denote languages, how their three core operators bind, and how to build and check expressions with exact binary examples.

