GateAI
Regular Expressions and Finite Automata

GATE CSE 2025 Set 2 · Q60

NAT2 marksMedium

Time

Let Σ={1,2,3,4}\Sigma = \{1,2,3,4\}. For x∈Σ∗x \in \Sigma^*, let prod(x)prod(x) be the product of symbols in xx modulo 7. We take prod(ϵ)=1prod(\epsilon) = 1, where ϵ\epsilon is the null string. For example, prod(124)=(1×2×4) mod 7=1prod(124) = (1 \times 2 \times 4) \bmod 7 = 1. Define L={x∈Σ∗∣prod(x)=2}L = \{x \in \Sigma^* \mid prod(x) = 2\}. The number of states in a minimum state DFA for LL is __________. (Answer in integer)

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 6

Regular Expressions and Finite Automata

To accept the language L={x∈Σ∗∣prod(x)=2}L = \{x \in \Sigma^* \mid prod(x) = 2\}, we track the running product of the input string modulo 77.

  1. Possible States / Residues: The initial state corresponds to the empty string ϵ\epsilon, whose product modulo 77 is 11. Since Σ={1,2,3,4}\Sigma = \{1, 2, 3, 4\} and 77 is prime, we consider the reachable residues in Z7×={1,2,3,4,5,6}\mathbb{Z}_7^\times = \{1, 2, 3, 4, 5, 6\}:

    • From state 11:

      • 1×1≡11 \times 1 \equiv 1

      • 1×2≡21 \times 2 \equiv 2

      • 1×3≡31 \times 3 \equiv 3

      • 1×4≡41 \times 4 \equiv 4

    • From state 22:

      • 2×3≡62 \times 3 \equiv 6

      • 2×4≡8≡12 \times 4 \equiv 8 \equiv 1

    • From state 33:

      • 3×4≡12≡53 \times 4 \equiv 12 \equiv 5

    Thus, all 66 non-zero residues {1,2,3,4,5,6}\{1, 2, 3, 4, 5, 6\} are reachable from the start state 11.

  2. Distinguishability of States: Let qrq_r denote the state where the current product is r∈{1,2,3,4,5,6}r \in \{1, 2, 3, 4, 5, 6\}. The only accepting state is q2q_2. For any two distinct states qr1q_{r_1} and qr2q_{r_2} (r1≠r2r_1 \neq r_2): Because Z7×\mathbb{Z}_7^\times is a finite group generated by elements in Σ\Sigma (e.g., 33 is a primitive root modulo 77), every residue rr has a multiplicative inverse modulo 77. There exists a string y∈Σ∗y \in \Sigma^* such that r1⋅prod(y)≡2(mod7)r_1 \cdot prod(y) \equiv 2 \pmod 7, which transitions qr1q_{r_1} to the accepting state q2q_2. For the same string yy, starting from qr2q_{r_2} leads to $r_2 \cdot prod(y)

ot\equiv 2 \pmod 7(since (since r_1 ot\equiv r_2 \pmod 7).Hence,all). Hence, all 6$ reachable states are pairwise distinguishable by the Myhill-Nerode theorem.

Therefore, the number of states in the minimal DFA is 6.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Regular Expressions and Finite Automata previous year question is Q60 of the GATE CSE 2025 Set 2 paper. Find more GATE CSE PYQs on Regular Expressions and Finite Automata in Theory of Computation, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Regular Expressions and Finite Automata PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Regular Expressions and Finite Automata in GATE CSE

Regular Expressions and Finite Automata has 41 GATE CSE PYQs across 24 papers from 2011 to 2026. 6 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2025 Set 2.

How GATE tests Regular Expressions and Finite Automata

More from GATE CSE 2025 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 2 · Q60 · NAT

Let = {1,2,3,4}. For x ∈ *, let prod(x) be the product of symbols in x modulo 7. We take prod( ) = 1, where is the null string. For example, prod(124) = (1 × 2 × 4) mod 7 = 1. Define L = {x ∈ * prod(x) = 2}. The number of states in a minimum state DFA for L is … (Answer in integer)

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.