Let 𝐿1 be the language represented by the regular expression π‘βˆ—π‘Žπ‘βˆ—β€¦

2024

Let 𝐿1 be the language represented by the regular expression π‘βˆ—π‘Žπ‘βˆ— (π‘Žπ‘βˆ—π‘Žπ‘βˆ—)βˆ— and 𝐿2 = { 𝑀 ∈ (π‘Ž + 𝑏)βˆ— | |𝑀| ≀ 4}, where |𝑀| denotes the length of string 𝑀. The number of strings in 𝐿2 which are also in 𝐿1 is ___________

Answer: 15 β€” Key insight: the language L1 consists exactly of all strings over {a,b} that contain an odd number of a's (at least one). Reason: The expression b* a b* (a b*…

Attempted by 86 students.

Show answer & explanation

Correct answer: 15

Key insight: the language L1 consists exactly of all strings over {a,b} that contain an odd number of a's (at least one).

Reason: The expression b* a b* (a b* a b*)* has one initial a and each repetition adds two a's, so the total number of a's is 1 + 2k (always odd).

  • Length 0: 0 strings in L1 (no a's).

  • Length 1: 1 string with an odd number of a's (a).

  • Length 2: 2 strings with an odd number of a's (exactly one a).

  • Length 3: 4 strings with an odd number of a's.

  • Length 4: 8 strings with an odd number of a's.

Total: 1 + 2 + 4 + 8 = 15 strings.

A video solution is available for this question β€” log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…