Informally, given two sets and a function or map from to is a definite rule which associates to each an element .
We write to mean that is a function from to . is called the domain of and is called the codomain of .
We refer to the element of as being the “output” or “value” of when it is given the “input” or “argument” .
This might seem vague: what is a definite rule? What does associates mean? Should we say that two functions with the same domain and codomain are equal if and only if they have the same rule, or should it be if and only if they have the same output for every input?22 2 These concepts are called intensional and extensional equality, but that won’t be relevant in MATH0005.
The formal definition of a function is:
A function consists of a domain , a codomain , and a subset containing exactly one pair for each . We write for the unique element of such that is in .
In other words, the formal definition of a function is its set of input, output pairs.
The function such that corresponds to
We won’t use the formal definition in MATH0005.
Two functions and are said to be equal, and we write , if and only if
they have the same domain, say , and
they have the same codomain, and
for all we have .
Sometimes the definition has slightly strange-looking consequences.
Let . . . Are they equal?
(the answer is yes — they have the same domain, same codomain, and the same output for every input in their common domain).
For any set , the identity function is defined by for all .
Sometimes we just write instead of if it is clear which set we are talking about.