Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Theory of Computation
  • Regular expressions
  • Easy

Which language over {a, b} is regular?

Regular Languages

Pick an option to check your answer.

{ambn}\{a^m b^n\} with independent m,nm, n is exactly the regular expression a∗b∗a^*b^*, so it is regular.

Why not the others

  • {anbn}\{a^n b^n\} needs unbounded counting; the pumping lemma shows it is not regular (it is context-free).
  • {ww}\{ww\} needs to remember all of ww; it is not even context-free.
  • {ap}\{a^p\} with pp prime is not regular — prime lengths are not ultimately periodic.

Report an error

GATE CS · Theory of Computation · Regular Languages