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 Loyal (9.3k points) | 81 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 Boss (15.2k points)
selected by

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

Related questions

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

44,072 questions
49,594 answers
65,788 users