Skip to content
Official PYQ · 2014

GATE CS 2014 Set 2 Q15 — Regular and Context-free Languages

Explain with AI

If L1 ={an∣n ≥ 0}L_1\:=\{a^n \mid n\:\geq\:0\}  and L2 ={bn∣n ≥ 0}L_2\:= \{b^n \mid n\:\geq\:0\} , consider 

  1. L1.L2L_1.L_2 is a regular language
  2. L1.L2={anbn∣n ≥ 0}L_1.L_2 = \{a^nb^n \mid n\: \geq \:0\}

Which one of the following is CORRECT?

Choose one option
View worked solution

Answer: A

Let us analyze the two given statements:

Given languages:

  • L1={an∣n≥0}=a∗L_1 = \{a^n \mid n \geq 0\} = a^*
  • L2={bn∣n≥0}=b∗L_2 = \{b^n \mid n \geq 0\} = b^*

Statement I: L1.L2L_1.L_2 is a regular language

The concatenation of L1L_1 and L2L_2 is defined as:

L1.L2=a∗b∗={apbq∣p,q≥0}L_1.L_2 = a^*b^* = \{a^p b^q \mid p, q \geq 0\}

Since a∗b∗a^*b^* can be represented by a regular expression, it is a regular language. Alternatively, because regular languages are closed under concatenation, and both L1L_1 and L2L_2 are regular, their concatenation L1.L2L_1.L_2 must also be regular. Therefore, Statement I is CORRECT.

Statement II: L1.L2={anbn∣n≥0}L_1.L_2 = \{a^n b^n \mid n \geq 0\}

In the concatenation L1.L2L_1.L_2, the powers of aa and bb are chosen independently. That is, L1.L2={apbq∣p,q≥0}L_1.L_2 = \{a^p b^q \mid p, q \geq 0\}.

On the other hand, the language {anbn∣n≥0}\{a^n b^n \mid n \geq 0\} requires the number of aa's and bb's to be strictly equal.

  • For example, the string a1b2∈L1.L2a^1 b^2 \in L_1.L_2 (since a1∈L1a^1 \in L_1 and b2∈L2b^2 \in L_2).
  • However, a1b2∉{anbn∣n≥0}a^1 b^2 \notin \{a^n b^n \mid n \geq 0\}.

Thus, L1.L2≠{anbn∣n≥0}L_1.L_2 \neq \{a^n b^n \mid n \geq 0\}. Therefore, Statement II is INCORRECT.

Hence, only Statement I is correct.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular and Context-free Languages questions