Properties of binary operators
Commutativity
- A binary operator is commutative if changing the order of the inputs doesn’t change the output.
- For example, addition (
+ ) is commutative becausea + b = b + a for any numbersa andb . - multiplication (
* ) is also commutative:a * b = b * a . - However, subtraction (
- ) and division (/ ) are not commutative:a - b is generally not equal tob - a .a / b is generally not equal tob / a .- Exponentiation (
^) - powers - are also not commutative:a^b is generally not equal tob^a .
Associativity
- A binary operator is associative if the way in which inputs are grouped does not affect the output.
- For example, addition is associative because
(a + b) + c = a + (b + c) for any numbersa ,b , andc . - multiplication is also associative:
(a * b) * c = a * (b * c) . - However, subtraction and division are not associative:
(a - b) - c is generally not equal toa - (b - c) .(a / b) / c is generally not equal toa / (b / c) .- Exponentiation is also not associative:
(a^b)^c is generally not equal toa^(b^c) .
Identity elements
- If
e*a=a*e for ALL values in the set,e is the identity. - For addition, for example, the identity is
0 , because0 + a = a + 0 = a for any numbera . - For multiplication, the identity is
1 , because1 * a = a * 1 = a for any numbera .
The inverse of the identity element is the identity element itself.
Inverse elements
- The inverse element is the
- If
a*b=b*a=e ,a andb are inverse of each other. - For addition, the inverse of a number
a is-a , becausea + (-a) = (-a) + a = 0 . - For multiplication, the inverse of a number
a (assuminga \neq 0 ) is\frac{1}{a} , becausea * \frac{1}{a} = \frac{1}{a} * a = 1 .
Not all binary operators have an inverse.
flashcards
| Question | Answer |
|---|---|
| What is a commutative binary operator? | A binary operator is commutative if changing the order of the inputs does not change the output, e.g., |
| Name two commutative binary operators and two non-commutative binary operators with examples. | Commutative: addition ( Non-commutative: subtraction ( |
| Is exponentiation ( | No, exponentiation is not commutative; |
| What is an associative binary operator? | A binary operator is associative if the way inputs are grouped does not affect the output, e.g., |
| Name two associative binary operators and two non-associative binary operators. | Associative: addition and multiplication. Non-associative: subtraction and division (e.g., |
| Is exponentiation associative? | No, exponentiation is not associative; |
| What is an identity element for a binary operator? | If |
| Give the identity elements for addition and multiplication. | For addition, the identity is For multiplication, the identity is |
| What is the relationship between the identity element and its inverse? | The inverse of the identity element is the identity element itself. |
| What defines inverse elements for a binary operator? | If |
| Give the inverse elements for addition and multiplication. | For addition, the inverse of For multiplication, the inverse of |
| Do all binary operators have an inverse? | No, not all binary operators have an inverse. |