Why are so few operations with arity bigger than 2? In usual algebraic structures, like groups, rings, monoids, etc, or in algebras coming from logics like Boolean algebras, Heyting algebras and the like the operations are usually of arity 0 (constants), 1 or 2. My question is two-fold:


*

*Provide examples of algebras arising naturally in some field (I'm mainly interested in algebras coming from logics, but I'm open to any field) with operations of arity 3 or bigger.

*Is there any reason (more or less profound) for being so few algebras with operations of arity bigger than 2?
Thank you in advance.
 A: The composition law in a monoid is usually represented using a binary operation (multiplication) and a zeroary operation (unit), but I view it more naturally as an operation (say, a bracket) taking any finite list of arguments and being associative in the sense that brackets can be eliminated in any expression, for example we have the identities
[a,[],b,[[c,d],e],[f]]=[a,b,c,d,e,f]
and 
[a]=a. 
Then we can define a zeroary operation 1:=[] and a binary operation a*b:=[a,b], and recover the bracket from them, using identities such as [a,b,c,d]=[a,[b,[c,d]]]. These two operations satisfy the usual axioms of a monoid, and any two operations satisfying them can be extended to an associative finitary bracket. 
I view the usual representation by a binary and a zeroary operation as an artifact for being able to produce simpler-looking proofs that the structures that we encounter are monoids. 
My point is that naturally binary operations are not that common either! Perhaps an example is the Lie bracket. 
A: Is this like the question why matrices are more common than multi-matrices?  Feel free to flag this as spam because I don't have enough mathoverflow bucks to comment.
A: Lie and Jordan Triple system have arity 3. A Jordan triple system is a vector space with additional structure is given by a triplet 
$$(x,y,z)\rightarrow \{x,y,z\}$$
that satisfies the identities
$$\{u,v,w\} = \{u,w,v\}$$
and
$$\{u,v,\{w,x,y\}\} = \{w,x,\{u,v,y\}\} + \{w, \{u,v,x\},y\} -\{\{v,u,w\},x,y\}.$$
See link text. Every Jordan algebra can be embedded in a Jordan triple system but the converse is not true. Any Jordan triple system is a Lie triple system with respect to the product
$$[u,v,w] = \{u,v,w,\} − \{v,u,w\}. $$
The structure of a Lie triple system is given by a bracket satisfying the identities
$$    [u,v,w] = − [v,u,w], \qquad
    [u,v,w] + [w,u,v] + [v,w,u] = 0$$
and
$$    [u,v,[w,x,y]] = [[u,v,w],x,y] + [w,[u,v,x],y] + [w,x,[u,v,y]]. $$
A: In higher order Fourier analysis, there are d-dimensional parallelopiped structures which can be viewed as a $2^d-1$-ary relation of the form "given all but one vertex of a parallelopiped as input, return the final vertex as output".  (Here "parallelopiped" should be interpreted in a suitably abstract sense, as a family of $2^d$-tuples obeying a certain number of axioms.)  This point of view is taken for instance in this paper of Camarena and Szegedy, building on the  earlier work of Host and Kra.  In the d=2 case, this ternary operation is essentially equivalent to an additive operation once one fixes an origin (in which case the ternary operation becomes $(x,y,z) \mapsto x-y+z$).  For d=3, these operations are governed by 2-step nilpotent groups, and more generally d-dimensional parallelopiped structures are governed by d-1-step nilpotent groups.
These parallelopiped structures can be viewed as the abstract foundation of the Gowers uniformity norms, and they also share some formal resemblance to cubic complexes, which are constructs that appear mostly in algebraic topology and are discussed for instance here.  There is a simplicial version of the latter concept known as a Kan complex, but I do not know the details of how they are used.  But I think Kan complexes come equipped with high arity relations of the general form "given data for all but one face of a simplex, supply the data for the remaining face (and also for the interior) of that simplex".  Among other things, such structures can be used to define n-groups; see for instance my blog post on this topic.
A: In knot theory, splicing generally has more than just one or two inputs.  
Splicing with one input generates things like Whitehead doubles: 
and cabelling: 
There are many $n$-ary operations. The first one noticed (historically) is connect-sum: . The issue one might have with the $n$-ary connect-sum is its generated by the 2-ary connect sum.  So here is an example of a $2$-ary splice that's not a connect sum: 
There are a countable infinite collection of $n$-ary splices for any $n \geq 1$, moreover, there's still countably-infinite many primitive ones for any $n \geq 1$, where primitive means "can't be expressed in terms of $j$-ary operations for j less than n"   These primitive splicing operations turn out to be specified (uniquely) by hyperbolic $(n+1)$-component links in the 3-sphere $L \subset S^3$, $L=L_0 \sqcup L_1 \sqcup \cdots \sqcup L_n$ such that the sublink $L_1 \sqcup \cdots \sqcup L_n$ is the trivial link.  The hyperbolicity means $S^3 \setminus L$ has a complete hyperbolic structure of finite volume. 
Splicing can be put in an operadic framework and this is the topic of one of my papers.  So you can turn it into a purely algebraic formalism as well, by taking the homology of the space of all knots and the splicing operad, respectively.  
It's not clear to me there's any reason for the seeming prevalence of 2-ary operations in mathematics.  It appears to be more of an accident -- two things interacting is simpler, easier to contemplate. 
A: Someone already mentioned determinants.  Here is a related $n$-ary operation, the vector product in dimension $n+1$:  Fix a basis $b_1,\dots,b_{n+1}$ of $\mathbb R^{n+1}$.
To $n$ elements $v_1,\dots,v_n$ of $\mathbb R^{n+1}$ assign
the unique vector $v_{n+1}$ that is orthogonal to $v_1,\dots,v_n$, such that
$v_1,\dots,v_{n+1}$ is of the same orientation as $b_1,\dots,b_{n+1}$ and such that the
length of $v_{n+1}$ is the $n$-dimensional volume of the parallelopiped spanned by
$v_1,\dots,v_n$.  
A: To add to the list of examples:


*

*Heaps have a single ternary operation (identities on linked page).  In short, a heap is to a group what an affine space is to a vector space: as soon as you pick an identity then you get a group.

*Totally convex spaces which are spaces that allow arbitrary convex combinations.  Simple examples are the unit balls of normed vector spaces, but others such as $(0,1)$ exist.

*Similarly, $C^*$-algebras and there's a theory closely related to Banach algebras.  See this page on the nLab where I started gathering together a few details on these.
To address the point as to why we often only use operations of arity at most 2, here's a neat little fact.  Abstractly, we can consider operations of arbitrary arity with arbitrary identities, but in concrete situations the operations usually have a high level of compatibility.  A common one to ask for is commutativity.  This is commutativity of operations, which is ever-so-slightly different from what we normally think of as commutativity (though the two are very closely related).  If we have a binary operation with a unit, then any operation that commutes with that operation (and its unit) turns out to be formed by iterating the binary operation.  This is an easy generalisation of the Eckmann-Hilton argument.  Therefore, once we start applying common identities, we find that we can often reduce the arity down to something palatable.
A: I am surprised that nobody came up with median algebras. That is, algebras that are equipped with a single ternary (fundamental) operation (see http://en.wikipedia.org/wiki/Median_algebra for a definition and some references). They generalize distributive lattices since the median function $(x \vee y) \wedge (y \vee z) \wedge (z \vee x)$ of any distributive lattice gives rise to a median algebra. Although median algebras still have many of the nice properties of distributive laticces, the concept is more subtle and the category of median algebras is not equivalent to that of distributive lattices. So the idea of having this single ternary fundamental operation really gives you something new and, at least in my oppinion, very interesting to look at.
To support my case: One might also be interested in Median algebras since they have beautiful duality with so-called Isbell spaces, first described by, you guessed correclty, John Isbell (the reference is given in the wikipedia article mentioned above). An Isbell space is a bounded Priestley spaces that is also equipped with certain (unary) complement operation.
A: Perhaps you mean fundamental operations instead of operations.  Others have noted that composition, projection, and changing one's point of view allows you to handle operations of higher arity.
I imagine that fundamental operations are usually of such low arity because we prefer simplicity.  Doing the maximum or the sum of a tuple of numbers can be acheived by
iterating the corresponding binary operation on certain parts of the tuple.  Anything more
gets uncomfortably complicated.
Having said that, there are examples like multi-linear functions (especially the determinant) that come up in various fields of analysis, not to mention infinitary operations like integration.  Even then, we like to break things down into iterates of simpler terms, or compositions thereof.  
William DeMeo has been doing many posts in MathOverflow in re universal algebra.  He will probably suggest the majority function on the set {0,1}, varieties which have a ternary or 4-place discriminator term, ternary groups, and the like.  He may also point to places in the literature where your question has been raised.  
Gerhard "Memory Not So Good Lately" Paseman, 2010.12.14
A: One reason why I think that most operations have arity at most 2 is that most algebraic structures fall into the following few narrow class of structures and the algebras in these classes of structures tend to have common characteristics. The most prominent of these characteristics is that the fundamental operations in these structures are typically associative binary operations or are easily obtained from associative binary operations.
Ordered sets and lattices-These structures include linear orders, partial orders, lattices, Boolean algebras, median algebras, Heyting algebras, locales, closure systems. 
Ring-like structures-Rings, fields, modules, algebras, vector spaces, linear algebra, semirings, Banach algebras. These structures are generalizations of the addition and multiplication operations on the natural numbers.
Group-like structures-Groups, monoids, categories, heaps, racks, quandles. These operations are often constructed from the composition of functions or as automorphism groups.
I think that the main reason why algebraic structures tend to fall into these narrow categories relies on the following observations:


*

*It is very difficult to build a completely new algebraic structure completely from scratch using a recursive construction which satisfies nice algebraic properties. The natural numbers with can be thought of as being built from scratch. The set of all strings together with the concatenation operation is another example of an algebraic structure built from scratch. 

*The mechanisms for producing new algebraic structures with interesting algebraic properties from old structures tend to generate new structures in the above classes. These mechanisms include taking automorphism groups, endomorphism monoids, (semi)-direct products, congruences, various notions of completion, various notions of extending algebras (like algebraic closure, Grothendieck groups, etc.), etc.
One can generate other examples of operations of higher arity, but these are rarely fundamental operations in algebraic structures. For example, discriminator terms and Mal'cev terms are usually not the fundamental operations of algebraic structures (the pattern algebras are an exception to this rule) and neither are operations such as the determinant.
I should mention that the few ternary structures that do appear in the above three categories are usually obtained by “forgetting” the unit or origin or sense of direction in the original structure and when one adds the unit or least element back in, one obtains the original structure. In these structures, the ternary operation amounts to having two variables to replace the binary operation and a third variable to denote the missing origin. One should therefore be cautious in referring to these structures as true ternary structures. For example, in affine spaces and heaps, one forgets the unit of a group or a vector space. However, when one adds the unit to the heap or affine space, one ends up with groups or vector spaces. Likewise, median algebras can be obtained from bounded distributive lattices by forgetting which direction is up. However, a median algebra can be easily turned into a nearly distributive semilattice simply by declaring a certain element to be the least element.
This phenomenon of obtaining ternary algebras by forgetting the origin of the algebraic structure also appears with some relational structures. For example, total cyclic orders are ternary relational structures which are obtained from totally ordered sets by forgetting the ordering of the ordered set but remembering the notion of orientation. The original linear ordering can be obtained from the cyclic ordering by applying a Dedekind cut to the cyclic ordering and this Dedekind cut plays the role of the origin or identity element in the previous examples.
A: $$\operatorname{average}(x_1,\dots,x_n) = \dfrac{x_1 + \cdots + x_n}{n}.$$
$$\operatorname{cross-ratio}(z_1,z_2;z_3,z_4) = \dfrac{(z_1-z_3)(z_2-z_4)}{(z_2-z_3)(z_1-z_4)}.$$
A: Higher arity operations appear quite naturally when homotopy theory enters the stage; e.g., $A_\infty$-algebras, $L_\infty$-algebras and $E_\infty$-algebras.
A: First a trivial remark: if you have a binary operation you automatically have higher arity operations by nesting.  Hence I would not say that there are fewer such algebras.  But there is a sense in which that is cheating.  Examples of these are some of the triple systems, say Lie triple systems, which are to symmetric spaces what Lie algebras are to Lie groups: namely, the best linear approximation.
Starting at least in the 1940s, the Russian algebraist AG Kurosh and his school sought to generalise many of the algebraic structures with a binary operation to an $n$-ary operation.  This is explained in the paper/monograph Multioperator rings and algebras from 1969 as well as in work of Baranovic and Burgin from 1975 on Linear $\Omega$-algebras.   Perhaps the best known example of this kind of structure are the $n$-Lie algebras introduced by VT Filippov in 1980.
3-Lie algebras had previously appeared in work of Nambu trying to generalise Hamiltonian mechanics by replacing the symplectic form by a closed 3-form.  This line of work was continued by Takhtajan and collaborators.
In the last few years, $n$-ary Leibniz algebras (but mostly $n=3$) have been given lots of attention due to the unexpected rôle they play in the AdS$_4$/CFT$_3$ correspondence for M2-branes.  Two years ago I gave some lectures on some of the underlying algebraic story at Nordita (Stockholm) and wrote them up.  You may wish to peruse them for the references. 
A: Operations of arity 3 naturally arise in universal algebra.  For example, one strand of research is to characterize the properties of the lattice of congruences of a variety by the existence of special terms -- these usually have arity 3.  For example, if a variety has a ternary operation m(x, y, z) such that m(x, y, y) = x and m(x, x, y) = y, then the lattice of congruences is modular.  (The converse is not true, but there is a weaker statement involving ternary operations that is true.)  Examples of this include groups ($m(x, y, z) = x y^{-1} z$) and vector spaces ($m(x, y, z) = x - y + z$).
The ternary operation for vector spaces has a natural geometric interpretation as vector addition in affine space, where vectors are not required to be based at the origin.  If you draw a vector from y to x and a vector from y to z, then $m(x, y, z)$ is the vector from y to x + z.  You can think of addition as defined by drawing a parallelogram $xyzw$.  Then $m(x,y,z)=w$.
A: Any $k$-ary relation can be expressed in terms of binary relations by means of projection maps, i.e. introduce new objects which correspond to $n$-tuples of the original objects ($n \leq k$), and introduce binary projection relations (i.e. $P(x,y)$ iff x is the first $n-1$ coordinates of $y$). Then $k$-ary relations are equivalent to a unary relation on $k$-tuples, and the $k$-tuples are all expressible in terms of the original objects via the binary projections maps. 
In brief, 2-ary relations are sufficiently expressive to handle all arities. (And similarly 2-ary functions can express all functions)
A: Here's one I learned from Todd Trimble.  Giving a set $X$ the structure of a compact Hausdorff space is the same as equipping $X$ with $J$-ary operations $X^J \to X$ for every set $J$, one for each ultrafilter $P$ on $J$, corresponding to the $P$-limit of a $J$-tuple of elements of $X$, with the appropriate compatibility relations. 
A: *

*I'd say that a lot of "higher-dimensional mathematics" concerns spaces with operations of arbitrary finite arity.  I'm thinking of things like planar algebras, operads, ...Let me mention one area that I like, which are various things I'd call "associative", and rather than trying to give precise definitions I'll mention planar algebras.  A planar algebra includes in the data a $k$-ary operation for every way to draw nonintersecting curves (that are either closed or end on a boundary) on a disk minus $k$ subdisks.  These operations are required to compose in any way that you can stick a disk-minus-holes into a hole in another disk (with the requirement that any curves ending on the glued-along boundary components match up).  Then there's also an associativity requirement that says that everything only depends on the topology of the diagram, not the geometry.Anyway, it is possible to write any "planar operation" as a composition of binary operations (although you need infinitely many "basic" binary operations), but this is the wrong way to think about it, I claim.  In particular, there's really no canonical choice how to write something as a composition of binaries.

*From this point of view, let's now revisit usual associative multiplication.  The associativity says nothing more nor less than: ab c = a bc.  Drawn this way, it's clear that this is again a statement that "only the topology matters, not the geometry". But the point is that the usual multiplication is "one-dimensional", in that the ambiant space where things like "a", "b", "c" are put is a line.  (Compare planar algebras, which are inherently two-dimensional.)  It took a while to invent two-dimensional mathematics, because we're used to thinking of "functions" acting consecutively in "time", and our experience is that "time" is one-dimensional.  Anyway, the point is that if your mathematics is one-dimensional, then it's much easier to see how to break any one-dimensional picture into "basic" subpictures with only two things going on.  I think this is the answer to your question 2, why most of the time we only think about 2-ary operations.
Finally, I'll mention that there's another direction you can go, which is to include "coalgebra" along with your algebra.  By "algebra" I mean a theory with some "$k$-ary operations" that take in $k$ inputs and spit out one output.  But "coalgebra" has operations that have multiple outputs.  Coalgebraic operations are very important, especially in computing: you wouldn't want a computer program that only does one thing when you ran it, because then it couldn't also tell you that it had done it!
A: In an affine space $A$, the displacement (difference) between two points is a vector, and one can add a vector to a point, but not two points. However these can be replaced by a ternary operation in terms of points alone: the parallelogram rule $\nearrow : A \times A \times A \to A,\\,\nearrow(p, a, b) = p+(a-b)$.
You can even add scalar multiplication of the difference into the bargain.
Why would you want to do this? Well affine spaces are more primitive than a vector space -- yet we use a vector space in defining them. To me the more natural approach is to define them without it, and watch the vector space (of displacements) drop out.
A: I'd have thought it was just notational.  When the arity is > 2, we usually end up coding the operands into a vector or tensor or whatever.   The determinant mentioned above is an obvious example of that: a unary operation on a matrix, or a tensor acting on n vectors, depending on how we look at it.
A: Let me point out $n$-ary operations that appear in my own research.
An algebra $(X,*)$ is said to be self-distributive if $x*(y*z)=(x*y)*(x*z)$ for all $x,y,z\in X$. The notion of self-distributivity can be generalized to identities involving operations of higher arity. We say that an $n+1$-ary operation $t:X^{n+1}\rightarrow X$ if self-distributive if
$$t(x_{1},\ldots,x_{n},t(y_{1},\ldots,y_{n},y))$$
$$=t(t(x_{1},\ldots,x_{n},y_{1}),\ldots,t(x_{1},\ldots,x_{n},y_{n}),t(x_{1},\ldots,x_{n},y)$$ (see here and here).
The notion of a Laver table can be extended to $n$-ary operations. You may compute the $n$-ary Laver tables here and here.
A: More than two-ary operations pop up in algebraic approach to CSP (constraint satisfaction problem). See e.g. http://www.ams.org/mathscinet-getitem?mr=2470592 or http://www.ams.org/mathscinet-getitem?mr=2137072
