edited by
97 views

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

0 votes
0 votes
1 answer
1
Unnati Singh asked May 7
91 views
Design a DFA to recognize all strings over {a,b} such that L={awa : w ϵ {a,b}* }.
0 votes
0 votes
0 answers
2
rdrd44 asked May 3
94 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}
1 votes
1 votes
1 answer
4
sripo asked Oct 13, 2018
1,296 views
For the given GrammarS->aA|bBA->bC|aSB->aC|bSC->aB|bA Construct DFA I am getting confused in understanding how to take the final state.