# Order of Operations

1. Jan 22, 2010

### pzona

Just a random thought I had today. Where does the order of operations come from? Is there a mathematical basis for it, or is it just a set of accepted rules developed out of necessity? As far as I can tell, these rules only exist for the purpose of having a convention to follow. Is this accurate, or is there something deeper behind it? Like I said, just curious

2. Jan 22, 2010

### Pengwuino

It is convention as far as I know.

3. Jan 22, 2010

### Hurkyl

Staff Emeritus
I believe this is a question of psychology, not mathematics.

The armchair* psychologist in me thinks it involves spatial relationships: our visual systems allow us to instantly parse a big expression like
3x + 17uvw - 16h2
But notice how it's much harder to read
$$3 \times x + 17 \times u \times v \times w - 16 \times h\uparrow 2$$​
Interestingly, I find this somewhat easier to read:
$$((3 \times x) + (17 \times u \times v \times w)) - (16 \times (h\uparrow 2$$))​
there are even more symbols, so I initially thought it would clutter things up, but the parentheses are cues to help group things together. I think that's just because it's typeset well and a good choice of symbols: it would probably be harder monospaced, with a more intrusive deliminter. (e.g. try # & instead of ( ))
##3*x&+#17*u*v*w&&-#16*#h^2&&

*: Meaning I have no training in this subject

4. Jan 22, 2010

### Tac-Tics

It is entirely convention. PEMDAS is merely convenient for mental manipulation of symbols on the page. Parentheses alone would be adequate enough to specify order of operations.

In fact, in the Lisp programming language, this is exactly the way things are done. Lisp was designed to have the most simple syntax possible. Everything in the entire language can be written with symbols (names like f, x, cons, lambda, +, *, ...), numbers (0, 1, 2, ...), and parantheses (... do I really need to put parentheses inside parentheses?...). The operator/function name is written first, followed by the operands. So the expression x + 2y + 1 would be written as (+ (+ x (* 2 y)) 1). The result is a syntax which is easy for a computer to parse and which is totally unambiguous.

In written math, though, it's much more important that the notation cater to the human mind, not to a computer. Humans can infer meaning based on context, so it can be somewhat ambiguous. Our PEMDAS notation makes it easy to write out, group things, and mentally move symbols about the page.

We can leave off needless parentheses (which would otherwise just be "line noise" in programmer terminology), and we can do operations in parallel. If you want to know a polynomial's power, the raised position of the exponents makes it very fast to visually track down the biggest power.

When a linear operator is applied to a polynomial, it's very easy to distribute the operator over the terms.

In defining functions and doing calculus, we almost always rely on the convention of using one of x, y, z, u, v, t, s, w, or some Greek letter for the parameter. You don't see too many f(g) = g^2 - 1, even though syntactically, it's totally legitimate.

One source of confusion in programming languages (and I'm sure, in some areas of math) are use of unfamiliar operators. There are tons of operators in programming, such as &&, |, ++, !, ~, >>, <<, and ^, which appear over and over again.... and it's not always clear what their precedence is. A good programmer will always put those expressions in parentheses, so other programmers, who might not be as intimately familiar with the language, are able to figure out the meaning without having to look it up in the manual. In Haskell, the situation is FUBAR beyond belief, because any programmer can define new operators and give them their own precedence.

5. Jan 23, 2010

### HallsofIvy

Yes, it is purely convention, arising out of the way we choose to write formulas- which is itself convention.

6. Jan 24, 2010

### pzona

Alright, this basically confirms what I thought previously. Let's take an example of 2x+y, for which x=1 and y=4. Based on the idea that the order of operations is just conventions, 10 is no less legitimate an answer than 6, right? Sorry if this seems like a basic question, it's just strange to think about, given the ideas I've been learning my entire life. Also, is there any particular reason that this set of rules is defined as the order of operations? This seems like it might be more psychological or philosophical than mathematical. Does anyone know of any good links regarding this?

By the way, thank you all for the answers so far, they've been very helpful.