Determine whether a function is onto / one-to-one – Discrete mathematics

discrete mathematics

I need to determine for each domain $A$ and range $B$ if the function $f$ is onto/one-to-one:

$f : A \rightarrow B $
Given: $f = \{(1,2), (2,4), (3,2)\}$

1) $A = \{1,2,3,4\}$ and $B = \{2,4\}$

By seeing these two pairs: $(1,2)$ and $(3,2)$ I concluded this function is not one-to-one, and it is onto B because:
$ \forall y \in B ~~\exists x \in A : (x,y) \in f$

2) $A = \{1,2,3\}$ and $B = \{2\}$
Same thing as before, the are the same pairs $(1,2)$ and $(3,2)$ then it's not one-to-one , and each value of B got as an output in f so it's onto B

3) $A = \{1,2,3\}$ and $B = \{2,4\}$
And here the same exact thing as one and two…

I am afraid I am missing something as all the three answers are the same (makes me think I made a mistake somewhere…)
Am I right in this question? Thank you.

Best Answer

You got it!

(1) I guess $f(4)$ is not given, but assuming it is defined as something in $B$ then we're good (otherwise $f$ is not a function of $A$). But yes, since $f(1)=f(2)=3$, we see that $f$ is not one-to-one. And both values of $B=\{2,4\}$ are "hit" by $f$, so it is onto.

(2) We've reduced $A$ to remove $4$, but this didn't even matter in (1) so the domain is essentially the same (as far as we care). Indeed $f$ is still not one-to-one. In general if $f:X\to Y$ is not one-to-one, then it is not one-to-one for any codomain (i.e. if we change $Y$ to $Z$, assuming $\operatorname{im}(f)\subseteq Z$, $f:X\to Z$ is still not one-to-one). Also it is still onto (we just made $B$ smaller, so it'll still be onto).

(3) This is essentially the same as (1) since we didn't care about $f(4)$ anyway, so indeed it is not one-to-one and is onto.

Related Question