-1

I used PEMDAS on 3 - 1 * 8 + 2 * 3.

Steps: 1) 1 * 8 = 8 2) 2 * 3 = 6 3) 8 + 6 = 14 4) 3 - 14 = -11

Multiply all the terms, then add and finally subtract but I get -11 as the result. But when I googled it, it said 1. Where did I go wrong?

Nicholas
  • 679
  • 2
  • 11
  • 29
  • http://en.wikipedia.org/wiki/Order_of_operations#Mnemonics look at the part following "These mnemonics may be misleading when written this way..." and the example there. – Alok Singhal Mar 12 '15 at 04:37
  • multiplications and divisions go first and then you make the subtraction and addition. This means 3-(1*8)+(3*2)=3-8+6=1 – dgsleeps Mar 12 '15 at 04:37
  • 4
    I'm voting to close this question as off-topic because this question is not programming related and belongs on the math stack exchange site. – Tommy Mar 12 '15 at 04:38

5 Answers5

2

By Following the BODMAS rule - 3 - 1 * 8 + 2 * 3

So According to BODMAS Rule- B → Brackets first (parentheses)

O → Of (orders i.e. Powers and Square Roots, Cube Roots, etc.)

DM → Division and Multiplication (start from left to right)

AS → Addition and Subtraction (start from left to right)

So our equation ->

3 - (1 * 8) + (2 * 3)
3-8+6 
-5+6
1
M3ghana
  • 1,231
  • 1
  • 9
  • 19
1

The order of operations is, as you said it PEMDAS (or BEDMAS whatever you like), but it is also left-to-right. And on top of that: multiplication and division are treated as the same order and so are addition and subtraction.

So your first two steps were right.

3 - (1 * 8) + (2 * 3)
3 - 8 + 6

Now here is where the left-to-right ordering takes place.

((3 - 8) + 6)
(-5 + 6)
1

To make it easier, you can remember that x - y is really just x + (-y). Then the order of subtraction and addition doesn't matter at all.

Obicere
  • 2,999
  • 3
  • 20
  • 31
1

After multiply all the terms,please follow the order of operations.Right steps: Steps: 1) 1 * 8 = 8 2) 2 * 3 = 6 3)3-8=-5 4)-5+6=1

ChengFeng
  • 26
  • 2
-1

You are not following the order of operations correctly. You are correct in doing the multiplication first. However, you also must always go from left to right when performing operations of the same type (addition and subtraction or multiplication and division). By using parenthesis, we can make this clearer.

3 - (1*8) + (2*3) =>  3 - 8 + 6 => -5 + 6 => 1
Tommy
  • 39,592
  • 10
  • 90
  • 121
  • 1
    So you're certain that this is off-topic? Why answer if you're voting to close? – Makoto Mar 12 '15 at 05:00
  • @Makoto - Because I had the ability to answer the question. However, this has nothing to do with programming, so it is off topic. It appears that at least 4 other people agree with that assessment. – Tommy Mar 12 '15 at 14:44
-2

Your mistake is in step 3. The - gets applied to 8 so step 3 is: -8 + 6 = -2

mxp
  • 180
  • 6
  • No, I didn't OP broke down his steps and numbered it. I was simply referring to the step where he made the mistake. – mxp Mar 12 '15 at 04:44