Which of these is an example of an IRREGULAR (non-regular) language?
AStrings over $\{0,1\}$ with at least three 0's
BBinary representations of multiples of 3
CStrings $w$ such that $|w| \bmod 5 = 2$
D$L = \{a^n b^n \mid n \geq 0\}$
Answer & Solution
Correct answer: D. $L = \{a^n b^n \mid n \geq 0\}$
1. To prove $L = \{a^n b^n \mid n \geq 0\}$ is non-regular, apply the Pumping Lemma.
2. Suppose $L$ is regular with pumping length $p$. Consider $s = a^p b^p \in L$ with $|s| = 2p \geq p$.
3. By the lemma, $s = xyz$ with $|xy| \leq p$ and $|y| \geq 1$.
4. Since $|xy| \leq p$ and $s$ starts with $p$ a's, both $x$ and $y$ lie within the $a$-prefix. So $y$ consists of only $a$'s.
5. Pump up: $xy^2z$ has MORE a's than b's — not in $L$. Contradiction.
6. So $L$ is NOT regular. ✓ Option D.
7. Options A, B, C are all regular (constructible DFAs):
- At least three 0's: 4-state DFA tracking count up to 3.
- Multiples of 3: 3-state DFA tracking remainder.
- $|w| \bmod 5 = 2$: 5-state DFA tracking length mod 5.
_Source: Jeff Erickson, "Models of Computation", §2.10 (Pumping Lemma application to $a^n b^n$)._
Keep practising Theory of Computation
Browse all Theory of Computation questions for GATE CSE, or explore more Computer Science topics.
Related questions
Which class of grammars generates ALL recursively enumerable languages?Which of the following languages is CONTEXT-FREE?Consider the grammar $S \to (S) \mid SS \mid \varepsilon$. The language generated isEvery regular language is also context-free. The PROOF construction isThe CYK algorithm parses a CFG in CNF. Its time complexity for a string of length $n$ isContext-free languages are RECOGNISED by which type of machine?A CFG is AMBIGUOUS ifConsider the CFG with rule $S \to aSb \mid \varepsilon$. The language generated is