Question

Consider the DFAs MM and NN given below.

State transition diagrams for DFAs M and N, accepting strings ending in a and b respectively
State transition diagrams of DFAs M and N

The number of states in a minimal DFA that accepts the language L(M)∩L(N)L(M) \cap L(N) is _____.

Official answer and solution
Official answer
1
From
Official GATE 2015 answer key

Solution

Find the languages recognized by DFAs M and N, take their intersection, and find the minimum number of states.

  1. Analyze DFA MM:

    • Start state q0q_0, accepting state q1q_1.
    • Any string ending with symbol aa transitions to q1q_1, while any string ending with bb transitions to q0q_0.
    • Hence, L(M)={w∈{a,b}+∣w ends in a}L(M) = \{w \in \{a, b\}^+ \mid w \text{ ends in } a\}.
  2. Analyze DFA NN:

    • Start state p0p_0, accepting state p1p_1.
    • Any string ending with symbol bb transitions to p1p_1, while any string ending with aa transitions to p0p_0.
    • Hence, L(N)={w∈{a,b}+∣w ends in b}L(N) = \{w \in \{a, b\}^+ \mid w \text{ ends in } b\}.
  3. Intersection language L(M)∩L(N)L(M) \cap L(N):

    • A string cannot end simultaneously in aa and in bb.
    • Thus, L(M)∩L(N)=∅L(M) \cap L(N) = \emptyset (the empty language).
  4. Minimal DFA for the empty language:

    • A DFA over alphabet {a,b}\{a, b\} that accepts ∅\emptyset requires only a single non-accepting state with self-loops on both aa and bb.
    • Hence, the minimal DFA contains exactly 11 state.
Final answer

1

Common trap

Constructing the Cartesian product DFA (2 x 2 = 4 states) without minimizing it to 1 trap state.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 1
Question
62 of 65, printed as CS Q.52
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.