Regular Languages Practice Problems

For each of the languages below, determine whether or not the language is regular. If it is regular, create a finite automaton and a regular expression that recognizes it. If it is not regular, prove it.

  1. \(L = \{\texttt{hi}, \texttt{bye}\}\)

  2. \(\Sigma = \{\texttt{0}, \texttt{1}\}\), \(L = \{w | w\) contains three times as many \(\texttt{1}\)s as it does \(\texttt{0}\)s \(\}\)

  3. \(\Sigma = \{\texttt{a}, \texttt{b}\}\), \(L = \{w | w\) ends in \(\texttt{ab}\}\)

  4. \(\Sigma = \{\texttt{a}, \texttt{b}\}\), \(L = \{w | w\) does not end in \(\texttt{ab}\}\)

  5. \(\Sigma = \{\texttt{(}, \texttt{)}\}\), \(L = \{w | w\) contains an equal number of \(\texttt{(}\)s and \(\texttt{)}\)s, and every prefix of \(w\) contains at least as many \(\texttt{(}\)s as it does \(\texttt{)}\)s \(\}\)

  6. \(\Sigma = \{\texttt{a}\}\), \(L = \{w | w = \texttt{a}^{3k}\), for every integer \(k \ge 0 \}\)

  7. \(\Sigma = \{\texttt{a}, \texttt{b}\}\), \(L = \{w | w = w^R\}\)