From Example Problems
Jump to navigation Jump to search

In mathematics and computer programming, the arity of a function or operator is the number of arguments or operands it takes. In linguistics, arity is sometimes referred to as valency, not to be confused with valency in mathematics.

Although arity is an important concept, the word "arity" is rarely used in everyday practice. For example, rather than saying "the arity of the addition operation is 2" or "addition is an operation of arity 2" one usually says "addition is a binary operation". In general, the naming of functions or operators with a given arity follows a convention similar to the one used for n-based numeral systems such as binary and hexadecimal. One combines a Latin prefix with the -ary ending; for example:

  • A nullary function takes no arguments.
  • A unary function takes one argument.
  • A binary function takes two arguments.
  • A ternary function takes three arguments.
  • An n-ary function takes n arguments.

In particular, an n-ary operation f on a set S is the same as a function f : Sn → S.



Sometimes, it is useful to consider a constant as an operator or function of arity 0, and hence call it nullary (or sometimes anary).


Examples of unary operators in math and in programming include the unary minus and plus, the add-one or subtract-one operator in C-style languages, not in logical languages and the factorial function in math. Also, the two's complement operator and the address reference operators are examples of unary operators in math and programming.


Most operators encountered in programming are of the binary form. For both programming and math these can be the multiplication operator, the addition operator, the division operator. Logical predicates such as OR, XOR, AND, IMP are typically used as binary operators with two distinct operands.


From C, C++, Java, Perl and variants comes the ternary operator  ?: , which is a so-called conditional operator, taking three parameters.

Other names

  • nullary or anary means zero parameters.
  • unary means one parameter.
  • binary means two parameters.
  • ternary, also trinary and tertiary, means three parameters.
  • quaternary means four parameters.
  • quinary means five parameters.
  • senary means six parameters.
  • septenary means seven parameters.
  • octonary means eight parameters.
  • nonary means nine parameters.
  • denary means ten parameters.
  • undenary means eleven parameters.
  • duodenary means twelve parameters.
  • vigesary means twenty parameters.
  • centenary means a hundred parameters.
  • millenary means a thousand parameters.
  • n-ary means n parameters.

Arities above quarternary are rarely found in math- or programming-related literature; already quarternary operations are more often called 4-ary. However, these words are often used to describe anything related to that number (i.e. undenary chess is a chess variant with an 11x11 board, or Millenary Petition of 1603).

de:Stelligkeit eo:Loknombro es:Aridad fr:Arité et:Aarsus io:Arito pl:Arność sv:Aritet