Mathwords logoMathwords

Binary Operator — Definition, Formula & Examples

A binary operator is an operation that takes exactly two inputs (called operands) and combines them to produce a single output. Addition, subtraction, multiplication, and division are all binary operators you already use every day.

A binary operator on a set SS is a function :S×SS\ast: S \times S \to S that assigns to each ordered pair (a,b)(a, b) of elements in SS exactly one element aba \ast b in SS. When the output always remains in SS, the set is said to be closed under that operation.

Key Formula

:S×SS\ast: S \times S \to S
Where:
  • \ast = The binary operator (the rule applied to the two inputs)
  • SS = The set from which both inputs are drawn and in which the output lands

How It Works

A binary operator sits between two operands: aba \ast b. The operator \ast could represent addition, multiplication, or any rule you define. For the operation to be well-defined, every valid pair of inputs must produce exactly one output. Properties like commutativity (ab=baa \ast b = b \ast a) and associativity (a(bc)=(ab)ca \ast (b \ast c) = (a \ast b) \ast c) may or may not hold, depending on the specific operator.

Worked Example

Problem: Define a binary operator \oplus on the integers by the rule ab=2a+ba \oplus b = 2a + b. Evaluate 353 \oplus 5 and determine whether \oplus is commutative.
Evaluate: Substitute a=3a = 3 and b=5b = 5 into the rule.
35=2(3)+5=6+5=113 \oplus 5 = 2(3) + 5 = 6 + 5 = 11
Test commutativity: Now compute 535 \oplus 3 using the same rule.
53=2(5)+3=10+3=135 \oplus 3 = 2(5) + 3 = 10 + 3 = 13
Compare: Since 111311 \neq 13, the two results differ.
35533 \oplus 5 \neq 5 \oplus 3
Answer: 35=113 \oplus 5 = 11, and the operator \oplus is not commutative because swapping the operands changes the result.

Why It Matters

Binary operators are the foundation of algebraic structures like groups, rings, and fields studied in abstract algebra and discrete mathematics. Understanding them is essential in computer science, where operations on data types (bitwise AND, OR, XOR) are all binary operators that drive Boolean circuits and algorithms.

Common Mistakes

Mistake: Confusing a binary operator (two operands) with a unary operator (one operand).
Correction: Negation (a-a) and the absolute value (a|a|) act on a single input, making them unary. A binary operator always requires two inputs, like a+ba + b.