[Math] recursive definition of a palindrome help

calculuscontest-mathdiscrete mathematicspalindrome

  1. Recall that a bit string is a string using the alphabet {0, 1}. A palindrome is a string that is equal to the reversal of itself. Consider the following recursive definition of a palindrome:
    Basis Step: λ (the empty string) is a palindrome.

Recursive Step: If w is a palindrome and x ∈ {0, 1}, then xwx is a palindrome.

There is a problem with this definition. Identify and state the problem. Then fix the problem by providing a new and correct recursive definition.

Best Answer

If you try generating palindromes using the given definition, you'll get a set that looks something like: $\{\lambda, 00, 11, 0000, 1001, 0110, 1111, 000000, 100001, 010010, 110011, 001100, 101101, 011110, 111111, \dots \}$. In fact, all of the strings in this list have an even length. The reason why should be pretty clear - you're starting with a 0-length string, and always adding 2 more bits. So you'll never reach an odd-length string like $101$.

What are the shortest odd-length palindromes? They're the single bits, $0$ and $1$. You definitely can't reach them from the basis and the given recursion rule, so you either have to change the basis or the recursion to include them in the set. Which one makes more sense?