Informally, given two sets and a function or map from to is a definite rule which associates to each an element . A ‘rule’ here could be some kind of mathematical formula, but that isn’t necessary — it could simply be a list specifying the output for each input .
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.
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.