Difference between revisions of "Order of Operations"

From Department of Mathematics at UTSA
Jump to navigation Jump to search
(Updated from wikibooks)
Line 1: Line 1:
In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression.
+
The '''''Order of Operations''''' is used when doing expressions with more than one operation (e.g., ×, +, -). These are rules so you only get one answer all the time.
  
For example, in mathematics and most computer languages, multiplication is granted a higher precedence than addition, and it has been this way since the introduction of modern algebraic notation. Thus, the expression 1 + 2 × 3 is interpreted to have the value 1 + (2 × 3) = 7, and not (1 + 2) × 3 = 9. When exponents were introduced in the 16th and 17th centuries, they were given precedence over both addition and multiplication, and could be placed only as a superscript to the right of their base.[1] Thus 3 + 52 = 28 and 3 × 52 = 75.
+
Example: When faced with <math>4+2 \times 3</math>, how do you proceed? 
  
These conventions exist to eliminate notational ambiguity, while allowing notation to be as brief as possible. Where it is desired to override the precedence conventions, or even simply to emphasize them, parentheses ( ) can be used to indicate an alternative order of operations (or to simply reinforce the default order of operations). For example, (2 + 3) × 4 = 20 forces addition to precede multiplication, while (3 + 5)2 = 64 forces addition to precede exponentiation. If multiple pairs of parentheses are required in a mathematical expression (such as in the case of nested parentheses), the parentheses may be replaced by brackets or braces to avoid confusion, as in [2 × (3 + 4)] − 5 = 9.
+
There are two ways:
  
==Definition==
+
<math>4 + 2 \times 3 = (4 + 2) \times 3</math>
The order of operations, which is used throughout mathematics, science, technology and many computer programming languages, is expressed here:
 
# parentheses
 
# exponentiation and root extraction
 
# multiplication and division
 
# addition and subtraction
 
  
This means that if, in a mathematical expression, a subexpression appears between two operators, the operator that is higher in the above list should be applied first. Expressions in parentheses take precedence over expressions outside of them (for example, (3 + 4) × 7 = 7 × 7 = 49, and not 3 + 4 × 7 = 3 + 28 = 31, despite the fact that multiplication takes precedence over addition). Within a single set of parentheses, the normal order of operations applies.
+
<math>4 + 2 \times 3 = 6 \times 3</math>
  
The commutative property and associative property laws of addition and multiplication allow adding terms in any order, and multiplying factors in any order—but mixed operations must obey the standard order of operations.
+
<math>4 + 2 \times 3= 18</math>
 +
 +
'''or'''
  
In some contexts, it is helpful to replace a division by multiplication by the reciprocal (multiplicative inverse) and a subtraction by addition of the opposite (additive inverse). For example, in computer algebra, this allows one to handle fewer binary operations, and makes it easier to use commutativity and associativity when simplifying large expressions. Thus 3 ÷ 4 = 3 × (1/4); in other words, the quotient of 3 and 4 equals the product of 3 and 1/4. Also 3 − 4 = 3 + (−4); in other words the difference of 3 and 4 equals the sum of 3 and −4. Thus, 1 − 3 + 7 can be thought of as the sum of 1 + (−3) + 7, and the three summands may be added in any order, in all cases giving 5 as the result.
+
<math>4 + 2 \times 3 = 4 + (2 \times 3)</math>
  
A common acronym used to memorize the order of operations is "PEMDAS": parentheses, exponents (which includes calculating roots), multiplication and division, and addition and subtraction.
+
<math>4 + 2 \times 3 = 4 + 6</math>
  
==Resources==
+
<math>4 + 2 \times 3 = 10</math>
* [https://en.wikipedia.org/wiki/Order_of_operations Order of Operations], Wikipedia
+
 
* [https://www.khanacademy.org/math/cc-sixth-grade-math/cc-6th-arithmetic-operations/cc-6th-order-of-operations/v/introduction-to-order-of-operations Introduction to Order of Operations], Khan Academy
+
This is confusing, so which is correct? (Parentheses, "(" and ")" are used to show what to do first)
* [https://www.khanacademy.org/math/cc-sixth-grade-math/cc-6th-arithmetic-operations/cc-6th-order-of-operations/e/evaluating-numerical-expressions-with-exponents Order of Operations Practice Problems], Khan Academy
+
 
* [https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Support_Course_for_Elementary_Statistics/Operations_on_Numbers/Order_of_Operations Order of Operations], LibreTexts
+
In order to communicate using mathematical expressions we must agree on an ''order of operations'' so that each expression has only one value.
 +
 
 +
For the above example all mathematicians agree the correct answer is 10.
 +
 
 +
You're probably wondering what this order is.
 +
 
 +
==The Standard Order of Operations==
 +
 
 +
Evaluate expressions in this order.
 +
 
 +
*Parentheses or Brackets (evaluate what's inside them)
 +
*Exponents
 +
*Multiplication and/or division from left to right
 +
*Addition and/or subtraction from left to right
 +
 
 +
===An Easy Way of Remembering===
 +
Use this memory tool to help remember the order!
 +
'''P'''lease '''E'''xcuse '''M'''y '''D'''ear '''A'''nnoying '''S'''ister
 +
It is also commonly called by its acronym, PEMDAS.
 +
 
 +
An alternative form of this is;
 +
'''B'''rackets
 +
'''I'''ndices
 +
'''D'''ivision or '''M'''ultiplication
 +
'''A'''ddition or '''S'''ubtraction
 +
(BIDMAS).
 +
 
 +
Yet another way of remembering this is
 +
'''B'''rackets
 +
'''O'''rders
 +
'''D'''ivision
 +
'''M'''ultiplication
 +
'''A'''ddition
 +
'''S'''ubtraction (BODMAS)<br />
 +
 
 +
or '''B'''ring '''O'''ur '''D'''ear '''M'''other '''A'''long '''S'''aturday
 +
 
 +
==Examples==
 +
{| border="1" cellpadding="5" cellspacing="0"
 +
|+ style="background-color:#cedff2;border:1px solid black;" | '''Order of Operations - Examples'''
 +
|- style="background:#ffdead;"
 +
! Expression
 +
! Evaluation
 +
! Operation
 +
|-
 +
| rowspan="3" | 4 &times; 2 + 1
 +
| = '''4 &times; 2''' + 1
 +
| Multiplication
 +
|-
 +
| = '''8 + 1'''
 +
| Addition
 +
|-
 +
| = '''9'''
 +
|
 +
|-
 +
| rowspan="3" | 12 - 9 &divide; 3
 +
| = 12 - '''9 &divide; 3'''
 +
| Division
 +
|-
 +
| = '''12 - 3'''
 +
| Subtraction
 +
|-
 +
| = '''9'''
 +
|
 +
|-
 +
| rowspan="3" | 2 &times; 9 &divide; 3
 +
| = '''2 &times; 9''' &divide; 3
 +
| Left to Right
 +
|-
 +
| = '''18 &divide; 3'''
 +
| division
 +
|-
 +
| = '''6'''
 +
|
 +
|-
 +
| rowspan="3" | 9 &divide; 3 &times; 3
 +
| = ''' 9 &divide; 3''' &times; 3
 +
| Left to Right
 +
|-
 +
| = '''3 &times;3'''
 +
| multiplication
 +
|-
 +
| = '''9'''
 +
|
 +
|-
 +
| rowspan="4" | 3 + 12 &divide; (5 - 2)
 +
| = 3 + 12 &divide; '''(5 - 2)'''
 +
| Parentheses
 +
|-
 +
| = 3 + '''12 &divide; 3'''
 +
| Division
 +
|-
 +
| = '''3 + 4'''
 +
| Addition
 +
|-
 +
| = '''7'''
 +
|
 +
|-
 +
| rowspan="5" | 7 &times; 10 - (2 &times; 4)<sup>2</sup>
 +
| = 7 &times; 10 - '''(2 &times; 4)'''<sup>2</sup>
 +
| Parentheses
 +
|-
 +
| = 7 &times; 10 - '''8<sup>2</sup>'''
 +
| Exponents
 +
|-
 +
| = '''7 &times; 10''' - 64
 +
| Multiplication
 +
|-
 +
| = '''70 - 64'''
 +
| Subtraction
 +
|-
 +
| = '''6'''
 +
|
 +
|}
 +
 
 +
----
 +
 
 +
== Practice Problems ==
 +
'''Note:''' the expressions in the following quiz, use an asterisk (*) to indicate multiplication (<math>\times</math>) between adjacent factors. This use of the asterisk is nearly ubiquitous with the various computer languages, as the ''times'' symbol is not an historically available keyboard character. Hand written expressions commonly use a small vertically centered dot (·) to indicate multiplication. Where unambiguous, multiplication is ''implied'' between factors and a symbol is extraneous.
 +
<quiz display=simple points="1/1">
 +
 
 +
{Evaluate the numerical expression
 +
|type="{}"}
 +
<math>2+4*3=</math>{ 14_2 }
 +
 
 +
{Evaluate the numerical expression
 +
|type="{}"}
 +
<math>2*4+3=</math>{ 11_2 }
 +
 
 +
{Evaluate the numerical expression
 +
|type="{}"}
 +
<math>(2+4)*3=</math>{ 18_2 }
 +
 
 +
{Evaluate the numerical expression
 +
|type="{}"}
 +
<math>9^2 + 1 -7*(8+4)/2=</math>{ 40_2 }
 +
</quiz>
 +
 
 +
== Playing with Mathematics ==
 +
 
 +
To get yourself thinking about this, try this simple mathematical game:
 +
 
 +
Take the numbers 1 through 10 on the left side of an equation, and pick a number for the right side.
 +
 
 +
Example:
 +
1 2 3 4 5 6 7 8 9 10 = 1
 +
 
 +
Now put operators between those numbers.  Only use parentheses when necessary.
 +
 
 +
Example:
 +
1 + 2 - 3 + 4 - 5 + 6 + 7 + 8 - 9 - 10 = 1
 +
 
 +
Change the number on the right-hand side. Can you generate an expression for this number?  If not, can you prove why not?
 +
 
 +
Does this change if you change the order of the numbers?

Revision as of 08:24, 30 September 2021

The Order of Operations is used when doing expressions with more than one operation (e.g., ×, +, -). These are rules so you only get one answer all the time.

Example: When faced with , how do you proceed?

There are two ways:

or

This is confusing, so which is correct? (Parentheses, "(" and ")" are used to show what to do first)

In order to communicate using mathematical expressions we must agree on an order of operations so that each expression has only one value.

For the above example all mathematicians agree the correct answer is 10.

You're probably wondering what this order is.

The Standard Order of Operations

Evaluate expressions in this order.

  • Parentheses or Brackets (evaluate what's inside them)
  • Exponents
  • Multiplication and/or division from left to right
  • Addition and/or subtraction from left to right

An Easy Way of Remembering

Use this memory tool to help remember the order! Please Excuse My Dear Annoying Sister It is also commonly called by its acronym, PEMDAS.

An alternative form of this is; Brackets Indices Division or Multiplication Addition or Subtraction (BIDMAS).

Yet another way of remembering this is Brackets Orders Division Multiplication Addition Subtraction (BODMAS)

or Bring Our Dear Mother Along Saturday

Examples

Order of Operations - Examples
Expression Evaluation Operation
4 × 2 + 1 = 4 × 2 + 1 Multiplication
= 8 + 1 Addition
= 9
12 - 9 ÷ 3 = 12 - 9 ÷ 3 Division
= 12 - 3 Subtraction
= 9
2 × 9 ÷ 3 = 2 × 9 ÷ 3 Left to Right
= 18 ÷ 3 division
= 6
9 ÷ 3 × 3 = 9 ÷ 3 × 3 Left to Right
= 3 ×3 multiplication
= 9
3 + 12 ÷ (5 - 2) = 3 + 12 ÷ (5 - 2) Parentheses
= 3 + 12 ÷ 3 Division
= 3 + 4 Addition
= 7
7 × 10 - (2 × 4)2 = 7 × 10 - (2 × 4)2 Parentheses
= 7 × 10 - 82 Exponents
= 7 × 10 - 64 Multiplication
= 70 - 64 Subtraction
= 6

Practice Problems

Note: the expressions in the following quiz, use an asterisk (*) to indicate multiplication () between adjacent factors. This use of the asterisk is nearly ubiquitous with the various computer languages, as the times symbol is not an historically available keyboard character. Hand written expressions commonly use a small vertically centered dot (·) to indicate multiplication. Where unambiguous, multiplication is implied between factors and a symbol is extraneous.

1

Evaluate the numerical expression

2

Evaluate the numerical expression

3

Evaluate the numerical expression

4

Evaluate the numerical expression


Playing with Mathematics

To get yourself thinking about this, try this simple mathematical game:

Take the numbers 1 through 10 on the left side of an equation, and pick a number for the right side.

Example: 1 2 3 4 5 6 7 8 9 10 = 1

Now put operators between those numbers. Only use parentheses when necessary.

Example: 1 + 2 - 3 + 4 - 5 + 6 + 7 + 8 - 9 - 10 = 1

Change the number on the right-hand side. Can you generate an expression for this number? If not, can you prove why not?

Does this change if you change the order of the numbers?