nLab binary function




A binary function, or function of two variables, is like a function but with two domains. That is, while a function ff from the set AA to the set CC maps an element xx of AA to a unique element f(x)f(x) of CC, a binary function from AA and BB to CC maps an element xx of AA and an element yy of BB to a unique element f(x,y)f(x,y) of CC.

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:


A binary function from AA and BB to CC is simply a function ff to CC from the binary cartesian product A×BA \times B. We write f(x,y)f(x,y) for f((x,y))f((x,y)).

This is natural in structural set theory; it makes sense in any set theory and (suitably interpreted) in a foundational type theory.

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:


A binary function to CC is simply a function ff to CC such that every element of the domain of ff is an ordered pair. Again, we write f(x,y)f(x,y) for f((x,y))f((x,y)).

An equivalent (but different) definition in material set theory is this:


A binary function to CC is a ternary relation ff such that

  • given (x,y,z)f(x,y,z) \in f, we have zCz \in C, and
  • given (x,y,z)f(x,y,z) \in f and (x,y,z)f(x,y,z') \in f, we have z=zz = z'.

Now we write f(x,y)f(x,y) for the unique zz (if any) such that (x,y,z)f(x,y,z) \in f.

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 AA and BB to CC is a function to CC from a subset of A×BA \times B.

One can also define a notion of binary function without any notion of ordered pair, as long as one has the set of functions from any set to any other set. This is called a curried representation.


A binary function from AA and BB to CC is a function from AA to the set C BC^B of all functions from BB to CC.

The connection is that if ff is a binary function defined as having ordered pairs in its domain, the corresponding function from AA to C BC^B sends aAa\in A to the function that sends bBb\in B to f(a,b)Cf(a,b)\in C. One can give a similar comparison of material and structural versions of this definition. In addition, this definition is usually the one used in type theory.

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):

  • Given an element xx of the set AA, an element yy of BB, and a binary function from AA and BB to CC, we have an element f(x,y)f(x,y) of CC.

  • If xx and xx' are equal elements of AA and yy and yy' are equal elements of BB, then f(x,y)=f(x,y)f(x,y) = f(x',y').

  • Given two such binary functions ff and ff', if f(x,y)=f(x,y)f(x,y) = f'(x,y) for every xx in AA and every yy in BB, then f=ff = f'.


The cartesian-product-based definitions make sense internal to any category with binary cartesian products. More generally, we can consider any monoidal category.

Similarly, the curried definition makes sense internal to any closed category. The cartesian analogue of a closed category (not to be confused with a cartesian closed category, which also has finite products) exists but is not well-known.

Finally, the undefined concept of “binary function” can be internalized to the binary morphisms in any multicategory, in particular perhaps a cartesian multicategory. If a multicategory has tensor products, then its binary morphisms are representable in the ordered-pair style, while if it has hom-objects, they are representable in the curried style; but in general a multicategory may have neither.

Special cases

A binary function to the set of truth values is a binary relation.

A binary function from AA and AA to CC may be simply called a binary function from AA to CC.

A binary function ff from AA to CC is symmetric if f(a,b)=f(b,a)f(a,b) = f(b,a) always.

Last revised on August 30, 2022 at 06:40:42. See the history of this page for a list of all contributions to it.