edited by
239 views
0 votes
0 votes
Construct a DFA with minimum number of states, accepting all strings over {a, b} such that the number of a’s is divisible by three and the number of b’s is divisible by two.
edited by

2 Answers

1 votes
1 votes

The DFA over {a,b} such that the number of a's is divisible by 3 and the number of b's is divisible

by 2 will be 

Total Number of States will be = 6

 


NOTE : The number of states in DFA such that number of a's divisible by m, number of 

b's divisible by n then total number of states will be mn.

Similarly, The number of states in DFA such that number of a's divisible by m, number of 

b's divisible by n & number of c's divisible by r then total number of states will be mnr.


 

0 votes
0 votes
To construct a DFA (Deterministic Finite Automaton) with the minimum number of states that accepts all strings over the alphabet {a, b} such that the number of a's is divisible by three and the number of b's is divisible by two, we can use the concept of modular arithmetic.

We need to keep track of two pieces of information:

1. The remainder when the number of a's is divided by 3 (0, 1, or 2)
2. The remainder when the number of b's is divided by 2 (0 or 1)

Since there are three possible remainders for the number of a's and two possible remainders for the number of b's, we need a total of 3 × 2 = 6 states to represent all possible combinations.

The DFA with the minimum number of states will have the following structure:

States:
- q0: Remainder of a's modulo 3 = 0, remainder of b's modulo 2 = 0 (start state)
- q1: Remainder of a's modulo 3 = 1, remainder of b's modulo 2 = 0
- q2: Remainder of a's modulo 3 = 2, remainder of b's modulo 2 = 0
- q3: Remainder of a's modulo 3 = 0, remainder of b's modulo 2 = 1
- q4: Remainder of a's modulo 3 = 1, remainder of b's modulo 2 = 1
- q5: Remainder of a's modulo 3 = 2, remainder of b's modulo 2 = 1

Transitions:
- From q0: Read 'a' → q0, Read 'b' → q3
- From q1: Read 'a' → q2, Read 'b' → q4
- From q2: Read 'a' → q0, Read 'b' → q5
- From q3: Read 'a' → q1, Read 'b' → q0
- From q4: Read 'a' → q2, Read 'b' → q1
- From q5: Read 'a' → q0, Read 'b' → q2

Final states:
- q0: Accepts strings where the number of a's is divisible by 3 and the number of b's is divisible by 2.

The DFA with the minimum number of states has 6 states and accepts all strings over {a, b} such that the number of a's is divisible by three and the number of b's is divisible by two.

Related questions

56
views
0 answers
0 votes
Ramkrishna Sahu asked 6 days ago
56 views
construct a minimal DFA for the regular language L= {W | w contain 'a' in every odd position, w∈{a,b}* }
154
views
1 answers
0 votes
Unnati Singh asked May 7
154 views
Design a DFA to recognize all strings over {a,b} such that L={awa : w ϵ {a,b}* }.
189
views
1 answers
0 votes
rdrd44 asked May 3
189 views
Design a DFA (Deterministic Finite Automaton) that recognizes the language L defined follows: L= {w -> {a, b}* | every a in w is immediately followed by bb}
215
views
0 answers
0 votes
rania asked Feb 14
215 views
Each of the following languages is the complement of a simpler language.In each part, construct a DFA for the simpler language, then use it to give the state diagram of a DFA for the ... not in $a^{*}\cup b^{*}$ } ( ∪ is the union )