Your textbook tells you addition and multiplication are commutative; subtraction and division are not. You memorised that fact for the test. Three years later a new operation shows up — modular exponentiation, matrix multiplication, function composition — and you have no idea if it commutes. You go back to the textbook. Wrong move. There is a one-second test you can run on any operation, without looking anything up.
The test
Take any two concrete inputs. Apply the operation one way. Apply it the other way. Compare.
If the two answers disagree for even one pair (a, b), the operation is not commutative. Full stop. One counter-example is enough to kill commutativity forever — no amount of agreeing pairs can resurrect it.
If the two answers agree for every pair you can think of, the operation is probably commutative (and if you want to be sure, you prove it abstractly). But the quick, no-memory version of the rule is: swap and compare.
Subtraction and division fail instantly
Try subtraction with a = 5, b = 3:
Different. Subtraction is not commutative. Done — you did not have to remember, you computed.
Try division with a = 8, b = 2:
Different. Division is not commutative. Done.
Addition with a = 5, b = 3:
Same. One pair is not a proof that addition commutes, but it is evidence consistent with the commutative rule. Try more pairs — they always agree. For addition on reals, the agreement is universal, and we call it commutative.
Why one counter-example suffices
The statement "operation \star is commutative" is a universal claim: it says a \star b = b \star a for every pair of inputs in the set. A universal claim is refuted by a single exception. If even one specific pair gives different answers, the universal statement is false. This is why mathematicians sometimes call commutative-ness a "forall" property — it lives or dies on the worst single pair in the entire set.
Agreement, by contrast, is not a proof. Finding 5 + 3 = 3 + 5 does not prove addition commutes on all reals — it only proves it commutes for that one pair. The proof of commutativity for real addition comes from the Peano axioms and builds up through induction; the swap test is a quick check, not a substitute. But the swap test is more than enough to spot non-commutativity, and that is what you usually need to do in practice.
Try it: swap and watch
The test works on any operation
The swap test is not about arithmetic — it is about commutativity. Apply it to any operation you care about.
- Matrix multiplication. Pick two simple 2 \times 2 matrices. Multiply AB and BA. Almost always different. Matrix multiplication is not commutative.
- Function composition. Pick two functions, f(x) = x + 1 and g(x) = 2x. Compose (f \circ g)(x) = f(g(x)) = 2x + 1. Swap: (g \circ f)(x) = g(f(x)) = 2(x + 1) = 2x + 2. Different. Function composition is not commutative.
- String concatenation. "ab" + "cd" = "abcd". "cd" + "ab" = "cdab". Different. Not commutative.
- Set union. A \cup B = B \cup A for all sets — the definition is symmetric. Commutative.
- Set difference. A \setminus B \neq B \setminus A in general. Not commutative.
- Vector cross product. \vec{a} \times \vec{b} = -\vec{b} \times \vec{a}. Swap flips the sign — not commutative (it is anti-commutative).
In every case above, you did not look anything up. You picked two concrete inputs, ran the operation both ways, and compared. Commutativity is decided by computation.
Why: commutativity is a universal statement — "for all a, b." Testing two concrete inputs is the fastest way to falsify such a statement. If the test passes on a few pairs, you have weak evidence for commutativity but no proof. If it fails on even one pair, the universal claim dies on the spot.
When the swap test accidentally passes
There is one subtle trap. Sometimes an operation appears commutative on specific pairs while actually failing in general. For example, in matrix multiplication, the identity matrix I commutes with every matrix: AI = IA = A. If you happened to pick B = I for your test, the swap would succeed, and you might wrongly conclude matrix multiplication commutes. The fix is to pick generic inputs — two matrices with no special structure. The trap is unusual in practice but worth knowing: when your first test pair passes, try a different pair before declaring commutativity.
For subtraction, there is a similar edge case: if you pick a = b, then a - b = b - a = 0. Not a counter-example. So pick a \neq b and the test bites immediately.
Why this matters for JEE
JEE Advanced loves to test whether a student has internalised which operations commute. Questions appear where you have to swap operators in matrix equations, function compositions, or modular arithmetic — and if you forget which commute, you will swap illegally and get the wrong answer. The swap test is your portable no-memory check: whenever you are about to swap two operands, pause for one second, pick a concrete pair, and verify.
Related: Operations and Properties · Commutative, Associative, Distributive — Three Laws as Three Rearrangements · Swap the Order of a Subtraction and Watch It Land Somewhere Else · Is Subtraction Just 'Adding a Negative' — or Is It Its Own Operation?