Discrete Mathematics with Applications 4th Edition

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

Chapter 7 - Functions - Exercise Set 7.2 - Page 416: 51

Answer

No inverse

Work Step by Step

Given the function \[ D : S \;\to\; \mathbb{Z} \quad\text{by}\quad D(s) = \bigl(\text{number of 0’s in }s\bigr)\;-\;\bigl(\text{number of 1’s in }s\bigr), \] where \(S\) is the set of all finite strings of 0’s and 1’s, and \(\mathbb{Z}\) is the set of all integers. We want to determine whether \(D\) is one-to-one (injective) and whether it is onto (surjective). --- ## (a) Is \(D\) one-to-one (injective)? A function \(D\) is injective if whenever \(D(s_1) = D(s_2)\), it follows that \(s_1 = s_2\). - **Counterexample**: - Consider the string \(s_1 = "0"\). It has 1 zero and 0 ones, so \(D("0") = 1 - 0 = 1.\) - Consider another string \(s_2 = "001"\). It has 2 zeros and 1 one, so \(D("001") = 2 - 1 = 1.\) Here \(D(s_1) = D(s_2) = 1\), but clearly \(s_1 = "0"\) and \(s_2 = "001"\) are different strings. Hence \(D\) is **not** injective. --- ## (b) Is \(D\) onto (surjective)? A function \(D\) is surjective if for **every** integer \(n \in \mathbb{Z}\), there is **some** string \(s \in S\) with \(D(s) = n\). - **Constructing a preimage for an arbitrary integer \(n\)**: - If \(n = 0\), we can take \(s\) to be the empty string (which has 0 zeros and 0 ones, difference \(0\)). - If \(n > 0\), pick a string of \(n\) zeros and no ones (e.g., \("00\cdots0"\) with \(n\) zeros). Then \(D(s) = n - 0 = n.\) - If \(n < 0\), say \(n = -k\) for \(k>0\). Pick a string of \(k\) ones and no zeros (e.g., \("11\cdots1"\) with \(k\) ones). Then \(D(s) = 0 - k = -k = n.\) In all cases, we can construct a string whose 0/1 difference is \(n\). Thus \(D\) **is** onto \(\mathbb{Z}\). --- ### Conclusion - \(D\) is **not** one-to-one. - \(D\) **is** onto (surjective).
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.