# 1.5: Order of Operations

The order in which we evaluate expressions can be ambiguous. If we do the addition first, then

4+3 · 2=7 · 2

= 14.

On the other hand, if we do the multiplication first, then

4+3 · 2=4+6

= 10.

So, what are we to do? Of course, grouping symbols can remove the ambiguity

Grouping Symbols

Parentheses, brackets, or curly braces can be used to group parts of an expression. Each of the following are equivalent:

(4 + 3) · 2 or [4 + 3] · 2 or {4+3} · 2

In each case, the rule is “evaluate the expression inside the grouping symbols first.” If grouping symbols are nested, evaluate the expression in the innermost pair of grouping symbols first.

Thus, for example,

(4 + 3) · 2=7 · 2

= 14.

Note how the expression contained in the parentheses was evaluated first. Another way to avoid ambiguities in evaluating expressions is to establish an order in which operations should be performed. The following guidelines should always be strictly enforced when evaluating expressions.

Rules Guiding Order of Operations

When evaluating expressions, proceed in the following order.

1. Evaluate expressions contained in grouping symbols first. If grouping symbols are nested, evaluate the expression in the innermost pair of grouping symbols first.
2. Evaluate all exponents that appear in the expression.
3. Perform all multiplications and divisions in the order that they appear in the expression, moving left to right.
4. Perform all additions and subtractions in

Example 1

Evaluate 4 + 3 · 2.

Solution

Because of the established Rules Guiding Order of Operations, this expression is no longer ambiguous. There are no grouping symbols or exponents, so we immediately go to rule three, evaluate all multiplications and divisions in the order that they appear, moving left to right. After that we invoke rule four, performing all additions and subtractions in the order that they appear, moving left to right.

[ egin{aligned} 4+3 dot 2=4+6 = 10 end{aligned} onumber ]

Thus, 4 + 3 · 2 = 10.

Exercise

Simplify: 8 + 2 · 5.

18

Example 2

Evaluate 18 − 2 + 3.

Solution

Follow the Rules Guiding Order of Operations. Addition has no precedence over subtraction, nor does subtraction have precedence over addition. We are to perform additions and subtractions as they occur, moving left to right.

[ egin{aligned} 18 − 2 + 3 = 16 + 3 & extcolor{red}{ ext{ Subtract: 18 − 2 = 16.}} = 19 & extcolor{red}{ ext{ Add: 16 + 3 = 19. }} end{aligned} onumber ]

Thus, 18 − 2 + 3 = 19.

Exercise

Simplify: 17 − 8 + 2.

11

Example 3

Evaluate 54 ÷ 9 · 2.

Solution

Follow the Rules Guiding Order of Operations. Division has no precedence over multiplication, nor does multiplication have precedence over division. We are to perform divisions and multiplications as they occur, moving left to right.

[ egin{aligned} 54 div 9 cdot 2=6 dot 2 & extcolor{red}{ ext{ Divide: 54 } div ext{ 9 = 6. }} = 12 & extcolor{red}{ ext{ Multiply: 6 } cdot ext{ 2 = 12. }} end{aligned} onumber ]

Thus, 54 ÷ 9 · 2 = 12.

Exercise

Simplify: 72 ÷ 9 · 2.

16

Example 4

Evaluate 2 · 32 − 12.

Solution

Follow the Rules Guiding Order of Operations, exponents first, then multiplication, then subtraction.

[ egin{aligned} 2 cdot 3^2 - 12 = 2 dot 9 - 12 & extcolor{red}{ ext{ Evaluate the exponent: 3^2 = 9. }} = 18 - 12 & extcolor{red}{ ext{ Perform the multiplication: } 2 cdot 9 = 18. } = 6 & extcolor{red}{ ext{ Perform the subtraction: } 18 - 12 = 6.} end{aligned} onumber ]

Thus, 2 · 32 − 12 = 6.

Exercise

Simplify: 14 + 3 · 42

62

Example 5

Evaluate 12 + 2(3 + 2 · 5)2.

Solution

Follow the Rules Guiding Order of Operations, evaluate the expression inside the parentheses first, then exponents, then multiplication, then addition.

[ egin{aligned} 12 + 2(3 + 5 cdot 5 )^2 = 12 + 2(3 + 10)^2 ~ & extcolor{red}{ ext{ Multiply inside parentheses: 2 } cdot 5 = 10.} = 12 + 2(13)^2 ~ & extcolor{red}{ ext{ Add inside parentheses: } 3 + 10 = 13.} = 12 + 2(169) ~ & extcolor{red}{ ext{ Exponents are next: } (13)^2 = 169.} = 12 + 338 ~ & extcolor{red}{ ext{ Multiplication is next: } 2(169) = 338.} = 350 ~ & extcolor{red}{ ext{ Time to add: } 12 + 338 = 350.} end{aligned} onumber ]

Thus, 12 + 2(3 + 2 · 5) 2 = 350.

Exercise

Simplify: 3(2 + 3 · 4)2 − 11.

577

Example 6

Evaluate 2{2 + 2[2 + 2]}.

Solution

When grouping symbols are nested, evaluate the expression between the pair of innermost grouping symbols first.

[ egin{aligned} 2( 2 + 2[2 + 2]) = 2(2 + 2[4]) ~ & extcolor{red}{ ext{ Innermost grouping first: } 2 + 2 = 4.} = 2(2+8) ~ & extcolor{red}{ ext{ Multiply next: } 2[4] = 8.} = 2(10) ~ & extcolor{red}{ ext{ Add inside braces: } 2 + 8 = 10.} = 20 ~ & extcolor{red}{ ext{ Multiply: } 2(10) = 20} end{aligned} onumber ]

Thus, 2(2 + 2[2 + 2]) = 20.

Exercise

Simplify: 2{3 + 2[3 + 2]}.

26

## Fraction Bars

Consider the expression

[ frac{6^{2}+8^{2}}{(2+3)^{2}} onumber ]

Because a fraction bar means division, the above expression is equivalent to

[left(6^{2}+8^{2} ight) div(2+3)^{2} onumber ]

The position of the grouping symbols signals how we should proceed. We should simplify the numerator, then the denominator, then divide.

Fractional Expressions

If a fractional expression is present, evaluate the numerator and denominator first, then divide.

Example 7

Evaluate the expression

[ frac{6^{2}+8^{2}}{(2+3)^{2}}. onumber ]

Solution

Simplify the numerator and denominator first, then divide.

[ egin{aligned} frac{6^{2}+8^{2}}{(2+3)^{2}}=frac{6^{2}+8^{2}}{(5)^{2}} ~ & extcolor{red}{ ext{ Parentheses in denominator first: } 2 + 3 = 5} = frac{36+64}{25} ~ & extcolor{red}{ ext{Exponents are next: } 6^2 = 36,~ 8^2 = 64,~ 5^2 = 25.} = frac{100}{25} ~ & extcolor{red}{ ext{ Add in numerator: } 36 + 64 = 100} = 4 ~ & extcolor{red}{ ext{ Divide: } 100 div 25 = 4.} end{aligned} onumber ]

Thus, (frac{6^{2}+8^{2}}{(2+3)^{2}}=4).

Exercise

3

## The Distributive Property

Consider the expression 2 · (3 + 4). If we follow the “Rules Guiding Order of Operations,” we would evaluate the expression inside the parentheses first. 2 · (3 + 4) = 2 · 7 Parentheses first: 3 + 4 = 7. = 14 Multiply: 2 · 7 = 14.

However, we could also choose to “distribute” the 2, first multiplying 2 times each addend in the parentheses.

[ egin{aligned} 2 cdot (3 + 4) = 2 cdot 3 + 2 cdot 4 ~ & extcolor{red}{ ext{ Multiply 2 times both 3 and 4.}} = 6 + 8 ~ & extcolor{red}{ ext{ Multiply: } 2 cdot 3 = 6 ext{ and } 2 cdot 4 = 8.} = 14 ~ & extcolor{red}{ ext{ Add: } 6 + 8 = 14.} end{aligned} onumber ]

The fact that we get the same answer in the second approach is an illustration of an important property of whole numbers.1

The Distributive Property

Let a, b, and c be any whole numbers. Then,

a · (b + c) = a · b + a · c.

We say that “multiplication is distributive with respect to addition.”

Multiplication is distributive with respect to addition. If you are not computing the product of a number and a sum of numbers, the distributive property does not apply.

If you are calculating the product of a number and the product of two numbers, the distributive property must not be used. For example, here is a common misapplication of the distributive property.

[ egin{aligned} 2 cdot (3 cdot 4) = (2 cdot 3) cdot (2 cdot 4) = 6 cdot 8 = 48 end{aligned} onumber ]

This result is quite distant from the correct answer, which is found by computing the product within the parentheses first.

[ egin{aligned} 2 cdot (3 cdot 4) = 2 cdot 12 = 24. end{aligned} onumber ]

In order to apply the distributive property, you must be multiplying times a sum.

Example 8

Use the distributive property to calculate 4 · (5 + 11).

Solution

This is the product of a number and a sum, so the distributive property may be applied.

[ egin{aligned} 4 cdot (5 + 11) = 4 cdot 5 + 4 cdot 11 ~ & extcolor{red}{ ext{ Distribute the 4 times addend in the sum.}} = 20 + 44 ~ & extcolor{red}{ ext{ Multiply: } 4 cdot 5 = 20 ext{ and } 4 cdot 11 = 44.} = 64 ~ & extcolor{red}{ ext{ Add: } 20 + 44 = 64.} end{aligned} onumber ]

Readers should check that the same answer is found by computing the sum within the parentheses first.

Exercise

Distribute: 5 · (11 + 8).

95

The distributive property is the underpinning of the multiplication algorithm learned in our childhood years.

Example 9

Multiply: 6 · 43.

Solution

We’ll express 43 as sum, then use the distributive property.

[ egin{aligned} 6 cdot 43 = 6 cdot (40 + 3) ~ & extcolor{red}{ ext{ Express 43 as a sum: } 43 = 40 + 3} = 6 cdot 40 + 6 cdot 3 ~ & extcolor{red}{ ext{ Distribute the 6.}} = 240 + 18 ~ & extcolor{red}{ ext{ Multiply: } 6 cdot 40 = 240 ext{ and } 6 cdot 3 = 18.} = 258 ~ & extcolor{red}{ ext{ Add: } 240 + 18 = 258.} end{aligned} onumber ]

Readers should be able to see this application of the distributive property in the more familiar algorithmic form:

( egin{array}{r}{43} { imes 6} hline 18 {frac{240}{258}}end{array})

Or in the even more condensed form with “carrying:”

( egin{array}{r}{^{1} 43} {frac{ imes 6}{258}}end{array})

Exercise

Use the distributive property to evaluate 8 · 92.

736

Multiplication is also distributive with respect to subtraction.

The Distributive Property (Subtraction)

Let a, b, and c be any whole numbers. Then,

a · (bc) = a · ba · c.

We say the multiplication is “distributive with respect to subtraction.”

Example 10

Use the distributive property to simplify: 3 · (12 − 8).

Solution

This is the product of a number and a difference, so the distributive property may be applied.

[ egin{aligned} 3 cdot (12 - 8) = 3 cdot 12 - 3 cdot 8 ~ & extcolor{red}{ ext{ Distribute the 3 times each term in the difference.}} = 36 - 24 ~ & extcolor{red}{ ext{Multiply: } 3 cdot 12 = 36 ext{ and } 3 cdot 8 = 24.} = 12 ~ & extcolor{red}{ ext{Subtract: } 36 - 24 = 12.} end{aligned} onumber ]

Alternate solution

Note what happens if we use the usual “order of operations” to evaluate the expression.

[ egin{aligned} 3 cdot (12 - 8) = 3 cdot 4 ~ & extcolor{red}{ ext{ Parentheses first: } 12 - 8 = 4.} = 12 ~ & extcolor{red}{ ext{ Multiply: } 3 cdot 4 = 12.} end{aligned} onumber ]

Exercise

Distribute: 8 · (9 − 2).

56

## Exercises

In Exercises 1-12, simplify the given expression.

1. 5+2 · 2

2. 5+2 · 8

3. 23 − 7 · 2

4. 37 − 3 · 7

5. 4 · 3+2 · 5

6. 2 · 5+9 · 7

7. 6 · 5+4 · 3

8. 5 · 2+9 · 8

9. 9+2 · 3

10. 3+6 · 6

11. 32 − 8 · 2

12. 24 − 2 · 5

In Exercises 13-28, simplify the given expression.

13. 45 ÷ 3 · 5

14. 20 ÷ 1 · 4

15. 2 · 9 ÷ 3 · 18

16. 19 · 20 ÷ 4 · 16

17. 30 ÷ 2 · 3

18. 27 ÷ 3 · 3

19. 8 − 6+1

20. 15 − 5 + 10

21. 14 · 16 ÷ 16 · 19

22. 20 · 17 ÷ 17 · 14

23. 15 · 17 + 10 ÷ 10 − 12 · 4

24. 14 · 18 + 9 ÷ 3 − 7 · 13

25. 22 − 10 + 7

26. 29 − 11 + 1

27. 20 · 10 + 15 ÷ 5 − 7 · 6

28. 18 · 19 + 18 ÷ 18 − 6 · 7

In Exercises 29-40, simplify the given expression.

29. 9+8 ÷ {4+4}

30. 10 + 20 ÷ {2+2}

31. 7 · [8 − 5] − 10

32. 11 · [12 − 4] − 10

33. (18 + 10) ÷ (2 + 2)

34. (14 + 7) ÷ (2 + 5)

35. 9 · (10 + 7) − 3 · (4 + 10)

36. 9 · (7 + 7) − 8 · (3 + 8)

37. 2 · {8 + 12} ÷ 4

38. 4 · {8+7} ÷ 3

39. 9+6 · (12 + 3)

40. 3+5 · (10 + 12)

In Exercises 41-56, simplify the given expression.

41. 2+9 · [7 + 3 · (9 + 5)]

42. 6+3 · [4 + 4 · (5 + 8)]

43. 7+3 · [8 + 8 · (5 + 9)]

44. 4+9 · [7 + 6 · (3 + 3)]

45. 6 − 5[11 − (2 + 8)]

46. 15 − 1[19 − (7 + 3)]

47. 11 − 1[19 − (2 + 15)]

48. 9 − 8[6 − (2 + 3)]

49. 4{7[9 + 3] − 2[3 + 2]}

50. 4{8[3 + 9] − 4[6 + 2]}

51. 9 · [3 + 4 · (5 + 2)]

52. 3 · [4 + 9 · (8 + 5)]

53. 3{8[6 + 5] − 8[7 + 3]}

54. 2{4[6 + 9] − 2[3 + 4]}

55. 3 · [2 + 4 · (9 + 6)]

56. 8 · [3 + 9 · (5 + 2)]

In Exercises 57-68, simplfiy the given expression.

57. (5 − 2)2

58. (5 − 3)4

59. (4 + 2)2

60. (3 + 5)2

61. 23 + 33

62. 54 + 24

63. 23 − 13

64. 32 − 12

65. 12 · 52 + 8 · 9+4

66. 6 · 32 + 7 · 5 + 12

67. 9 − 3 · 2 + 12 · 102

68. 11 − 2 · 3 + 12 · 42

In Exercises 69-80, simplify the given expression.

69. 42 − (13 + 2)

70. 33 − (7 + 6)

71. 33 − (7 + 12)

72. 43 − (6 + 5)

73. 19 + 3[12 − (23 + 1)]

74. 13 + 12[14 − (22 + 1)]

75. 17 + 7[13 − (22 + 6)]

76. 10 + 1[16 − (22 + 9)]

77. 43 − (12 + 1)

78. 53 − (17 + 15)

79. 5 + 7[11 − (22 + 1)]

80. 10 + 11[20 − (22 + 1)]

In Exercises 81-92, simplify the given expression.

81. ( frac{13+35}{3(4)})

82. ( frac{35+28}{7(3)})

83. ( frac{64-(8 cdot 6-3)}{4 cdot 7-9})

84. ( frac{19-(4 cdot 3-2)}{6 cdot 3-9})

85. (frac{2+13}{4-1})

86. ( frac{7+1}{8-4})

87. ( frac{17+14}{9-8})

88. ( frac{16+2}{13-11})

89. ( frac{37+27}{8(2)})

90. ( frac{16+38}{6(3)})

91. ( frac{40-(3 cdot 7-9)}{8 cdot 2-2})

92. ( frac{60-(8 cdot 6-3)}{5 cdot 4-5})

In Exercises 93-100, use the distributive property to evaluate the given expression.

93. 5 · (8 + 4)

94. 8 · (4 + 2)

95. 7 · (8 − 3)

96. 8 · (9 − 7)

97. 6 · (7 − 2)

98. 4 · (8 − 6)

99. 4 · (3 + 2)

100. 4 · (9 + 6)

In Exercises 101-104, use the distributive property to evaluate the given expression using the technique shown in Example 9.

101. 9 · 62

102. 3 · 76

103. 3 · 58

104. 7 · 57

1. 9

3. 9

5. 22

7. 42

9. 15

11. 16

13. 75

15. 108

17. 45

19. 3

21. 266

23. 208

25. 19

27. 161

29. 10

31. 11

33. 7

35. 111

37. 10

39. 99

41. 443

43. 367

45. 1

47. 9

49. 296

51. 279

53. 24

55. 186

57. 9

59. 36

61. 35

63. 7

65. 376

67. 1203

69. 1

71. 8

73. 28

75. 38

77. 51

79. 47

81. 4

83. 1

85. 5

87. 31

89. 4

91. 2

93. 60

95. 35

97. 30

99. 20

101. 558

103. 174

1Later, we’ll see that this property applies to all numbers, not just whole numbers

Learning objective:

The student will be able to apply the order of operations.

When performing multiple operations such as 32-7 imesleft(7-5 ight)^<2>+3div7 , do you subtract first or do you take care first of what is inside the parenthesis?

To help you decide, always remember the order of operations: PEMDAS. The abbreviation stands for Parenthesis, Exponents, Multiplication, Division, Addition, and Subtraction. In dealing with operations which must be done first such as 32-7 imesleft(7-5 ight)^<2>+3div7 , parentheses outrank exponents which outrank multiplication & division and addition & subtraction. In other words, you will take a look at the order of the operations according to the following:

Oftentimes, you will encounter operations with the same rank such as “Multiplication & Division” and “Addition & Subtraction“. This can be misleading because multiplication is listed before division. The same thing for addition which is listed before subtraction. This is not a correct sequence in evaluating operations since multiplication has the same priority level as division. The same is true for addition, it has the same priority level as subtraction. Hence, to operate multiplication and division or addition and subtraction, always start from left to right in evaluating operations that come first.

Below are some examples where we will use PEMDAS:

Example #1: Evaluate

(4 + 4^<2>) imes5 ÷ 4

Look at the operations inside the parenthesis. Simplify it by reapplying the correct order of operations.

Inside the parenthesis, we have 4 + 4^ <2>that has addition and exponents. Since exponents outrank addition, we will evaluate first 4^ <2>.

Thus, (4 + color <16>) imes 5 ÷ 4 .

We still have one operation inside the parenthesis which is addition. So now, we will now add 4 and 16 .

Now, we have multiplication and division left. Both have the same level of priority, so we evaluate the operations that come first from left to right. The first operation from the left is multiplication, we multiply 20 and 5 first.

We now have one operation left which is division, let’s evaluate 100 div 4 .

Thus, color is our final answer.

Example #2: Evaluate

15div5 imes7+(4^<2> imes2^<2>+8-40)

Let’s take a look first inside the parenthesis. Simplify it by reapplying the order of operations.

Inside the parenthesis, we have 4^<2> imes2^<2>+8-40 that has multiplication, addition, and subtraction as well as exponents. Since exponents outrank these operations, we will evaluate first 4^ <2>and 2^ <2>.

Since color <4^<2>> = color <16>and color <2^<2>> = color <4>, replace:

Thus, 15div5 imes7+( color <16> imes color <4>+8-40)

Back to the parenthesis, we still have multiplication, addition, and subtraction. The multiplication has the highest priority. So let’s multiply 16 and 4 first.

Thus, 15div5 imes7+( color <64>+8-40) .

In the parenthesis, we have addition and subtraction that has the same level of priority. So we evaluate from left to right. Let’s add 64 and 8 first.

Thus, 15div5 imes7+( color <72>-40) .

Only subtraction is now left in the parenthesis. Subtract 40 from 72 .

Now that the parenthesis is dealt with, we have division, multiplication, and addition left in the problem. Since division and multiplication outrank addition, we will evaluate the problem first through division and multiplication from left to right since both have the same level of priority. So we begin by dividing 15 by 5 .

This time, multiplication and addition are left. Multiply 3 and 7 .

## Year 5 - Order of Operations Worksheet (1-5)

Hello all! I'm Jinky, a primary maths teacher and Maths Academic Coordinator at Beaconhouse Yamsaard Rangsit, Thailand. One of my joy is to find time to take photos of anything I think interesting. If I am not chasing cats or taking photos, I am busy with putting pieces together and come up with colourful banners, borders for paper, numbers and alphabet. I am offering discounts for my resources from time to time. So, please check out my page. 'Thank you' for stopping by.

### Reviews

It's good to leave some feedback.

Something went wrong, please try again later.

#### Avryl

Great selection of worksheets. Thank you for providing them.

Empty reply does not make any sense for the end user

#### Starkra

Empty reply does not make any sense for the end user

#### Colettesmith

Such a great resource to assess children&#39s knowledge thank you so much for sharing

Empty reply does not make any sense for the end user

#### TES Resource Team

Thank you for sharing your resource. This resource has been recommended for teachers by the TES Resource Team.

Empty reply does not make any sense for the end user

Report this resourceto let us know if it violates our terms and conditions.
Our customer service team will review your report and will be in touch.

Hello all! I'm Jinky, a primary maths teacher and Maths Academic Coordinator at Beaconhouse Yamsaard Rangsit, Thailand. One of my joy is to find time to take photos of anything I think interesting. If I am not chasing cats or taking photos, I am busy with putting pieces together and come up with colourful banners, borders for paper, numbers and alphabet. I am offering discounts for my resources from time to time. So, please check out my page. 'Thank you' for stopping by.

## PEMDAS

The list below is from highest precedence to lowest precedence.

P #-># Parenthesis
E #-># Exponents
MD #-># Multiplication & Division from Left to Right
AS #-># Addition & Subtraction from Left to Right

Parenthesis have the high precedence and should be worked from the innermost to the outermost.

Next you would work on any expressions that are raised to a power, exponent.

Next if you have multiplication and division those should be evaluated from the leftmost moving to the right.

Lastly, if you have any addition and subtraction those should be evaluated from the leftmost moving to the right.

This is an agreed upon method resolving or evaluating expressions and equations. Without this agreement people working on mathematics would come to different conclusions based on the operations they chose to evaluate at random.

If you ever come to the point where you want some part of an expression or equation to be evaluated at a higher precedence that you just have to enclose it in parenthesis.

PEMDAS is an mnemonic device used to remind students of the order of operations in the calculation of a mathematical problem.

The initials also o along with phrase used by many students and teachers, Please Excuse My Dear Aunt Sally.

P = Parenthesis (brackets)
E = Exponents
M = Multiply
D = Divide
S = Subtraction

Solve inside Parenthesis, then do Exponents, Multiply and Divide before you Add and Subtract.

A sample problem may look like this.

Following the order of operations

Parenthesis first
#3^2(5)(4) + 8#

Multiply and Divide now
#900 + 8#

#908#

## Worksheets for the order of operations

The worksheets below are already configured for you &mdash just click on the links. They are randomly generated, so you will get a new one each time you click the links.

Math Safe
A fun logical thinking game where you need to use the four given single-digit numbers and any of the four operations to reach the target number, and then the safe opens! It practices the usage of all four operations and also the order of operations. The game suits best grades 4 and onward.

Choose Math Operation Game
Choose the mathematical operation(s) so that the number sentence is true. Practice the role of zero and one in basic operations or operations with negative numbers. Helps develop number sense and logical thinking.

Order of operations: lesson for third grade
A free lesson for grade 3 about the order of operations. For this grade level, the lesson only deals with addition, subtraction, and multiplication.

## When to use an order of operations worksheet

Try using these worksheets at the beginning of class, as an easy quiet time activity, or as part of a rotating learning station.

Worksheets are an effective way for students to practice new skills they’ve just learned, or to review skills that were taught in previous units or grades. You can also use worksheets to identify which students are struggling with particular concepts and might need extra help.

However you decide to use these order of operations worksheets, they’ll be a valuable resource for you and your students!

## C++ Operator Precedence

The following table lists the precedence and associativity of C++ operators. Operators are listed top to bottom, in descending precedence.

1. ↑ The operand of sizeof can't be a C-style type cast: the expression sizeof ( int ) * p is unambiguously interpreted as ( sizeof ( int ) ) * p , but not sizeof ( ( int ) * p ) .
2. ↑ The expression in the middle of the conditional operator (between ? and : ) is parsed as if parenthesized: its precedence relative to ?: is ignored.

When parsing an expression, an operator which is listed on some row of the table above with a precedence will be bound tighter (as if by parentheses) to its arguments than any operator that is listed on a row further below it with a lower precedence. For example, the expressions std:: cout << a & b and * p ++ are parsed as ( std:: cout << a ) & b and * ( p ++ ) , and not as std:: cout << ( a & b ) or ( * p ) ++ .

Operators that have the same precedence are bound to their arguments in the direction of their associativity. For example, the expression a = b = c is parsed as a = ( b = c ) , and not as ( a = b ) = c because of right-to-left associativity of assignment, but a + b - c is parsed ( a + b ) - c and not a + ( b - c ) because of left-to-right associativity of addition and subtraction.

Associativity specification is redundant for unary operators and is only shown for completeness: unary prefix operators always associate right-to-left ( delete ++* p is delete ( ++ ( * p ) ) ) and unary postfix operators always associate left-to-right ( a [ 1 ] [ 2 ] ++ is ( ( a [ 1 ] ) [ 2 ] ) ++ ). Note that the associativity is meaningful for member access operators, even though they are grouped with unary postfix operators: a. b ++ is parsed ( a. b ) ++ and not a. ( b ++ ) .

Operator precedence is unaffected by operator overloading. For example, std:: cout << a ? b : c parses as ( std:: cout << a ) ? b : c because the precedence of arithmetic left shift is higher than the conditional operator.

###  Notes

Precedence and associativity are compile-time concepts and are independent from order of evaluation, which is a runtime concept.

The standard itself doesn't specify precedence levels. They are derived from the grammar.

Some of the operators have alternate spellings (e.g., and for && , or for || , not for ! , etc.).

In C, the ternary conditional operator has higher precedence than assignment operators. Therefore, the expression e = a < d ? a ++ : a = d , which is parsed in C++ as e = ( ( a < d ) ? ( a ++ ) : ( a = d ) ) , will fail to compile in C due to grammatical or semantic constraints in C. See the corresponding C page for details.

a = b
a + = b
a - = b
a * = b
a / = b
a % = b
a & = b
a | = b
a ^ = b
a <<= b
a >>= b

static_cast converts one type to another related type
dynamic_cast converts within inheritance hierarchies
const_cast adds or removes cv qualifiers
reinterpret_cast converts type to unrelated type
C-style cast converts one type to another by a mix of static_cast , const_cast , and reinterpret_cast
new creates objects with dynamic storage duration
delete destructs objects previously created by the new expression and releases obtained memory area
sizeof queries the size of a type
sizeof. queries the size of a parameter pack (since C++11)
typeid queries the type information of a type
noexcept checks if an expression can throw an exception (since C++11)
alignof queries alignment requirements of a type (since C++11)

Divide and Multiply rank equally (and go left to right).

Add and Subtract rank equally (and go left to right)

After you have done "P" and "E", just go from left to right doing any "M" or "D" as you find them.

Then go from left to right doing any "A" or "S" as you find them.

 You can remember by saying "Please Excuse My Dear Aunt Sally". Or . Pudgy Elves May Demand A Snack Popcorn Every Monday Donuts Always Sunday Please Eat Mom's Delicious Apple Strudels People Everywhere Made Decisions About Sums

Note: in the UK they say BODMAS (Brackets,Orders,Divide,Multiply,Add,Subtract), and in Canada they say BEDMAS (Brackets,Exponents,Divide,Multiply,Add,Subtract). It all means the same thing! It doesn't matter how you remember it, just so long as you get it right.

## 1.5: Order of Operations

· Use the order of operations to simplify expressions.

· Simplify expressions containing absolute values.

People need a common set of rules for performing basic calculations. What does 3 + 5 • 2 equal? Is it 16 or 13? Your answer depends on how you understand the order of operations — a set of rules that tell you the order in which addition, subtraction, multiplication, and division are performed in any calculation.

Mathematicians have developed a standard order of operations that tells you which calculations to make first in an expression with more than one operation. Without a standard procedure for making calculations, two people could get two different answers to the same problem.

The Four Basic Operations

The building blocks of the order of operations are the arithmetic operations: addition, subtraction, multiplication, and division. The order of operations states:

• multiply or divide first, going from left to right
• then add or subtract in order from left to right

What is the correct answer for the expression 3 + 5 • 2? Use the order of operations listed above.

Multiply first. 3 + 5 • 2 = 3 + 10

This order of operations is true for all real numbers.

Simplify 7 – 5 + 3 · 8.

According to the order of operations, multiplication comes before addition and subtraction. Multiply 3 · 8.

Now, add and subtract from left to right. 7 – 5 comes first.

When you are applying the order of operations to expressions that contain fractions, decimals, and negative numbers, you will need to recall how to do these computations as well.

According to the order of operations, multiplication comes before addition and subtraction. Multiply first.

When you are evaluating expressions, you will sometimes see exponents used to represent repeated multiplication. Recall that an expression such as is exponential notation for 7 • 7. (Exponential notation has two parts: the base and the exponent or the power. In , 7 is the base and 2 is the exponent the exponent determines how many times the base is multiplied by itself.)

Exponents are a way to represent repeated multiplication the order of operations places it before any other multiplication, division, subtraction, and addition is performed.

This problem has exponents and multiplication in it. According to the order of operations, simplifying 3 2 and 2 3 comes before multiplication.

is 2 · 2 · 2, which equals 8.

This problem has exponents, multiplication, and addition in it. According to the order of operations, simplify the terms with the exponents first, then multiply, then add.

Incorrect. You may have found 4 · 5 = 20, squared 20, and then subtracted 400 from 100. The order of operations states that you should simplify the term with the exponent first, then multiply, then subtract. = 25, and 25 · 4 = 100, and 100 – 100 = 0. The correct answer is 0.

Correct. To simplify this expression, simplify the term with the exponent first, then multiply, then subtract. = 25, and 25 · 4 = 100, and 100 – 100 = 0.

Incorrect. The order of operations states that you should simplify the term with the exponent first, then multiply, then subtract. = 25, and 25 · 4 = 100, and 100 – 100 = 0. The correct answer is 0.

Incorrect. You may have found that = 25, subtracted that from 100, and multiplied by 4. The order of operations states that you should simplify the term with the exponent first, then multiply, then subtract. = 25, and 25 · 4 = 100, and 100 – 100 = 0. The correct answer is 0.

The final piece that you need to consider in the order of operations is grouping symbols. These include parentheses ( ), brackets [ ], braces < >, and even fraction bars. These symbols are often used to help organize mathematical expressions (you will see them a lot in algebra).

Grouping symbols are used to clarify which operations to do first, especially if a specific order is desired. If there is an expression to be simplified within the grouping symbols, follow the order of operations.

The Order of Operations

· Perform all operations within grouping symbols first. Grouping symbols include parentheses ( ), brackets [ ], braces < >, and fraction bars.

· Evaluate exponents or square roots.

· Multiply or divide, from left to right.

· Add or subtract, from left to right.

When there are grouping symbols within grouping symbols, calculate from the inside to the outside. That is, begin simplifying within the innermost grouping symbols first.

Remember that parentheses can also be used to show multiplication. In the example that follows, both uses of parentheses—as a way to represent a group, as well as a way to express multiplication—are shown.

## 1.8 Order of Operation

Some math problems are a mixture of addition, subtraction, division, and multiplication. An operation to be performed might be true for one item but not another, so parentheses are used () for clarification.

There is a specific order to follow when making calculations.

The order in which operations are performed is:

1. Parentheses: ( )
2. Exponents: 2 3
3. Multiplication and division
5. Left to right

Note: It is always useful to add parentheses to clarify the order.

Example 1 - Solve 10 + 10 ÷ 10

Step 1. Division is performed before addition.
10 ÷ 10 = 1

The same example can be rewritten:
10 + 10 ÷ 10
10 + (10 ÷ 10). Using the parentheses helps clarify the order of operation.

Example 2 - Solve 6 3 ÷ (10 - 8) 2 ÷ 2 + 2

Step 1. Parentheses.
6 3 ÷ (10 - 8) 2 ÷ 2 + 2 = 6 3 ÷ 2 2 ÷ 2 + 2

Step 2. Exponents.
216 ÷ 4 ÷ 2 + 2

Step 3. Division in order from left to right.
216 ÷ 4 = 54
54 ÷ 2 = 27