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: 15

Answer

**Definition.** Let \(S\) be the smallest set of binary strings satisfying: > 1. \(\epsilon \in S.\) > 2. If \(x \in S,\) then \(0x1 \in S\) and \(1x0 \in S.\) > 3. If \(x,y \in S,\) then \(xy \in S.\) > 4. No other strings are in \(S\) besides those obtained by 1–3. One proves that \(S\) is *exactly* the set of all strings over \(\{0,1\}\) with the same number of 0’s and 1’s.

Work Step by Step

Below is a common (and very natural) “parenthesis‐style” recursive definition for the set of **all** binary strings (strings of 0’s and 1’s) that contain an equal number of 0’s and 1’s. Let us call this set \(S\). --- ## **Recursive Definition** 1. **Base Case** The empty string \(\epsilon\) is in \(S\). \[ \epsilon \in S. \] (Clearly, \(\epsilon\) has zero 0’s and zero 1’s.) 2. **Wrapping Rule** If \(x \in S\), then you can “wrap” \(x\) by adding a 0 at one end and a 1 at the other—or vice versa—and the result is still in \(S\). Formally, \[ x \in S \;\Longrightarrow\; 0\,x\,1 \in S \quad\text{and}\quad 1\,x\,0 \in S. \] Each such wrapping adds exactly one new 0 and one new 1, so the resulting string still has the same number of 0’s and 1’s. 3. **Concatenation Rule** If \(x \in S\) and \(y \in S\), then the concatenation \(xy\) is in \(S\). Formally, \[ x,y \in S \;\Longrightarrow\; x\,y \in S. \] Concatenating two strings that each have an equal number of 0’s and 1’s again yields a string whose total number of 0’s equals its total number of 1’s. 4. **Restriction** No other strings are in \(S\) except those generated by the three rules above. In words, \(S\) is the *smallest* set of binary strings that: - Starts with the empty string. - Is closed under “adding a matching pair” \((0,1)\) or \((1,0)\) around an already‐valid string. - Is closed under concatenation of already‐valid strings. --- ## **Why This Captures *All* Strings with Equal 0’s and 1’s** 1. **Every string in \(S\) has equally many 0’s and 1’s** - The base string \(\epsilon\) has 0 zeros and 0 ones. - Wrapping a valid string \(x\) with \((0,\dots,1)\) or \((1,\dots,0)\) increases both the count of 0’s and 1’s by 1. - Concatenating two valid strings simply adds up their (equal) numbers of 0’s and 1’s. Thus all strings produced by these rules must have the same number of 0’s and 1’s. 2. **Every string with equally many 0’s and 1’s can be built by these rules** One shows by induction on the length of a string \(w\) (which must be even) that if \(w\) has the same number of 0’s and 1’s, then \(w\) can be formed by starting with \(\epsilon\) and applying a finite sequence of (a) wrapping steps and (b) concatenations. - **Sketch**: - If \(|w|=0\), then \(w=\epsilon\), already in \(S\). - If \(|w|\ge 2\), pick any nonempty factorization \(w = uv\) so that each of \(u\) and \(v\) also has the same number of 0’s and 1’s. (For example, one can split \(w\) at a point where the partial count of 0’s and 1’s is equal.) By the induction hypothesis, \(u,v \in S\). Then by the concatenation rule, \(uv = w \in S\). - Or, in a smaller step, one can see that “peeling off” a matching pair of 0 and 1 from the ends (in either order) corresponds to the wrapping rule. Either way, one can systematically reconstruct any balanced‐count string from \(\epsilon\) by a combination of wrapping and concatenation. Hence, *all* and *only* those binary strings with equally many 0’s and 1’s arise from the above recursive rules.
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.