Majority function
In Boolean algebra and digital logic, the majority function (also known as the majority gate or median operator) is a threshold function that outputs 1 if and only if more than half of its inputs are 1, and 0 otherwise; for an odd number of inputs n, this means at least (n+1)/2 inputs must be 1.[1][2] For three inputs x, y, z \in \{0,1\}, it can be expressed as (x \land y) \lor (x \land z) \lor (y \land z), which evaluates to 1 precisely when at least two inputs are 1.[1] This function is symmetric, monotone increasing, unate, and self-dual, meaning its output mirrors the majority value without requiring explicit complementation for duality.[1][3] The majority function plays a foundational role in circuit design and computational complexity theory, serving as a building block for more complex operations due to its ability to realize basic gates like AND and OR when combined with constants or inversion—for instance, \mathrm{AND}(a,b) = \mathrm{MAJ}(a, b, 0) and \mathrm{OR}(a,b) = \mathrm{MAJ}(a, b, 1).[3] Together with the NOT gate, it forms a functionally complete set capable of expressing any Boolean function.[1] In digital circuits, majority gates are integral to arithmetic components such as carry-lookahead adders (e.g., Brent-Kung and Han-Carlson designs), where they reduce gate count and propagation delay compared to traditional XOR-based implementations.[3] Beyond conventional CMOS technology, majority logic has seen renewed interest in emerging paradigms like quantum-dot cellular automata (QCA), single-electron transistors (SET), magnetic tunnel junctions (MTJ), and even DNA computing, offering advantages in energy efficiency (often orders of magnitude lower power) and scalability for atomic-scale devices.[3] In theoretical computer science, the majority function exemplifies key concepts in complexity: it is evasive, requiring all n inputs to be queried in the worst case for decision tree evaluation (D(f) = n), and lies outside the class AC⁰, meaning it cannot be computed by constant-depth, polynomial-size circuits even with modular gates.[2] It also exhibits noise stability, making it robust to input perturbations, and serves as a benchmark for approximation algorithms—\epsilon-approximations via disjunctive normal form (DNF) require size $2^{O(\sqrt{n})}.[2] Historically rooted in early threshold logic and neural network models from the mid-20th century, majority functions continue to influence areas like fault-tolerant voting in distributed systems and promise problems in learning theory.[3]Introduction and Definition
Formal Definition
The majority function, denoted as \mathrm{MAJ}_n(x_1, \dots, x_n), is a Boolean function from the domain \{0,1\}^n to \{0,1\} that outputs 1 if and only if at least \lfloor n/2 \rfloor + 1 of its inputs are 1, and 0 otherwise.[4] It is conventionally defined for odd n to ensure a strict majority without ties, where the threshold is (n+1)/2.[5] Formally, \mathrm{MAJ}_n(x_1, \dots, x_n) = 1 if \sum_{i=1}^n x_i \geq \lfloor n/2 \rfloor + 1, and 0 otherwise, with each x_i \in \{0,1\}. For even n, this requires more than half the inputs to be 1, outputting 0 in case of a tie, though some contexts use alternative tie-breaking rules.[2] This function is a specific instance of a threshold function T_{k,n}, which outputs 1 if at least k of the n inputs are 1, where for the majority case k = \lfloor n/2 \rfloor + 1.[6] The notation \mathrm{MAJ}_n or \mathrm{Maj}_n is standard in computational complexity and Boolean analysis, emphasizing its role as the unweighted threshold at the midpoint.[4]Basic Examples
The majority function for a single input, denoted MAJ_1(x), is the trivial case where the output simply equals the input x, as there is only one variable to consider.[7] For three inputs, the majority function MAJ_3(x, y, z) outputs 1 if at least two of the inputs are 1, and 0 otherwise. The complete truth table for this case is as follows:| x | y | z | MAJ_3(x,y,z) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |