Skip to content
Official PYQ · 2001

GATE CS 2001 Q2.5 — Regular Expressions and Finite Automata

Explain with AI

Consider a DFA over Σ={a,b}\Sigma=\{a,b\} accepting all strings which have number of a's divisible by 66 and number of bb's divisible by 88. What is the minimum number of states that the DFA will have?

Choose one option
View worked solution

Answer: D

To find the minimum number of states in the DFA, we can use the product construction of two simpler DFAs:

  1. DFA M1M_1: Accepts strings where the number of aa's is divisible by 66. This requires tracking the count of aa's modulo 66, which needs exactly 66 states: {0,1,2,3,4,5}\{0, 1, 2, 3, 4, 5\}.
  2. DFA M2M_2: Accepts strings where the number of bb's is divisible by 88. This requires tracking the count of bb's modulo 88, which needs exactly 88 states: {0,1,2,3,4,5,6,7}\{0, 1, 2, 3, 4, 5, 6, 7\}.

The product automaton M=M1×M2M = M_1 \times M_2 tracks both conditions simultaneously. The state set of MM is the Cartesian product of the state sets of M1M_1 and M2M_2:

Q={(r,c)∣0≤r<6 and 0≤c<8}Q = \{ (r, c) \mid 0 \le r < 6 \text{ and } 0 \le c < 8 \}

The total number of states in this product DFA is 6×8=486 \times 8 = 48.

Minimality Proof:

Two states (r1,c1)(r_1, c_1) and (r2,c2)(r_2, c_2) are equivalent if and only if they behave identically for all future inputs. The only accepting state in the product DFA is (0,0)(0,0).

For any state (r,c)(r, c), the string w=a6−rb8−cw = a^{6-r} b^{8-c} transitions the DFA to the accepting state (0,0)(0,0). If we apply this same string ww to a different state (r′,c′)(r', c'), it will transition to ((r′−r) mod 6,(c′−c) mod 8)( (r' - r) \bmod 6, (c' - c) \bmod 8 ), which is accepting if and only if r′=rr' = r and c′=cc' = c.

Since every state has a unique distinguishing string that leads to the accepting state, all 4848 states are pairwise distinguishable. Thus, the DFA is already minimal.

Therefore, the minimum number of states is 48.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular Expressions and Finite Automata questions