Last month, I wrote about group theory via monkeys, and it got me thinking about the associative property. A mathematical group consists of a collection of stuff: integers, or rational numbers, or even something more abstract; and an operation that combines any two elements of your stuff into another element of stuff.
One of the rules the stuff and operation have to obey in order to be a group is associativity: it can’t matter what order you combine your stuff in. The prototypical example of a group is the integers with the operation of addition. In that case, the associative law says that if you are adding 1+2+3, it doesn’t matter whether you add 1 and 2 first, or 2 and 3 first.
Addition and subtraction are similar operations. In school, we generally learn addition first and then subtraction. Later, when we learn about negative numbers, we learn that subtraction is just addition of a negative number. So if addition follows the associative law, then it seems like subtraction should as well.
But it doesn’t! In the expression 5-4-3, we get different answers depending on how we group it. (5-4)-3=-2, and 5-(4-3)=4. Likewise, subtraction doesn’t associate with addition. (5-2)+4=7, while 5-(2+4)=-1.
The problem goes away if we replace subtraction signs with addition of negative numbers. In other words, if we see the expression 5-4-3, we convert it to 5+(-4)+(-3). Then the answer is unambiguously -2 because by replacing the subtraction signs by addition of negative numbers, we’ve made a choice about what order the subtraction comes in.
We can peel another layer off this onion: what is a negative number? That’s a philosophical question, but one way of thinking about the minus sign at the beginning of a negative number is as the symbol for unary subtraction. A unary operator is an operator that takes only one input. We’re introduced to subtraction as a binary operation, for example, 5-3, but when we see a negative number, we’re omitting and understood 0 from the beginning of the expression. The number -2 is shorthand for 0-2.
I started thinking about this when my Internet pal and one of the editors of the excellent math(s) blog The Aperiodical tweeted this:
We have unary minus, i.e. "-2" is the same as "0-2". Why don't we have unary division, i.e. "÷2" could mean the same as "1÷2"?
— Christian Perfect (@christianp) June 17, 2014
Multiplication and division share a similar relationship to addition and subtraction. (In the form of an SAT analogy, may they rest in peace, addition:subtraction::multiplication:division.) Multiplication is the “default” operation, and division is an inverse operation. And once again, multiplication is associative, but division is not. (12÷6)÷2=1, while 12÷(6÷2)=4. Division doesn’t associate with multiplication either, and this is a source of confusion in those awful math problems that sometimes make the rounds on Facebook. 6÷2(1+2) is ambiguous because of the non-associativity of division with multiplication and inconsistency in how we interpret the order of operations, sometimes called PEMDAS, BEMDAS, BODMAS, or BIDMAS.
Unary subtraction is one reason similar problems that only use addition and subtraction are not ambiguous. Because we’re so used to using unary subtraction, we automatically do the problem 5-4-3 as 5+(-4)+(-3), which is the same as doing it strictly from left to right. (Not being an expert at the history of mathematical notation, I do note that this might be a chicken-and-egg situation: did unary subtraction develop because we are so committed to doing addition/subtraction problems from left to right? Or does unary subtraction, and our comfort with negative numbers, make that the natural way to handle addition/subtraction problems?)
Would we have Facebook flame wars over the order of operations if we had unary division? As Perfect tweeted, it wouldn’t be hard to notate it: unary subtraction uses the additive identity, 0, as the understood first term. Analogously, unary division would use the multiplicative identity, 1, as the understood first term. ÷2 would mean 1÷2, or ½, just like -2 means 0-2.
If we used unary division the same way we automatically use unary subtraction in an expression like 5-4-3, then 6÷2(1+2) could mean 6×½×(1+2), and 9 would be the unambiguous answer. Unary division would make the choice for us of what order to do the division and multiplication in. It would reinforce the idea that multiplication and division are of equal precedence and should be performed from left to right.
But another source of ambiguity in this problem is the missing times sign: 2(1+2) means 2×(1+2). When written without the times sign, it's sometimes called "multiplication by juxtaposition." Some people interpret multiplication by juxtaposition as taking precedence over multiplication that uses the times sign. Because there's no such thing as addition by juxtaposition, it's not clear how we would treat multiplication by juxtaposition in a world that also had unary division. (Cue dramatic movie trailer music, with voiceover: "In a world with unary division...")
The solution to the infamous Facebook problem is not 1 or 9, it’s to put more parentheses into the expression to keep it from being ambiguous in the first place! Mathematical notation is not a God-given sacred scroll that we must interpret correctly, it's something we made up to make communication easier. If we're in danger of being misunderstood, we should just add a couple of symbols to clear it up.