IAE Academy

GATE 2020 CS Q.51: solution and answer

GATE 2020 · CSQ.51 · 2 marks · NAT

Consider the following language.

The minimum number of states in a DFA that accepts is ______.

See the question in the paper

Answer and solution

ANSWER

The minimum number of states in a DFA that accepts is 6.

Official answer: 6Source: Official answer key, GATE 2020 CS (IIT Delhi)

  1. Only the number of 's matters: a leaves the situation unchanged. So it is enough to track , because this fixes both and (6 = 2 x 3, coprime).

  2. A string is in exactly when . Residue 0 is divisible by 3, so it is excluded. Residues 1, 3 and 5 are odd, so they are excluded. Residues 2 and 4 are even and not divisible by 3.

  3. So a 6-state DFA works: states , , , start state , accepting states .

  4. Minimality: from , the string is accepted iff . So the set of accepted from is .

  5. For these sets are . All six are different, so for any two states some is accepted from one and rejected from the other. Every pair of states is distinguishable.

  6. No two states can be merged. The DFA is complete (every state has a transition on both symbols), so no extra dead state is needed. The minimum number of states is .

KEY IDEA

Divisibility by 2 and by 3 combine into a single counter modulo . The residues are the accepting ones, and a Myhill-Nerode argument with strings shows all 6 residues are distinguishable.

WATCH OUT FOR

Building a product of a mod-2 machine (2 states) and a mod-3 machine (3 states) and then guessing 5 or 2 x 3 minus something, or assuming some states can be merged. Here, because 2 and 3 are coprime, the product has 6 reachable states and none of them are equivalent.

From the GATE 2020 CS paper. Every question of this paper · Download the full paper · All 18 Finite automata questions, with notes

More Finite automata questions