Similar questions 1 more → · asked again: GATE 1994, Q19(b)
Closure Properties & Language Hierarchy


Shared context
Given that language A is regular and A∪B is regular, must B be regular? Justify.
Answer & solution
Answer: No: take A={0,1}* and B={0ⁿ1ⁿ:n≥0}. (no official key was published)
Let the alphabet be {0,1}. Choose A={0,1}*, a regular language, and B={0ⁿ1ⁿ:n≥0}, which is not regular. Because B⊆A, the union A∪B equals A and is regular.
For completeness, B is nonregular by the pumping lemma: for pumping length p, any allowed pumped substring in 0ᵖ1ᵖ lies among the initial p zeros, and pumping it down changes the number of zeros without changing the p ones. The resulting word is not in B.
Closure under difference only proves (A∪B)\A=B\A is regular. It gives no control over the possibly nonregular part B∩A. This is precisely why reversing union closure fails.