A binary function, or function of two variables, is like a function but with two domains. That is, while a function from the set to the set maps an element of to a unique element of , a binary function from and to maps an element of and an element of to a unique element of .
We can generalise further to multiary functions, or functions of several variables.
The possible definitions depend on foundations; for us, the simplest is probably this:
In material set theory, one often declines to specify the domain of a function (since this can be recovered from it); then we can say this:
An equivalent (but different) definition in material set theory is this:
A binary function to is a ternary relation such that
Now we write for the unique (if any) such that .
Either way, the material concept is actually more general than the structural one, because the domain of a material binary function might not be a cartesian product. The link is provided by the binary version of a partial function:
A partial binary function from and to is a function to from a subset of .
It's also possible to take the concept of binary function as an undefined primitive concept, on the same level as that of function. Then we want axioms such as the following (depending on the style of foundations):
If and are equal elements of and and are equal elements of , then .
Given two such binary functions and , if for every in and every in , then .
We could conceivably have the notion of binary function without the notion of cartesian product; then a binary function could not be understood as a special case of a function. I doubt that anybody has proposed such a foundation of mathematics, but there are situations where this is true in some internal logic.
In particular, a binary function internal to a multicategory is simply a binary morphism in that multicategory. This is most like a binary function between sets in the case of a cartesian multicategory. But even so, there may be no tensor product in the multicategory, and then a binary morphism cannot be understood as a special case of a morphism.
A binary function from and to may be simply called a binary function from to .
A binary function from to is symmetric if always.