jonroberts74
- 189
- 0
Homework Statement
Let S bet the set of all string's of 0's and 1's. define D: S --> Z as follows : for all s in S, D(s) = the numbers of 1's in s minus the number of 0's in s.
a) Is D 1-1? Prove or give counterexample
b) Is D onto? Prove or give counter example
Homework Equations
The Attempt at a Solution
a) seems easy enough.
D(s_{i}) = 5[ones]-5[zeros]=0; s_{i} \in S
D(s_{j}) = 6[ones]-6[zeros] = 0; s_{j} \in S
s_{i} \neq s_{s}
thus not 1-1
b) It seems to be true.
only proof I could think up would to be
let s_{k} \in S such that the numbers of ones is and zeros in s_{k} is k_{1}, k_{0} \in \mathbb{Z} respectively.
now, D(s_{k}) = k_{1} - k_{0}
and because integers have closure under subtraction k_{1} - k_{0} = k_{z} such that
k_{z} \in \mathbb{Z}
therefore D(s) is an onto function