Let be the set of all lists (of any length) whose entries are only 0’s and 1’s, and let be the set of nonnegative integers. Define a function : → as follows: for any list in , () = the number of 1’s in .
(a) Is one-to-one? Prove or give a counterexample.
(b) Is onto? Prove or give a counterexample.
I'm mostly confused as to what set would actually look like. I see it as being something like = {1,0,1,0,1,0...}. In which case is it true that can't be one-to-one because any 0 or a 1 from would map directly to only a 0 or 1 in ? Also could it be onto even both of these are infinite sets?
$S$ is a set of lists. So if one list is something like $(0,0,1,1,0)$, (I'll write list between parenthesis for notation), then $S$ is the set of all of these.
$S=\{(0),(0,0), (0,1),(1,0),(1,1),(0,0,0),(0,0,1),.... \}$
$T$ meanwhile is just $\mathbb N\cup \{0\}$.
And $F:S\to T$ by "counting the $1$". So $F((0,0,1,1,0)) = 2$ and $F((1,0,1,1,1,1,1,0)) = 6$ for example.
It's not the $0$s and the $1$s that are being mapped from. It is the lists of $0$s and $1$s that are being mapped from.
And a function from a set $A$ to a different set $B$ don't have to map the same type of elements. Consider $A = \{\text{animals}\}$ and $B=\{\text{food\}}$ and $f:A\to B$ via $f(x)=$ what $x$ eats. Then $f(\text{horse})=\text{hay}$ even though hay is not an animal. So $f((1,1,0)) = 2$ which is neither $0$ nor $1$.
The sets are infinite and you can have onto functions to infinite sets.
....
Now is $F$ one-to-one and is it onto.
Below are HUGE hints if you just put that question into simple words that make the answer UTTERLY obvious. Don't read it unless you are absolutely stuck:
One-to-one:
Onto: