retagged by
1,787 views
5 votes
5 votes
Construct two nonregular languages $L_1$ and $L_2$ such that $L_1 \cup L_2$ is regular.

Prove that the languages $L_1$ and $L_2$ constructed above are nonregular and $L_1 \cup L_2$ is regular.
retagged by

4 Answers

Best answer
8 votes
8 votes

Consider a language $ L_1=\left \{ a^{n} b^{n} \mid n\geq 0 \right \}$ is a non regular language .

And take another language $ L_2={L_1}^{c}$  which is also non regular .(Since regular set is  closed under complementation.)

As we know the union of any language and its complement is $\Sigma^*$.

So, $L_1\cup L_2=\Sigma^*$ and this is regular.

edited by
2 votes
2 votes

Consider a language L1={anbm ,n≥m for all +ve integer} is a non regular language .

Consider a language L2={anbm ,m≥n for all +ve integer} is a non regular language .

L1∪L2 gives you a+bis regular.

0 votes
0 votes
Let Σ={a}

Let L1 ={a^p| p is prime}   and L2 = {a^q| q is not prime}

L1UL2 =  Σ*   – Regular
0 votes
0 votes

Consider any non-regular language, call it L1 , and now consider L2 as complement of L1, L2 will also be non-regular by closure property, now L1 $L1 \bigcup L2$ is always regular ( equal to sigma*) 

Related questions

12 votes
12 votes
1 answer
1
go_editor asked May 30, 2016
1,212 views
Construct a context free grammar (CFG) to generate the following language:$L = \{a^nb^mc^{n+m}: \text{n, m are integers, and } n \geq 1, m \geq 1 \}$
4 votes
4 votes
3 answers
4