Informally, for each input element in a set , a function assigns a single output element from another set .
- is the domain of the function;
- is the co-domain;
Formally, a function is a set of pairs no two of which have the same first element.
Definition: The output of a given input is called the image of that input. The image of under a function is denoted as .
If , we say maps to under . In mathese: .
The set from which all outputs are chosen is the co-domain. We write.
when we want to sai that is a function with domain and co-domain .
Definition: The image of a function is the set of all images of inputs.
e.g. Cosine function
, which means the domain is and the co-domain is .
The image of , , is which is not the same as the co-domain which is the whole .
Set of functions with domain and co-domain
Definition: For sets and , denotes all functions from to .
For finite sets:
Identity function and composition
For any Domain , there is a identity function:
for each domain element to itself.
Definition: For functions and the functional composition of and is the function:
e.g.:
Composition of and is
e.g.:
Longer Example, Caesar cipher
Define the function
is the encoding function that translates the letters into positions.Define on the domain/co-domain by
is the function that traslate the positions for the cipher.Define with domain and co-domain (the inverse of the domain and co-domain of ). This is the decoding function that translates the new translated position back to the letters domain, i.e. , , etc.
Then , or applied to every letter in a message is the Caesar cipher.
Associativity of function composition
Function composition satisfies associativity, a.k.a.:
Proof
for any element of domain of :
So we can collapse to the form and the unroll it in the other form by using only definitions.
Functional Inverse
Definition: Functions and are functional inverse if and are defined and are identity functions.
A function that has an inverse is invertible.
One-to-One functions
Definition: is one-to-one (iniettiva) if implies .
So there are no two distinct elements that have the same image.

Onto Functions
Definitions: is onto (suriettiva o surgettiva) if for every there exists an such that

Invertibility of functions
Definition.: is one-to-one if implies .
Proposition: Invertible functions are one-to-one.
Proof: Assume an invertible function is not one-to-one. So there exists where .
Then but and both cannot be true, by the definition of function.
So, an invertible function is one-to-one.
Definition: is onto if for every there exists an element such that .
Proposition: Invertible functions are onto.
Proof: Assume an invertible function is not onto. So there exists an element in co-domain such that for no does
But for some , and by the definition of the inverse, , a contradiction.
This is because, by the definition of function, every possible element in the domain has to have an image in the co-domain under the function. So, if the function is invertible, then there is a such that and therefore by definition of the inverse we have that .