[Math] Union of two non-regular languages.

pumping-lemmaregular-language

Can the union of two non-regular languages be regular?? I have $L_1 = \{a^i b^j \mid i > j\}$ and $L_2 = \{a^i b^j \mid i < j\}$. I am using Pumping lemma with $s = a^{p+1} b^p$ for $L_1$ and $s = a^p b^{p-1}$ for $L_2$ and the two are non-regular but I am
not sure that is correct.

Best Answer

Union of two non-regular languages may or may not be non-regular. It may be regular.


Let us assume two Non-regular languages $L_1 = \{a^ib^j|i>=j\}$ and $L_2 = \{a^ib^j|i<j\}$ where $ i,j\ge 0$. But their union is $L = L_1 \cup L_2 = \{a^*b^*\}$, which is regular.