Will it be a^{n}b^{m}..??

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+16 votes

If $L_1\:=\{a^n \mid n\:\geq\:0\}$ and $L_2\:= \{b^n \mid n\:\geq\:0\}$ , consider

- $L_1.L_2$ is a regular language
- $L_1.L_2 = \{a^nb^n \mid n\: \geq \:0\}$

Which one of the following is CORRECT?

- Only I
- Only II
- Both I and II
- Neither I nor II

+38 votes

Best answer

**Option A.**

$L_1 = \{ \varepsilon, a, aa, aaa, aaaa, \ldots \}$

$L_2 = \{ \varepsilon, b, bb, bbb, bbbb, \ldots \}$

$\begin{align}

L_1 \cdot L_2 &= \left \{ \begin{array}{c} \varepsilon , \\ a, &b,\\ aa, &ab, &bb\\ aaa, &aab, &abb, &bbb,\\ aaaa, &aaab, &aabb, &abbb, &bbbb, & \ldots \end{array}\right \}\\[1em]

L_1 \cdot L_2 &= a^*b^*

\end{align}$

Thus, $L_1 \cdot L_2$ is Regular.

(Also, since both $L_1$ and $L_2$ are Regular, their concatenation has to be Regular since Regular languages are closed under concatenation)

However, $L_1 \cdot L_2 \neq a^nb^n$. This is because in $a^*b^*$, the number of $a$'s and $b$'s can be different whereas in $a^nb^n$ they have to be the same.

- All categories
- General Aptitude 1.5k
- Engineering Mathematics 7.1k
- Digital Logic 2.7k
- Programming & DS 4.9k
- Algorithms 4.2k
- Theory of Computation 5.3k
- Compiler Design 2.1k
- Databases 4k
- CO & Architecture 3.5k
- Computer Networks 4k
- Non GATE 1.4k
- Others 1.5k
- Admissions 559
- Exam Queries 555
- Tier 1 Placement Questions 23
- Job Queries 69
- Projects 18

47,935 questions

52,336 answers

182,392 comments

67,819 users