# Surjective, Injective, and Bijective Functions

These types of functions are vey important to understand. They describe how the function preserves distinctness, and how the functions interact with both the codomain and the domain.

###### Injective

An injective function is a function that whenever $f(x)=f(y)$ then $x=y$. Another common way to descrive an injective function is by saying that the function is one to one.

Example 1:

Consider the function $f(x)=x^2$ where $f:\mathbb{Z}\rightarrow\mathbb{Z}$. Notice that if $a=f(b)$ then $x=\pm b$. So f is not an injective function. A numerical example would be $f(-1)=(-1)^2=1^2=f(1)$ yet $1\neq -1$.

Example 2:

Now consider the linear function $f(x)=x$ where $f:\mathbb{Z}\rightarrow\mathbb{Z}$. Notice that this is an injective function because for any $a\in\mathbb{Z}$ $f(a)=a$.

###### Surjective

A surjective function is a function from $f:A\rightarrow B$ where every $b\in B$ there is at least one $a\in A$ such that $f(a)=b$. These are also called onto functions.

Example 1:

Let $f:\mathbb{R} \rightarrow\mathbb{R}^+$ and $f(x)=x^2$ since all negative numbers are not in the domain the function is bijective. Notice that $f(1)=1=f(-1)$ so the function is not injective. Since f maps to all non negative numbers in $\mathbb{R}$ and because the codomain is $\mathbb{R}^+$ this is a surjective but not injective function.

###### Bijection

A function that is both Injective and Surjective is called a bijection.

Example:

Let $f:\mathbb{R}^+ \rightarrow\mathbb{R}^+$ and $f(x)=x^2$ since all negative numbers are not in the domain the function is bijective.

###### Non Bijective Functions

There are some functions that are neither Injective nor Surjective.

Example:

Let $f:\mathbb{Z}\rightarrow\mathbb{Z}$ where $f(x)=x^2-x$. For this function both 0 and 1 both map to 0. Therefore it isn’t injective. f(x) doesn’t hit all of the integers in the codomain, for example for f(x)=1  must be $latex \frac{1}{2} (1\pm\sqrt{5})\not\in\mathbb{Z}$