After sitting around just randomly thinking for awhile, I begun to truly wonder… What is the origin of the Order of Operations? Why is it what it is? When new mathematical operations are invented, whom decides where they fit in to the order of operations?
For example: “Add or subtract before you multiply or divide.” This rule arises because multiplication is distributive with respect to addition. That is:
a(b + c) = ab + ac
So you must add b and c together before you multiply by a, or else multiply each of them separately by a before adding.
If you’re talking about arithmetic operations, at school we were always taught:
BODMAS (or BOMDAS)
Brackets before Of before Division before Multiplication before Addition before Subtraction
Except that Division and Multiplication are done together, as are addition and subtraction. If I recall correctly, you should insert Exponents between the Brackets and Division/Multiplication. I can’t even remember what the “Of” does.
So if you had 4 + 3^2 * 5 - 3 / (1 + 2) you would work it out like:
1: Brakets -> 4 + 3^2 * 5 - 3 / 3
2: Exponents -> 4 + 9 * 5 - 3 / 3
3: Division -> 4 + 9 * 5 - 1
4: Multiplication -> 4 + 45 - 1
5: Addition -> 49 - 1
6: Subtraction -> 48
I hope I understood the OP properly…
The order of operations was designed to match the way we talk about things in English. There’s an old GQ thread from last summer entitled “Please Excuse My Dear Aunt Sally” in which I explained this in greater detail than I can right now. Search on that for some info.
As for new mathematical operations…well, there really aren’t any fundamentally new ones being invented. Not something to worry about, I’d say.
You have this backwards. You muliply or divide before you add or subtract.
However, you follow parentheses or brackets first, which is why you add first in the example you gave.
Robin: I may have been unclear. What I was getting at is asking why the order of operations was designed the way it was.
And I’ll search for the other thread as soon as I get home, and see what it said.
Actually, quite a few new operations have been invented in recent decades and order of precedence has to be worked out. But in the realm of computer languages. Take the following expression:
x != 4*y | a^3^b > 50872
!= is “not equal”
| is logical “or”
^ is exponentiation.
Clearly you want to do the arithmetics, then the relations, then the Boolean operations. (Although Wirth screwed this up in designing Pascal and Modula and you have to insert parens.) OTOH, a few languages have only one precedence rule: go left to right period.
Note also that it’s a good idea to have a^3^b to be interpreted as a^(3^b) and not (a^3)^b as the latter is the same as a^(3*b) which is much clearer when written that way. Hence exponentiation is (usually) right associative unlike most other operations. (Oddly, quite a few computer languages don’t have an exponentiation operator.)
Languages such as C/C++ have dozens of operators, all of whose order and associativity have to be exactly spelled out. There’s even a ternery operator! In C++ you can extend the meaning of operators, but you are stuck with the original precedence rules. E.g., you can “overload” + to mean string concatenation. In C++, brackets ("[" “]”) themselves are operators. C++'s rules are a lot more sane than Pascal’s. But there are still weird cases, such as when using some operations involving pointers and structures (records) together.
In the case of computer languages and the OP: It is the designer of the language that determines the precedence rules. No two designers have to agree. Ditto which operators to include and what symbols to use ("^" vs. “**” for exponentiation).
I could also ramble on about strange operators you might find in academic papers in logic and mathematics, but this is enough for now.
Given that English was not the preferred language of mathematics at the time modern algebraic notation came into use, I very much doubt that this is the case. Until recently, most mathematical research and pedagogy was conducted in Latin, and expressing even the most simple mathematical statements was incredibly convoluted. Take this famous line by Fermat:
All that work just to say that you can’t have x[sup]n[/sup] + y[sup]n[/sup] = z[sup]n[/sup] for n > 2. In fact, by the time modern notation was taking hold, we hadn’t completely liberated ourselves from the Greek idea that numbers were tied to geometrical figures and line segments.
I think maybe you are right. The mnemonic came from my grade school days which were a long time ago. Maybe I needed a mnemonic to recall the mnemonic.
Maybe this will teach me to think a little before answering, do you suppose? Nah.
Mathematically, all you really need is parentheses.
a*(b+c)=(ab)+(ac) regardless of whether addition comes before multiplication or vice versa.
The scientific order of operations is:
- A standard to avoid confusion among scientists
- Designed to minimize the use of parentheses
- Fairly intuitive to humans.
Calculators often use a left to right order of operations, i.e.
1+24=12. If they don’t have memory or parentheses, this can be a problem. (8953)+(83101) requires scratch paper or operator memory with such a calculator. Of course, if there was a scientific calculator without memory or parentheses, (1036+897)(6789+5021) would require scratch paper or operator memory.
I knew that, but didn’t want to get into it cause not everyone knows that. Replace “English” with “natural language” in my post and see what you think.
Naw… Mathematically, all you need is a stack :). Why yes, I do use an HP calculator, why do you ask?
I think you don’t realize that not every natural language has English’s subject-verb-object (SVO) word order. In fact, 60% of the world’s languages, including Latin, use some other ordering. If the precedence and associativity of mathematical operators really were based on Latin grammar, which usually uses SOV, everything would probably be in Reverse Polish Notation. For example, instead of writing “5 + 3 = 2 + 6”, we would write “5 3 + 2 6 + =”.
Given that our modern system of mathematical notation arose gradually and haphazardly over hundreds of years, with contributions from dozens of mathematicians with different native tongues, I think it’s safe to say that there is no short answer to the question of how operator rules were established.
I’m well aware of Latin word order, having taken it for two years. Actually, the more I think about it, the more I think that I’m confusing cause and effect here.
This is probably very true.