GATE / CS ARCHIVE

GATE CSE 2025 SET 2 / QUESTION 60

GATE CSE 2025 Set 2 Q60

Theory of Computation · Finite Automata · Full GATE CSE 2025 Set 2 paper

GATE 2025 Set 2, Q60 2 marks · NAT
Report issue

Finite Automata

Question 60, GATE 2025: Let Σ={1,2,3,4}. For a string x, prod(x) is the product of its symbols modulo 7, with prod(ε)=1. Define L={x:prod(x)=2}. How many states does a minimum DFA for L have?
Tap to enlarge
Answer & solution

Official answer: 6

Step through it (2 parts)

No input symbol is divisible by 7, so a product can never have residue 0. A DFA can keep one of the six nonzero residues 1,…,6 as its state. Start in state 1, use transition δ(r,a)=ra mod 7 for a∈{1,2,3,4}, and accept only state 2. This proves that six states suffice.

To prove minimality, first show all six residues are reachable. Repeated input 3 gives the cycle 1→3→2→6→4→5→1, so every state is reached by some power of the string symbol 3.

Next distinguish two different residues r and s. Nonzero residues modulo the prime 7 have multiplicative inverses. Choose a suffix whose product is t=2r−1 mod 7. Such a suffix exists because powers of 3 realize every nonzero residue. Appending it to a prefix with product r yields rt=2 and is accepted. Appending it to a prefix with product s cannot yield 2: st=rt would imply s=r after cancellation. Thus every pair of reachable states has different residual languages.

By the DFA distinguishability criterion, none of these states can be merged. Exactly six are necessary and sufficient; no seventh zero-residue state is reachable or needed for this alphabet. Answer: 6.

Original paper, page 45 · Answer key