You are Here: Home >< Maths

Order of execution Watch

1. BODMAS (BIDMAS) depending if you want to use the term order or indices, is the general rule that is applied in calculations.

For example, a + b x c is calculated as follows:

Step 1. b x c (= d, say)
Step 2. a + d

This is the accepted rule and there is no ambiguity.

However, recently I have seen this written down:

Evaluate a x b / c x d

How would one interpret that? Excel does the following:

Step 1. a x b (= e, say)
Step 2. e / c (= f, say)
Step 3. f x d

In other words, it interprets it as:

((a x b) / c) x d

Regardless of how Excel interprets it, mathematically what is the correct sequence?

Could you argue that it should be:

(a x b) / (c x d)?
2. (Original post by powwer)
BODMAS (BIDMAS) depending if you want to use the term order or indices, is the general rule that is applied in calculations.

For example, a + b x c is calculated as follows:

Step 1. b x c (= d, say)
Step 2. a + d

This is the accepted rule and there is no ambiguity.

However, recently I have seen this written down:

Evaluate a x b / c x d

How would one interpret that? Excel does the following:

Step 1. a x b (= e, say)
Step 2. e / c (= f, say)
Step 3. f x d

In other words, it interprets it as:

((a x b) / c) x d

Regardless of how Excel interprets it, mathematically what is the correct sequence?

Could you argue that it should be:

(a x b) / (c x d)?

a x b / c x d means only the c is in the denominator as far as I can see

It would be written as

Whereas would need to be (a x b)/(c x d)
3. (Original post by powwer)
BODMAS (BIDMAS) depending if you want to use the term order or indices, is the general rule that is applied in calculations.

For example, a + b x c is calculated as follows:

Step 1. b x c (= d, say)
Step 2. a + d

This is the accepted rule and there is no ambiguity.

However, recently I have seen this written down:

Evaluate a x b / c x d

How would one interpret that? Excel does the following:

Step 1. a x b (= e, say)
Step 2. e / c (= f, say)
Step 3. f x d

In other words, it interprets it as:

((a x b) / c) x d

Regardless of how Excel interprets it, mathematically what is the correct sequence?

Could you argue that it should be:

(a x b) / (c x d)?
Strictly speaking, Excel is perfectly correct. Multiplication and division have equal priority, so you evaluate the calculation working from left to right:
first a x b
then divide by c
then multiply by d

However, the question is really academic (no pun intended) because no sensible mathematician would ever write down something like a x b / c x d without either (a) using brackets to eliminate any ambiguity, or (b) using formatting (e.g. Latex) to make it clear how the fraction should be arranged.
4. (Original post by davros)
Strictly speaking, Excel is perfectly correct. Multiplication and division have equal priority, so you evaluate the calculation working from left to right:
first a x b
then divide by c
then multiply by d

However, the question is really academic (no pun intended) because no sensible mathematician would ever write down something like a x b / c x d without either (a) using brackets to eliminate any ambiguity, or (b) using formatting (e.g. Latex) to make it clear how the fraction should be arranged.
Precisely! The problem was posed by some "normal" person!

Whilst I've got your attention, mathematically what is a^b^c?

Is it (a^b)^c or a^(b^c)?

I think it's the latter, years ago read something about evaluating from right to left.

FYI, Excel does the former, ie (a^b)^c
5. (Original post by powwer)
Precisely! The problem was posed by some "normal" person!

Whilst I've got your attention, mathematically what is a^b^c?

Is it (a^b)^c or a^(b^c)?

I think it's the latter, years ago read something about evaluating from right to left.

FYI, Excel does the former, ie (a^b)^c
It's the latter.

If it were the former, it could immediately be simplified to
6. (Original post by davros)
It's the latter.

If it were the former, it could immediately be simplified to
So Excel's wrong!

Just because the former can be simplified to

that doesn't explain why it can't be that.

7. (Original post by powwer)
So Excel's wrong!

Just because the former can be simplified to

that doesn't explain why it can't be that.

It is not about right to left

You have a to the power of something - to the power of what - to the power of b^c - so you need to do that before you can do a to it
8. (Original post by powwer)

Just because the former can be simplified to

that doesn't explain why it can't be that.
It doesn't mean that it "can't", it just means that it would be inefficient to do so, because every time you saw your original expression you could replace it with the simplified version. It's just one of the ways I remember which interpretation is the correct one (the other way being what TenOfThem says).
9. (Original post by TenOfThem)
It is not about right to left

You have a to the power of something - to the power of what - to the power of b^c - so you need to do that before you can do a to it
I agree (of course) with the conclusion, but I'm not 100% convinced by the argument. Compare with:

"a^b^c: You have a to the power of something, and that something is b. Then you have a^b to the power of something, and that something is c. So a^b^c = (a^b)^c."

It's not immediately obvious to me that one argument here is better than the other, particularly if I "justify" it by saying "If your argument was valid, then surely so is this one: a-b-c = a-(b-c), because I have a minus something - minus what - minus b-c so you need to do that before you can take it away from a".

(I'm happy to be swayed on this one if you can...)

FWIW, my reasoning on this follows Davros's (to the point that I am fairly sure that if the laws of mathematics were different and a^(b^c) = a^(bc) while (a^b)^c was the interpretation that couldn't be trivially rewritten, then we would end up with the convention that a^b^c = (a^b)^c).
10. (Original post by powwer)
Precisely! The problem was posed by some "normal" person!

Whilst I've got your attention, mathematically what is a^b^c?

Is it (a^b)^c or a^(b^c)?

I think it's the latter, years ago read something about evaluating from right to left.
You're in danger of confusing two concepts, namely operator precedence and operator associativity.

You can define a precedence order for a set of operators (such as BIDMAS/BODMAS/PEMDAS/etc). Having done that, it may be that more than one operator has been assigned the same precedence, and you need to decide how to evaluate expressions containing operators of the same precedence. This problems arises in a practical context for people defining programming languages, and those who write parsers for them.

If you write, for example, "2+3-5" in certain programming languages (like C et al), the problem arises, since "+" and "-" have the same precedence, and it arises trivially if you write "10-2-2" since "-" and "-" have the same precedence.

There is no unique answer to the question of evaluation order here: you simply have to agree on an interpretation to be used. Usually, you are going to have either left, right, or no associativity e.g.

left: 10-2-2 = (10-2)-2
right: 2+3-5 = 2+(3-5)
none: [email protected]@c = undefined

where @ is some operator where we want to forbid expressions of that kind. Note also that sometimes the associativity doesn't matter e.g. (2+3)-5=2+(3-5)=0.

Ultimately, the choice of operator associativity is convention, and the conventions adopted by mathematicians need not be those adopted by people defining computing languages.

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: July 25, 2014
Today on TSR

Oxford interview invitations

When can you expect yours?

Official Cambridge interview invite list

Discussions on TSR

• Latest
• See more of what you like on The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

• Poll
Useful resources

Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

How to use LaTex

Writing equations the easy way

Study habits of A* students

Top tips from students who have already aced their exams

Chat with other maths applicants

Groups associated with this forum:

View associated groups
Discussions on TSR

• Latest
• See more of what you like on The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

• The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.