Function

Let
A (typed) function from to is the triple , where is the domain, is the codomain, and is a relation also called the graph of the function with the following property:
(each element of is related to exactly one (=unique) element of ).
Notation:
Instead of , we write ( maps set to set )
Instead of , we write or (point is mapped to point )

Function graph

The graph of a function is the set of ordered pairs , with the relation

Link to original

Domain of a function

If is a function from set to set , then the domain of is the set .

Link to original

Codomain

For a function , the set is called the codomain of .
It is the (declared) set within which all outputs of must lie, but not all elements of need to be actual outputs of .

Link to original

Image / Range

The image of a function is the set of all output values it can produce:

It is a subset of the codomain . Iff is surjective, then .
Usually, the image of under is called the range of , whereas is called the image of under .

Link to original

Preimage / inverse image

For a function and a subset , the preimage or inverse image of under is defined as:

is the set of all elements in the domain that get mapped to elements in under .
Note that this notation does not require to be invertible – that would be – it just describes which inputs lead to outputs in .

Link to original

Function transformations

shifts your function to the left, as it reaches the same output units earlier.
shifts your function up by units.
compresses your function horizontally by a factor of (if ) or stretches it (if ).
stretches your function vertically by a factor of (if ) or compresses it (if ).
reflects your function at the x-axis.

Injective (one-to-one) function

A function is called injective if
Or conversely:
|220x220
(an injective but not surjective function)

Link to original

Surjective (onto) function

A function is called surjective if
In words: every element in the codomain is the image of at least one element in the domain.

(a surjective not injective function)

Link to original

Bijective function

A function is called bijective if it is both injective and surjective.
A bijection basically means that there is a one-to-one correspondence between all elements of the domain and the codomain: For every unique element in , there is a unique element in .
|220x220

Link to original

EXAMPLE

is not injective, because and it is not surjective, because (negative real numbers are not in the codomain).
is injective, but not surjective because we canot reach negative numbers.
is not injective but surjective ( has a solution for all ).
is bijective.


is a bijection
is not a function, since is not defined.
is a bijection
is a bijection
is a bijection (it’s a 90 degree rotation). Also, and vice versa.

\begin{align*}
(x_{1}, y_{1}), (x_{2}, y_{2}) \in \mathbb{R}^{2}: & h_{2}(x_{1}, y_{1}) = h_{2}(x_{2}, y_{2}) \
& \iff (x_{1} - y_{1}, x_{1} + y_{1}) = (x_{2} - y_{2}, x_{2} + y_{2}) \
& \iff \begin{cases}
x_{1} - y_{1} = x_{2} - y_{2} \
x_{1} + y_{1} = x_{2} + y_{2}
\end{cases} \
& \iff \begin{cases}
x_{1} = x_{2} \
y_{1} = y_{2}
\end{cases} \
& \iff (x_{1}, y_{1}) = (x_{2}, y_{2})
\end{align*}

Surjectivity: For every , we can find a such that :

\begin{align*}
(a,b) \in \mathbb{R}^{2}: & h_{2}(x,y) = (a,b) \
& \iff (x-y, x+y) = (a,b) \
& \iff \begin{cases}
x - y = a \
x + y = b
\end{cases} \
& \iff \begin{cases}
x = \frac{a+b}{2} \
y = \frac{b-a}{2}
\end{cases} \
& \iff (x,y) = \left( \frac{a+b}{2}, \frac{b-a}{2} \right)
\end{align*}

→ $h_{2}$ is bijective.

If a function from two finite sets of equal length is injective, it is also surjective (→ bijective).

Let be finite sets, , .

Proof:
Injective surjective:
are pairwise different: (injective)

(“slight abuse of notation” … in logic, they use for the image of under )]
→ surjective
Surjective injective:
Assumption
Assume it’s not injective
not surjective.
Strictly formally, we would need to first define the cardinality with bijective functions to get to the definition of equality for bijective images…
But uhm this thing makes quite obviously sense if you just look at the definition.

The theorem above can be extended to inifinite sets: Two infinite sets have the same size if there is a bijection between them.

→ Not all infinite sets are the same size! (since we cannot find a bijection between them)

Transclude of composition

Identity function

The identity function on a set is the function .

Transclude of inverse-function

Function evaluation

denotes the set of all functions (hom-class or exponential object).

Read: The evaluation applies a function to an argument and returns the result .


Every time there are multiple pathways / ways of implementing something, there’s a function.


A note on notation

If I don’t specify for which sets a function is defined, it’s usually complex-valued unless it’s obvious from context that it’s something else.