The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
0 votes

L1 = {a^nb^n, n>=0}

L2 = {a^nb^m , n not equal to m)

So how L1 U L2 is regular?


I know, L1 U L2 will have RegEx a*b* which is regular but how this RegEx comes can someone please take strings generated by L1 and L2 and then UNION them, I need to know how to UNION them strings. Thanks

asked in Theory of Computation by Boss (6.5k points) | 59 views

1 Answer

+3 votes
Best answer

A language is a set.

So, $L_{1} = \{a^{n}b^{n} : n \geq 0\}$

Which can be written like this: $\{\epsilon , ab, aabb, aaabbb, aaaabbbb, ... \}$.

And $L_{2} = \{a^{n}b^{m} : n \neq m\}$ 

Which is: $\{aab, abb, aaab, aaabb, abbb, aabbb, ... \}$.

When you union these two languages (or, sets), you get another set, which contains elements (or strings), which is in at least one of the two sets.

From this you can see, the union of these two languages will give:

$\{\epsilon , ab, aabb, aaabbb, aaaabbbb, ... , aab, abb, aaab, aaabb, abbb, aabbb, ... \}$

Which is nothing but the set of strings of the type $a^{*}b^{*}$.

Which is a regular language.

Hope it helps :)

answered by Veteran (10.3k points)
selected by

@Rishabh Gupta 2 Yes, it very much does! Thanks a lot.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

29,966 questions
37,647 answers
35,291 users