Consider a DFA over accepting all strings which have number of a's divisible by and number of 's divisible by . What is the minimum number of states that the DFA will have?
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:
- DFA : Accepts strings where the number of 's is divisible by . This requires tracking the count of 's modulo , which needs exactly states: .
- DFA : Accepts strings where the number of 's is divisible by . This requires tracking the count of 's modulo , which needs exactly states: .
The product automaton tracks both conditions simultaneously. The state set of is the Cartesian product of the state sets of and :
The total number of states in this product DFA is .
Minimality Proof:
Two states and are equivalent if and only if they behave identically for all future inputs. The only accepting state in the product DFA is .
For any state , the string transitions the DFA to the accepting state . If we apply this same string to a different state , it will transition to , which is accepting if and only if and .
Since every state has a unique distinguishing string that leads to the accepting state, all 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.
