Before we understand what a function is, we need to classify the types of relationships that 2 data sets can have with each other when input variables (Arguments) in 1 data set is mapped onto the output variables (Images) in another data set.
For example, in each of the 4 diagrams above, the argument 1 is mapped onto the image A.
There are 4 types of relationships:
1 to 1 relationship: Each argument is mapped to exactly one distinct image. Conversely, each image has only one distinct argument.
1 to Many relationship: Each argument is mapped to one or more images (1 is mapped to both A and B). Not every image has a distinct argument. For example A and B both have the argument 1.
Definitions
A function maps every argument to exactly one image.
The domain of a function is the set of all possible arguments.
The range of a function is the set of all possible images.
The codomain of a function is a superset of the range.
A function can either have a 1 to 1 relationship or a Many to 1 relationship when the arguments in the domain is mapped onto the images in the range.