For the following functions, the domain and codomain is {a,b,c,d} which ones are one to one and which are onto? Give reasons for each.
a) f(a) = b, f(b) = a , f(c) = c, f(d) = d
b) f(a) = b, f(b) = b, f(c) = d, f(d) = c
c) f(a) = d, f(b) = b, f(c) = c, f(d) = d
A function $f$ is one-to-one if and only if $f(a) = f(b)$ implies $a = b$. That is, the function always maps distinct values to distinct values.
A function $f$ is onto if and only if for every $b$ in the codomain, there exists an $a$ such that $f(a) = b$. In other words, the function hits every element in its codomain.
a) There is no element in the codomain that is hit by two different elements in the domain, and all elements in the codomain are hit. So $f$ is both one-to-one and onto.
b) We see that $f(a) = b$ and $f(b) = b$, so $f$ maps two distinct elements to the same element $b$, and it is therefore not one-to-one. We also see that $a$ is not hit, so it is also not onto.
c) Very similar to b), so I'll leave this one to you!