How does a surjective function not contradict the definition of a function.

definition

I was reading up on functions and different types of functions.

From wikipedia :

A function is a process or a relation that associates each element x
of a set X, the domain of the function, to a single element y of
another set Y

Surjective function:

a function f from a set X to a set Y is surjective (or onto), or a
surjection, if for every element y in the codomain Y of f there is at
least one element x in the domain X of f such that f(x) = y. It is not
required that x be unique; the function f may map one or more elements
of X to the same element of Y.

Can someone explain how these two definitions does not contradict eachother?

Best Answer

You are understanding one of the definitions wrong.

Surjectivity means that if you have a function $f:X\to Y$ then every $y\in Y$ gets mapped onto.

A function is a process or a relation that associates each element x of a set X, the domain of the function, to a single element y of another set Y

This says that something like this:

$f:\{1,2\}\to \{1,2,3\}$, $f(1)=1$, $f(1)=2$ and $f(2)=3$ is not a function, because $f(1)$ is not unique.

Other example:

It is not required that x be unique; the function f may map one or more elements of X to the same element of Y.

Meant is something like this:

Consider the function $f:\{1,2,3\}\to\{1,2\}$

Then we can have $f(1)=1$ and $f(2)=1$ and $f(3)=2$. Then $f$ is surjective and there are values (1 and 2) that are mapped onto the same element (here 1). This is completly fine.

Keep in mind that if you have a function $f:X\to Y$. Every $x\in X$ needs to be mapped onto something. But not every $y\in Y$ needs to be mapped onto.

Example:

$g:\{1,2,3\}\to\{1,2\}$

$g(1)=g(2)=g(3)=1$ is a function. But not surjective.

Related Question