The language L of strings over alphabet I = {0,1} which (in binary) represent even numbers is a regular language. Show this by giving both (a) a regular expression and (b) drawing a finite state automaton (FSA) that recognizes strings from this language. Since regular languages are also context-free, give (c) a context-free grammar for this language L. Finally, (d) is the language of binary strings which represent odd numbers a regular language? If so, show why this is without resorting to regular expressions or FSAs.

Note: that you need not worry about leading zeros, in any of the above, e.g., 1010, 01010, 001010, 0001010, ... all represent the number ten (and are even). That is, the regular expression (a) or context-free grammar (c) may generate strings with leading zeros (which represent only even numbers, of course), and the FSA (b) may recognize such strings.

Q&A Education