# Give an example of a function from A to B that is not one-to-one. Explain why it is not one-to-one

A= {a,b,c,d} B= {1,2,3,4,5}

Currently studying for a final. I know that a one-to-one function cannot map to 2 elements. There are more elements in B than in A. I don't know how to give a specific example of a function that is not one-to-one, though. How do I know which element maps where?

Seems very easy. Any help is appreciated.

The most obvious non-one-to-one functions are the constant functions, which take the same value for every input. One constant function $f:A\to B$ is the one given by $$f(a) = f(b) = f(c) = f(d) = 2$$ It is not one-to-one because while $a \neq b$, we have $f(a) = f(b)$.

You can define a mapping element-wise. That is,

Let $f : A \to B$ be defined as follows

\begin{align} a &\mapsto 1\\ b &\mapsto 1\\ c &\mapsto 1\\ d &\mapsto 2.\\ \end{align}

Then $f$ is not one-to-one.

Of course, you can do this for whatever elements you like.. as long as there is at least one element such that $f(a) = 1$ and $f(b) = 1$, then it is not one-to-one.

For a one-to-one function we have

$f(x_1) = f(x_2) \Rightarrow x_1 = x_2$

Hence this is not one-to-one

$f: A \to B$

$a \mapsto 1$

$b \mapsto 1$

$c \mapsto 2$

$d \mapsto 3$

because $f(a) = f(b)$ but $a \not = b$

"How do I know which element maps where?"

You are supposed to give an example of a function so its up to you to decide which elements map to which elements.

There are more elements in B than in A.

What I think may be confusing you (and I may be wrong, of course) and what no one else has said yet is that your function doesn't need to hit every element of $B$.

And it is true that in order to be a function, one element in $A$ cannot go to more than one element of $B$.

However, it is allowed for more than one element of $A$ to go to one element of $B$. This does not violate the definition of being a function. In fact, it is precisely this scenario that gives you a function that is not one-to-one (because many elements in $A$ go to one element in $B$).

It is entirely up to you, as long as your function actually is a function (i.e., it doesn't send one element of $A$ to more than one element of $B$). Here's a simple example, much like Arthur's: Define a function $f$ so that every element of $A$ gets sent to the element $1$ in $B$. Then, specifically, you have: $$f(a) = 1, \qquad f(b) = 1, \qquad f(c) = 1, \qquad f(d) = 1$$ This is a perfectly valid function. And it is not one-to-one because different elements in $A$ go to the same element in $B$.