The difference (-) operation removes common tuples from the first relation.…
2018
The difference (-) operation removes common tuples from the first relation. This operation is
- A.
commutative and associative
- B.
non-commutative and associative
- C.
commutative and non-associative
- D.
non-commutative and non-associative
Attempted by 56 students.
Show answer & explanation
Correct answer: D
Two structural properties describe how a binary operation behaves under operand order and grouping: an operation is commutative when swapping its two operands leaves the result unchanged, and associative when regrouping three or more applications leaves the result unchanged. Symmetric operations such as union and intersection satisfy both, because membership in the result never depends on which operand comes first. The difference operation is defined asymmetrically: one relation's tuples are removed from the other, so the two operands play structurally different roles.
Check commutativity: take R = {1, 2} and S = {2, 3}. R - S = {1} (2 is common to both, so it is removed from R), while S - R = {3} (2 is common to both, so it is removed from S). Since {1} is not equal to {3}, swapping the two relations changes the result.
Check associativity: take R = {1, 2, 3}, S = {2}, T = {3}. (R - S) - T = ({1, 2, 3} - {2}) - {3} = {1, 3} - {3} = {1}. R - (S - T) = {1, 2, 3} - ({2} - {3}) = {1, 2, 3} - {2} = {1, 3}. Since {1} is not equal to {1, 3}, regrouping the three applications changes the result.
As a check, union behaves the opposite way: R union S always equals S union R, and (R union S) union T always equals R union (S union T), because membership in a union never depends on operand order or grouping. Difference fails both checks that union and intersection pass, confirming it is the exception among the three basic set operations.
The difference operation is therefore both non-commutative and non-associative.