D: S --> Z, the string of all 1's and zeros

  • Thread starter jonroberts74
  • Start date
  • Tags
    String
In summary: There are simpler strings that work for k = 1, -1, and 0. Think about the number of ones and zeros in each of these strings. Can you generalize this pattern for any integer k?Yes, I think you are on the right track now. Just make sure to include the case where k=0 as well. Good luck!In summary, we defined a function D on the set of all strings of 0's and 1's that counts the number of 1's and subtracts the number of 0's, and we wanted to determine if it was 1-1 or onto. Through examples and patterns, we found that D is not 1-1, but it is onto since for any
  • #1
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.

[tex]D(s_{i}) = 5[ones]-5[zeros]=0; s_{i} \in S[/tex]

[tex] D(s_{j}) = 6[ones]-6[zeros] = 0; s_{j} \in S[/tex]
[tex]s_{i} \neq s_{s}[/tex]

thus not 1-1

b) It seems to be true.

only proof I could think up would to be

let [tex] s_{k} \in S[/tex] such that the numbers of ones is and zeros in [tex]s_{k}[/tex] is [tex]k_{1}, k_{0} \in \mathbb{Z}[/tex] respectively.

now, [tex] D(s_{k}) = k_{1} - k_{0}[/tex]

and because integers have closure under subtraction [tex]k_{1} - k_{0} = k_{z}[/tex] such that
[tex]k_{z} \in \mathbb{Z}[/tex]

therefore D(s) is an onto function
 
Physics news on Phys.org
  • #2
jonroberts74 said:

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


b) It seems to be true.

only proof I could think up would to be

let [tex] s_{k} \in S[/tex] such that the numbers of ones is and zeros in [tex]s_{k}[/tex] is [tex]k_{1}, k_{0} \in \mathbb{Z}[/tex] respectively.

now, [tex] D(s_{k}) = k_{1} - k_{0}[/tex]

and because integers have closure under subtraction [tex]k_{1} - k_{0} = k_{z}[/tex] such that
[tex]k_{z} \in \mathbb{Z}[/tex]

therefore D(s) is an onto function

This is not correct. You need to show that for any [tex]k \in \mathbb{Z}[/tex] there is an s in S such that D(s) = k.
 
  • #3
PeroK said:
This is not correct. You need to show that for any [tex]k \in \mathbb{Z}[/tex] there is an s in S such that D(s) = k.


let [tex] k \in Z[/tex] such that [tex] D(s) = k[/tex]

this is where I am stuck now. If I were dealing with a function like f(x) = y = 4x-1. I would solve for x, substitute that in and I'd be able to solve to get back to y.

here I have D(s) = k = [number of ones] - [number of zeros]
 
  • #4
jonroberts74 said:
let [tex] k \in Z[/tex] such that [tex] D(s) = k[/tex]

this is where I am stuck now. If I were dealing with a function like f(x) = y = 4x-1. I would solve for x, substitute that in and I'd be able to solve to get back to y.

here I have D(s) = k = [number of ones] - [number of zeros]

No. You start by taking an arbitrary ##k \in \mathbb{Z}##. Then you need to find a string ##s## in ##S## such that ##D(s) = k##. Can you find such a string?
 
  • #5
let k be any integer

let s in S have (k+j) ones and j zeros

now,
D(s) = (k+j) - j = k
 
  • #6
jonroberts74 said:
let s have (k+j) ones and j zeros

D(s) = (k+j) - j = k

You are on the right track, but what is ##j## here? Do you need it? It might also help if you consider the cases ##k>0##, ##k<0## and ##k=0## separately.
 
  • #7
If k > 0 then number of ones > number of zeros

if k = 0 then number of ones = the number zeros

if k < 0 then number of ones < number of zeros

and so j is the value difference between number of ones and number of zeros. I'm not sure How I could show it without using it.
 
  • #8
I don't mean to butt in, but I think you're maybe trying to be a little too general and making this more difficult than it really is. You just need to find, for each ##k##, one string ##s## satisfying ##D(s)=k##. I would encourage you to write down a few specific examples; find specific strings - i.e. write down strings of ##0##s and ##1##s - satisfying ##D(s)=1##, ##D(s)=-1##, ##D(s)=2##, ##D(s)=-2## ... Try to find a pattern that works - it's been suggested that the "easiest" patterns may be different for positive and negative numbers - and go with it.
 
  • #9
gopher_p said:
I don't mean to butt in, but I think you're maybe trying to be a little too general and making this more difficult than it really is. You just need to find, for each ##k##, one string ##s## satisfying ##D(s)=k##. I would encourage you to write down a few specific examples; find specific strings - i.e. write down strings of ##0##s and ##1##s - satisfying ##D(s)=1##, ##D(s)=-1##, ##D(s)=2##, ##D(s)=-2## ... Try to find a pattern that works - it's been suggested that the "easiest" patterns may be different for positive and negative numbers - and go with it.

I'm not sure what you mean by too general. only patterns I see is if there's more zeros then k is negative, if there's an equal amount of ones and zeros then k = 0 and if there are more ones then k is positive which is what I said in my last post.

101010 would yield k = 0

1100110 yields k =1

and 1000101 yields k = -1
 
  • #10
jonroberts74 said:
I'm not sure what you mean by too general. only patterns I see is if there's more zeros then k is negative, if there's an equal amount of ones and zeros then k = 0 and if there are more ones then k is positive which is what I said in my last post.

101010 would yield k = 0

1100110 yields k =1

and 1000101 yields k = -1
There are some simpler strings you could try. For example, what are D(1), D(11), D(111), ...?
 
  • #11
they'd be k =1,2,3 respectively and they contain no zeros. so there's strings that have no ones or no zeros but that's covered

if k < 0 then number of ones < number of zeros and If k > 0 then number of ones > number of zeros

seems to me the best is still to say

let s in S such that s has (k+j) ones and j zeros where k,j in Z

now D(s) = (k+j) - j = k
 
  • #12
Okay. So the definition of onto is: A function ##f : A \rightarrow B## is said to be onto if, for every ## b \in B## there is an ##a \in A## such that ##f(a) = b##.

Your job is then to take an arbitrary ##k \in \mathbb{Z}## which you fix and then find a string ##s## in ##S## such that ##D(s) = k##. Since your ##k## was chosen arbitrarily, it must then hold for all ##k## in ##\mathbb{Z}##. Given a fixed ##k## you only need to find ONE string. When you introduce ##j## you are introducing a whole family of strings, which is not necessary and thus looks bad.

You also forgot to consider the cases when either ##(j + k) ## or ##j## is negative.
 
  • #13
okay I see the issue with j.

one string could be

11111 and D(11111)=5, 5 in Z

like that? almost like finding a counterexample
 
  • #14
jonroberts74 said:
okay I see the issue with j.

one string could be

11111 and D(11111)=5, 5 in Z

like that? almost like finding a counterexample

No. You need to treat all ##k## at the same time. I will try to outline it for you.

"We take any ##k \in \mathbb{Z}##. Now consider the string ##s = ? ## in ##S##. Then ##D(s) = k##."

I suggested that it would be easier to find strings if we consider the cases ##k>0##, ##k<0## and ##k= 0## separately. Then the proof could look something like:

"Take any ##k## in ##\mathbb{Z}##. Then exactly one of ##k>0##, ##k<0## and ##k=0## is true. We will consider each case separately.

First, if ##k=0##, we take the string ##s = 10.## Then ##D(s) = 0 = k##.

Second, if ##k>0##, we take the string ##s = ...##

Third, if ##k < 0##, ..."

Can you fill in the dots?
 
  • Like
Likes 1 person
  • #15
Actually, let me give a simple example where I prove that a function is onto.

Consider the function ##g : \mathbb{Z} \rightarrow \mathbb{Z}## given by ##g(k) = k + 1.## Show that ##g## is onto.

Solution: Take any ## k \in \mathbb{Z}## (the codomain). We need to find an element ##l## in ##\mathbb{Z}## (the domain) such that ##g(l) = k##. Therefore, take ##l = k - 1##. Then ##g(l) = g(k - 1) = k - 1 + 1 = k##.

Look at the definition of onto that I wrote in an above post. Can you see why the argument I just gave shows that ##g## is onto?
 
  • #16
jonroberts74 said:
they'd be k =1,2,3 respectively and they contain no zeros. so there's strings that have no ones or no zeros but that's covered

if k < 0 then number of ones < number of zeros and If k > 0 then number of ones > number of zeros

seems to me the best is still to say

let s in S such that s has (k+j) ones and j zeros where k,j in Z

now D(s) = (k+j) - j = k
Well, to prove surjectivity, you only need one example for each ##k##. Seems to me the simplest string that works for a given positive ##k## is simply the string containing ##k## ones and no zeros. What about for negative ##k##?
 
  • #17
jbunniii said:
Well, to prove surjectivity, you only need one example for each ##k##. Seems to me the simplest string that works for a given positive ##k## is simply the string containing ##k## ones and no zeros. What about for negative ##k##?

for a negative k, it would be a string containing all zeros and no ones,

for a k = 0, the string would contain equal number of ones and zeros
 

FAQ: D: S --> Z, the string of all 1's and zeros

1. What is "D: S --> Z, the string of all 1's and zeros"?

"D: S --> Z, the string of all 1's and zeros" is a mathematical notation that represents a function. The "D" stands for the domain of the function, which is the set of all possible inputs. The "S" stands for the source, which is the set of possible outputs. The arrow indicates that the function maps the inputs from the domain to outputs in the source. In this case, the source is the string of all 1's and 0's, which means that the function takes any input and outputs a binary string consisting of only 1's and 0's.

2. What is the purpose of "D: S --> Z, the string of all 1's and zeros"?

The purpose of this function is to map any input in the domain to a binary string consisting of only 1's and 0's. This can be useful in various applications such as coding and cryptography, where binary strings are commonly used.

3. How is "D: S --> Z, the string of all 1's and zeros" represented graphically?

The function can be represented graphically using a mapping diagram. The domain is represented by a set of points on the left side of the diagram, while the source is represented by a set of points on the right side. The arrow indicates the mapping from the domain to the source, with each input in the domain being mapped to a specific output in the source.

4. Can the function "D: S --> Z, the string of all 1's and zeros" have more than one input for a given output?

No, this function follows the principle of a mathematical function where each input in the domain is mapped to a unique output in the source. Therefore, for a given output, there can only be one input. In other words, the function is one-to-one.

5. How is the function "D: S --> Z, the string of all 1's and zeros" different from a regular mathematical function?

The main difference between this function and a regular mathematical function is that the source is a specific set of elements, in this case, the string of all 1's and 0's. In a regular mathematical function, the source can be any set of elements. Additionally, the outputs in the source for this function are limited to binary strings consisting of only 1's and 0's, while regular mathematical functions can have a wide range of outputs.

Back
Top