Sub topic 6
Argument Order: a★b Is Not b★a
This chapter assumes you can evaluate expressions with integers, fractions, and exponents, and that you can solve a one-variable linear equation. It also assumes you have read the earlier chapters in this series, which cover reading a made-up symbol as a rule and evaluating it by substitution.
Why order matters
A defined operation is a rule with slots. Each slot is a position, such as "first input" or "second input", and the rule can treat the positions differently. Take the running example:
a★b = 2a + b²
The first input is doubled. The second input is squared. These are different jobs, so swapping the inputs changes the result.
def star(a, b):
return 2 * a + b ** 2
print(star(3, 4)) # 2*3 + 4**2 = 6 + 16 = 22
print(star(4, 3)) # 2*4 + 3**2 = 8 + 9 = 17The values 22 and 17 differ, so 3★4 ≠ 4★3. Ordinary addition and multiplication are commutative, which means a + b = b + a. Learners often carry that habit over to invented symbols, and the GRE writes questions that punish it.
Position, not letter
The letters in the definition are placeholders. What counts is the position each input fills.
Suppose the problem defines x♦y = 3x − y. It then asks for 5♦2. The first input, 5, goes into the x slot. The second input, 2, goes into the y slot.
- 5♦2 = 3(5) − 2 = 13
- 2♦5 = 3(2) − 5 = 1
The same applies when the question uses different letters from the definition. If the definition uses x and y and the question asks for m♦n, then m fills the first slot and n fills the second. Letters can also collide. The definition may use a and b while the question asks for b★a. In that case a is the name of the first slot in the definition, and the value that goes into it is whatever stands first in the question. The expression b★a means "put b in the first slot and a in the second".
def star(a, b):
return 2 * a + b ** 2
a, b = 2, 3
# b star a: the value of b goes into the FIRST slot
print(star(b, a)) # 2*3 + 2**2 = 10
# a star b: the value of a goes into the first slot
print(star(a, b)) # 2*2 + 3**2 = 13A reliable habit is to rewrite the definition with blank slots before you substitute:
( first ) ★ ( second ) = 2( first ) + ( second )²
Then copy the inputs into the slots in the order they appear in the question.
Parentheses protect signs and expressions
Argument order interacts with the other traps in this series. When the swapped values are negative or are whole expressions, parentheses keep the arithmetic correct.
def star(a, b):
return 2 * a + b ** 2
print(star(-2, -3)) # 2*(-2) + (-3)**2 = -4 + 9 = 5
print(star(-3, -2)) # 2*(-3) + (-2)**2 = -6 + 4 = -2Swapping the inputs gives 5 in one order and −2 in the other. The second input is squared, so its sign disappears. The first input is only doubled, so its sign survives. If you write −3² instead of (−3)², you get −9 instead of 9, and the answer is wrong.
Expressions as inputs work the same way. Using x♦y = 3x − y:
(k + 1)♦(k − 1) = 3(k + 1) − (k − 1) = 3k + 3 − k + 1 = 2k + 4
(k − 1)♦(k + 1) = 3(k − 1) − (k + 1) = 3k − 3 − k − 1 = 2k − 4
The parentheses around (k − 1) in the first line are what make the subtraction apply to both terms. Without them you would get 3k + 3 − k − 1, which is wrong.
Comparing a★b with b★a
GRE quantitative comparison questions often ask which of 5★2 and 2★5 is larger. Compute both fully. Do not guess from the size of the inputs.
- 5★2 = 2(5) + 2² = 10 + 4 = 14
- 2★5 = 2(2) + 5² = 4 + 25 = 29
Here the second value is larger, because the large input was squared. With a different rule the answer could reverse. For example, if a∘b = a − 2b, then 7∘3 = 1 and 3∘7 = −11. The first order is larger. The only way to know is to evaluate.
A useful sanity check is to find out which slot grows faster. In 2a + b², the second slot is squared, so a large second input produces a large result. In a − 2b, the second slot is subtracted, so a large second input produces a small result.
When do the two orders agree?
Sometimes a★b really does equal b★a for particular inputs. Two cases show up:
- The inputs are equal, so there is nothing to swap. star(a, a) is trivially the same in both orders.
- The inputs are different but the rule happens to balance them.
For the second case, set the two orders equal and solve:
2a + b² = 2b + a²
Move everything to one side and rearrange:
a² − 2a = b² − 2b
a² − b² − 2a + 2b = 0
(a − b)(a + b) − 2(a − b) = 0
(a − b)(a + b − 2) = 0
So a★b = b★a exactly when a = b or a + b = 2. For instance 0★2 = 4 and 2★0 = 4. Also 3★(−1) = 6 + 1 = 7 and (−1)★3 = −2 + 9 = 7. A short program confirms the pattern:
def star(a, b):
return 2 * a + b ** 2
pairs = [
(a, b)
for a in range(-3, 4)
for b in range(-3, 4)
if a < b and star(a, b) == star(b, a)
]
print(pairs) # [(-1, 3), (0, 2)]Both pairs sum to 2, and the filter a < b removes the equal-input case. You will not need to factor on test day. The point is that "not commutative" means "not commutative for every pair". A few special pairs can still match. To show an operation is not commutative, you need one pair where the orders disagree. To show it is commutative, you would need a proof for all pairs, and a few matching examples are not enough.
Argument order when solving for an unknown
When the unknown sits in a particular slot, the equation you get depends on that slot.
Using a★b = 2a + b²:
- Unknown in the first slot: x★3 = 17 gives 2x + 9 = 17, so x = 4. This is a linear equation with one solution.
- Unknown in the second slot: 3★x = 15 gives 6 + x² = 15, so x² = 9, and x = 3 or x = −3. This is a quadratic equation with two solutions.
Both are correct, because (−3)² = 9. If the question says "x is positive", keep only 3. If the question asks for the possible values of x, give both. Reading the slot correctly decides whether you look for one answer or two.
def star(a, b):
return 2 * a + b ** 2
print([x for x in range(-10, 11) if star(x, 3) == 17]) # [4]
print([x for x in range(-10, 11) if star(3, x) == 15]) # [-3, 3]Common errors
| Error | Example with a★b = 2a + b² | Fix |
|---|---|---|
| Treating the operation as commutative | Assuming 3★4 = 4★3 | Compute both orders. They are 22 and 17. |
| Matching by letter, not position | Reading b★a as "use b where the formula says b" | The first input always fills the first slot. Here b★a = 2b + a². |
| Losing the sign when squaring | Writing −3² = −9 for the second input | Write (−3)² = 9. |
| Forgetting to wrap an expression | (k + 1)★2 treated as 2k + 1 + 4 | Write 2(k + 1) + 4 = 2k + 6. |
| Missing the second solution | Solving 3★x = 15 and stopping at x = 3 | Squared slots give ±. Check both roots. |
| Using the standard meaning of the symbol | Reading ★ as multiplication | Use only the given definition. |
A short checking routine
Use this routine on any question where order matters:
- Write the definition with blank slots, marking what each slot does.
- Copy the question's inputs into the slots left to right, each in parentheses.
- Simplify using order of operations.
- Evaluate the swapped order too, whenever the question hints at comparing or at properties.
- If you solved for an unknown, substitute the answer back into the original definition in the same slot.
Step 5 is the strongest check. For 3★x = 15 and x = −3, you compute 2(3) + (−3)² = 6 + 9 = 15, which confirms the result.
Exercise
A operation is defined by a★b = 2a + b². Find the value of 4★(−1) and the value of (−1)★4. Are they equal?
Show answer
4★(−1) = 2(4) + (−1)² = 8 + 1 = 9. (−1)★4 = 2(−1) + 4² = −2 + 16 = 14. They are not equal.
Exercise
Define x♦y = 3x − y. Express (k + 2)♦(k − 3) in terms of k, and then express (k − 3)♦(k + 2).
Show answer
(k + 2)♦(k − 3) = 3(k + 2) − (k − 3) = 3k + 6 − k + 3 = 2k + 9. (k − 3)♦(k + 2) = 3(k − 3) − (k + 2) = 3k − 9 − k − 2 = 2k − 11.
Exercise
With a★b = 2a + b², find all values of x such that 5★x = 30.
Show answer
5★x = 10 + x² = 30, so x² = 20 and x = √20 = 2√5 or x = −2√5. Check: 10 + (2√5)² = 10 + 20 = 30.
Exercise
With a★b = 2a + b², show that the operation is not commutative by giving one pair of numbers, and then find one pair of different numbers for which a★b = b★a.
Show answer
For 1 and 2: 1★2 = 2 + 4 = 6, while 2★1 = 4 + 1 = 5, so the orders disagree and the operation is not commutative. For 0 and 2: 0★2 = 0 + 4 = 4 and 2★0 = 4 + 0 = 4, so these agree. In general, different numbers agree exactly when a + b = 2.