Discrete Mathematics with Applications 4th Edition

Published by Cengage Learning
ISBN 10: 0-49539-132-8
ISBN 13: 978-0-49539-132-6

Chapter 5 - Sequences, Mathematical Induction, and Recursion - Exercise Set 5.9 - Page 335: 17

Answer

See explanation

Work Step by Step

Below is one natural (and quite standard) recursive definition for the set of all strings over \(\{a,b\}\) that contain an **odd** number of \(a\) s. Let us call this set \(S\). --- ## **Recursive Definition** 1. **Base Case** \[ a \in S. \] (The string consisting of the single letter \(a\) clearly has exactly one \(a\), which is odd.) 2. **Recursive Step A (Adding \(b\)s on the outside)** If \(x \in S,\) then \[ b x \in S \quad\text{and}\quad x b \in S. \] Appending \(b\) on the left or right does not change the number of \(a\) s, so it remains odd. 3. **Recursive Step B (Adding pairs of \(a\)s on the outside)** If \(x \in S,\) then \[ a\,x\,a \in S. \] If \(x\) has an odd number of \(a\) s, then adding two more \(a\) s (one on each end) keeps the total count of \(a\) s odd. 4. **Restriction** No other strings are in \(S\) except those obtained by finitely many applications of Rules 1–3. In words: - We start with the one‐letter string \(\texttt{a}\). - We can insert \(\texttt{b}\) on the left or right as often as we like (which keeps the number of \(a\) s unchanged). - We can also wrap an existing odd‐\(a\) string with \(\texttt{a}\) on both ends (which adds 2 more \(a\) s, thus preserving oddness). - Every string in \(S\) must be built by these rules (and no others). --- ## **Why This Captures All Strings with an Odd Number of \(a\) s** 1. **All generated strings indeed have an odd number of \(a\) s.** - The base string \(a\) has exactly 1 \(a\). - Adding \(b\) on either side does not affect the count of \(a\) s. - Adding \(a\) on both sides increases the count of \(a\) s by 2, which keeps it odd. 2. **Every string with an odd number of \(a\) s can be built.** One proves by induction (on the length of the string, or on the number of \(a\) s) that if a string \(w\) has an odd number of \(a\) s, then \(w\) can be obtained by starting from \(a\) and repeatedly applying the two rules: - Peel off any leading or trailing \(b\) s (in reverse, that corresponds to adding \(b\) s at the front or back). - If there is more than one \(a\), one can peel off a matching pair \(\texttt{a}\) from the front and \(\texttt{a}\) from the back (in reverse, that corresponds to adding \(a\) on both sides). Eventually, you reduce to the single letter \(a\). Reversing these steps shows how to build \(w\) from \(a\). Hence \(S\) is *exactly* the set of all strings over \(\{a,b\}\) whose number of \(a\) s is odd.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.