---
tag: WC47MFR6GW
kind: concept
name: Ternary operation
msc: [08A02, 08A62]
specializes: [EJ8YJVM9BW]
sources:
  - url: https://en.wikipedia.org/wiki/Ternary_operation
same_as:
  wikidata: Q1524945
  wikipedia: Ternary operation
---

## Summary

A ternary operation on a set $A$ is a [[finitary operation|EJ8YJVM9BW]] of [[arity|MSXX2P86CY]] $3$, a function from $A^3$ to $A$.
Ternary operations appear naturally in universal algebra.
Examples are the operation $x y^{-1} z$ of a [[group|G5S1M9]], which turns a group into a [[heap|V389A4WGH9]], and the [[ternary discriminator|72PG6XCQ7D]].
Many conditions on [[varieties|AJNZJD8442]] are stated with ternary terms, such as a [[Mal'cev term|Y203PPTS61]] or a [[majority term|9879ZMW5AA]].

## Explanations

### L1 human

A ternary operation takes three elements and gives one.
On the integers, $(x, y, z) \mapsto x - y + z$ is an example.
On a totally ordered set, the median of three elements, the one in the middle, is another example.
The rule "if $x$ then $y$ else $z$" on truth values is a third example.
