Regular Expressions & Languages

Answer & solution
Official answer: C
Approach: Simplify L2 directly, then prove L1 nonregular using intersection with a carefully chosen regular language.
Every L2 word begins and ends in a and has length at least three. Conversely any such word can use α=a and the nonempty intervening substring as β. Hence L2=a(a|b)+a, which is regular.
For L1 intersect with R={abr aabs:r,s≥1}. R is regular. A word in R has exactly three a’s. If it equals αβα, the two disjoint copies of α cannot each contain two a’s; because α starts at the initial a, it contains exactly one a. It also ends in b, and its suffix copy must start at the third a: starting at the second a would include two a’s. Thus α=abs. This is a prefix exactly when r≥s. The remaining β=br−sa is nonempty. Therefore L1∩R={abr aabs:r≥s≥1}.
If this intersection were regular with pumping length p, choose w=abp aabp. Any pumpable nonempty substring within the first p positions either includes the initial a or consists only of b’s from the first block. Pumping it down in the first case destroys the required initial a; in the second case it reduces r below s. Every permitted decomposition fails, contradicting the pumping lemma.
Regular languages are closed under intersection, so L1 cannot be regular. L2 is regular and L1 is not: C. A repeated substring does not automatically prove nonregularity; the explicit restriction and pumping argument supply the proof.