Ternary operation

Definition
A ternary operation is a function that combines three elements (operands) from a set to produce another element of the same set. Formally, for a set $S$, a ternary operation is a mapping $f : S \times S \times S \rightarrow S$.

Overview
Ternary operations appear in various branches of mathematics and computer science. In algebra, they generalize binary operations (such as addition or multiplication) by involving an additional argument. Notable examples include the ternary sum $a + b + c$, the median function on ordered sets, and the associator $[a,b,c] = (ab)c - a(bc)$ in non‑associative algebra. In computer programming, ternary operators are often shorthand expressions that evaluate to one of two values based on a condition, e.g., the conditional operator ?: in C‑derived languages, though this is technically a conditional expression rather than a pure three‑operand algebraic operation.

Etymology/Origin
The term derives from the Latin prefix tern‑ meaning “three” and the word “operation,” reflecting the three inputs required. The concept of an n‑ary operation was formalized in the early 20th century as abstract algebra expanded beyond binary structures.

Characteristics

  • Arity: By definition, the arity (number of arguments) of a ternary operation is three.
  • Closure: In most algebraic contexts, the operation is closed on the set, meaning the result belongs to the same set as the operands.
  • Associativity and Commutativity: These properties can be defined for ternary operations, but they differ from their binary counterparts. For example, a ternary operation may be totally symmetric (invariant under any permutation of its arguments) or exhibit partial symmetries.
  • Identity Elements: Some ternary operations admit an identity element $e$ such that $f(e, e, a) = a$ (or other analogous forms), though the existence and uniqueness of such an element depend on the specific operation.
  • Derivation from Binary Operations: Certain ternary operations can be constructed from binary ones, e.g., $f(a,b,c) = (a \star b) \star c$ for a binary operation $\star$. Conversely, some ternary operations cannot be reduced to binary compositions, providing genuinely higher‑arity algebraic structures.

Related Topics

  • Binary operation – operations with two operands, the most common arity in algebraic structures.
  • n‑ary operation – generalization to operations with any finite number $n$ of operands.
  • Quasigroup and loop theory – areas where ternary operations arise in the study of non‑associative systems.
  • Conditional (ternary) operator – a language construct in programming that selects between two expressions based on a Boolean condition, often denoted ?:.
  • Magma (algebra) – a set equipped with a binary operation; extensions to ternary magmas consider a single ternary operation without additional axioms.
  • Associator – a specific ternary operation measuring the failure of associativity in a binary operation.
Browse

More topics to explore