FACTOID # 85: American planes take-off a staggering 8.5 million times per year - almost half the number of take-offs worldwide.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

Encyclopedia > Order of operations

In arithmetic and algebra, when a number or expression is both preceded and followed by a binary operation, a rule is required for which operation should be applied first. From the earliest use of mathematical notation, multiplication took precedence over addition, whichever side of a number it appeared on. Thus 3 + 4 • 5 = 5 • 4 + 3 = 23. When exponents were first introduced, in the 16th and 17th centuries, exponents took precedence over both addition and multiplication, and could be placed only as a superscript to the right of their base. Thus 3 + 5 2 = 28 and 3 • 5 2 = 75. To change the order of operations, a vinculum (an overline or underline) was originally used. Today we use parentheses. Thus, if we want to force addition to precede multiplication, we write (3 + 4) • 5 = 35. Arithmetic tables for children, Lausanne, 1835 Arithmetic or arithmetics (from the Greek word αριθμός = number) is the oldest and most elementary branch of mathematics, used by almost everyone, for tasks ranging from simple daily counting to advanced science and business calculations. ... Algebra is a branch of mathematics concerning the study of structure, relation and quantity. ... An expression is a combination of numbers, operators, grouping symbols (such as brackets and parentheses) and/or free variables and bound variables arranged in a meaningful way which can be evaluated. ... In mathematics, a binary operation is a calculation involving two input quantities, in other words, an operation whose arity is two. ... A vinculum is a horizontal line placed over a mathematical expression, used to indicate that it is to be considered a group. ...

Contents

The standard order of operations

The order of operations is expressed in the following chart.

exponents and roots
multiplication and division
addition and subtraction

In the absence of parentheses, do all exponents and roots first. Stacked exponents must be done from the top down. Root symbols have a bar (called vinculum) over the radicand which acts as a symbol of grouping. After taking all exponents and roots, then do all multiplication and division. Finally, do all addition and subtraction. A vinculum is a horizontal line placed over a mathematical expression, used to indicate that it is to be considered a group. ... A radicand is a mathematical expression whose root is being considered in a radical. ...


It is helpful to treat division as multiplication by the reciprocal and subtraction as addition of the opposite. thus 3/4 = 3 ÷ 4 = 3 • ¼ and -4 + 3 is the sum of negative four and positive three.


If an expression involves parentheses, then do the arithmetic inside the innermost pair of parentheses first and work outward, or use the distributive law to remove parentheses. In mathematics, and in particular in abstract algebra, distributivity is a property of binary operations that generalises the distributive law from elementary algebra. ...


Acting contrary to the standard order of operations, some programs, notably Microsoft Office Excel and the programming language bc, give unary operators a higher priority than binary operators, e.g. the unary minus (negation) has higher precedence than exponentiation. [3]. Microsoft Excel (full name Microsoft Office Excel) is a spreadsheet application written and distributed by Microsoft for Microsoft Windows and Mac OS. It features calculation and graphing tools which, along with aggressive marketing, have made Excel one of the most popular microcomputer applications to date. ... bc is an arbitrary precision calculator language with syntax similar to the C programming language. ...


Examples from arithmetic

1. Evaluate subexpressions contained within parentheses, starting with the innermost expressions. (Brackets [ ] are used here to indicate what is evaluated next.)
(4+10/2)/9=(4+[10/2])/9=[4+5]/9=1 ,
2. Evaluate exponential powers; for iterated powers, start from the right:
2^{3^2}=2^{[3^2]}=[2^9]=512 ,
3. Evaluate multiplications and divisions, starting from the left:
8/2times3=[8/2]times3=[4times3]=12 ,
4. Evaluate additions and subtractions, starting from the left:
7-2-4+1=[7-2]-4+1=[5-4]+1=[1+1]=2 ,
5. Evaluate negation on the same level as subtraction, starting from the left:[1]
-3^2=-[3^2]=-9 ,

B=Brackets E=Exponents D=Division M=Multiplication A=Addition S=Subtraction


Acronyms

In the United States, the acronym PEMDAS (for Parentheses, Exponentiation, Multiplication/Division, Addition/Subtraction) is used instead, sometimes expressed as the mnemonic "Please Excuse My Dear Aunt Sally", "Please Execute My Dumb Assassin Sam", "Panda Express Makes Delicious Avocado Soup, or "Please Excuse My Deadly Angry Samurai." It has been suggested that this article or section be merged with Backronym and Apronym (Discuss) Acronyms and initialisms are abbreviations, such as NATO, laser, and ABC, written as the initial letter or letters of words, and pronounced on the basis of this abbreviated written form. ...


In Canada, an acronym BEDMAS is often used as a mnemonic for Brackets, Exponents, Division, Multiplication, Addition, and Subtraction. Not to be confused with pneumonic. ...


In the UK, Australia and New Zealand, the acronym BODMAS is commonly used for Brackets, Orders, Division, Multiplication, Addition, Subtraction. Since multiplication and division are of the same rank, this is sometimes written as BOMDAS, BIDMAS or BIMDAS where I stands for Indices.


Warning: Multiplication and division are of equal precedence, and addition and subtraction are of equal precedence. Using any of the above rules in the order addition first, subtraction afterward would give the wrong answer to

10 - 3 + 2 ,

The correct answer is 9, which is best understood by thinking of the problem as the sum of positive ten, negative three, and positive two.


It is usual, wherever you need to calculate operations of equal precedence to work from left to right. The following rules of thumb are useful:


First: perform any calculations inside parentheses (brackets)


Second: Next perform all multiplication and division, working from left to right


Third: Lastly perform all addition and subtraction, working from left to right


However, with experience, the commutative law, associative law, and distributive law allow shortcuts. For example, In mathematics, especially abstract algebra, a binary operation * on a set S is commutative if x * y = y * x for all x and y in S. Otherwise * is noncommutative. ... In mathematics, associativity is a property that a binary operation can have. ... In mathematics, and in particular in abstract algebra, distributivity is a property of binary operations that generalises the distributive law from elementary algebra. ...

 17 times 24 / 12 ,

is much easier when worked from right to left, where here the answer is 34.


More examples

  • Given:
3-(5-(7+1))^2times(-5)+3 ,
  • Evaluate the innermost subexpression (7 + 1):
3-(5-8)^2times(-5)+3 ,
  • Evaluate the subexpression within the remaining parentheses (5 − 8):
3-(-3)^2times(-5)+3 ,
  • Evaluate the power of (−3)2:
3-9times(-5)+3 ,
  • Evaluate the multiplication 9 × (−5):
3-(-45)+3 ,
  • Evaluate the subtraction 3 − (−45):
48 + 3 ,
  • Evaluate the addition 48 + 3:
48 + 3 = 51 ,

Proper use of parentheses and other grouping symbols

When restricted to using a straight text editor, parentheses (or more generally "grouping symbols") must be used generously to make up for the lack of graphics, like square root symbols. Here are some rules for doing so:


1) Whenever there is a fraction formed with a slash, put the numerator (the number on top of the fraction) in one set of parentheses, and the denominator (the number on the bottom of the fraction) in another set of parentheses. This is not required for fractions formed with underlines:

y = (x+1)/(x+2)

2) Whenever there is an exponent using the caret (^) symbol, put the base in one set of parentheses, and the exponent in another set of parentheses:

y = (x+1)^(x+2)

3) Whenever there is a trig function, put the argument of the function, typically shown in bold and/or italics, in parentheses:

y = sin(x+1)

4) The rule for trig functions also applies to any other function, such as square root. That is, the argument of the function should be contained in parentheses:

y = sqrt(x+1)

5) An exception to the rules requiring parentheses applies when only one character is present. While correct either way, it is more readable if parentheses around a single character are omitted:

y = (3)/(x) or y = 3/x
y = (3)/(2x) or y = 3/(2x)
y = (x)^(5) or y = x^5
y = (2x)^(5) or y = (2x)^5
y = (x)^(5z) or y = x^(5z)

Calculators generally require parentheses around the argument of any function. Printed or handwritten expressions sometimes omit the parentheses, provided the argument is a single character. Thus, a calculator or computer program requires:

y = sqrt(2)
y = tan(x)

while a printed text may have:

y = sqrt 2
y = tan x.

6) Whenever anything can be interpreted multiple ways, put the part to be done first in parentheses, to make it clear.


7) You may alternate use of the different grouping symbols (parentheses, brackets, and braces) to make expressions more readable. For example:

y = { 2 / [ 3 / ( 4 / 5 ) ] }

is more readable than:

y = ( 2 / ( 3 / ( 4 / 5 ) ) )

Note that certain applications, like computer programming, will restrict you to certain grouping symbols.


Special cases

In the case of a factorial in an expression, it is evaluated before exponents and roots, unless grouping symbols dictate otherwise. When new operations are defined, they are generally presumed to take precedence over other operations, unless overridden by grouping symbols. For factorial rings in mathematics, see unique factorisation domain. ...


In the case where repeated operators of the same type are used, such as in

a / b / c

the expression is evaluated from left to right and is said to associate to the left. It is therefore equal to

(a / b) / c.

With index notation for exponentiation, however, exponents are evaluated from right to left.


Calculators

Different calculators follow different orders of operations. Cheaper calculators without a stack work left to right without any priority given to different operators, for example giving

1 + 2 times 3 = 9, ;

while more sophisticated calculators will use a more standard priority, for example giving

1 + 2 times 3 = 7. ;

The Microsoft Calculator program uses the former in its standard view and the latter in its scientific view. Microsoft Calculator is a calculation application for Microsoft Windows. ...


Calculators may associate exponents to the left or to the right depending on the model. For example, the expression a wedge b wedge c on the TI-92 and TI-30XII (both Texas Instruments calculators) associates two different ways:


The TI-92 associates to the right, that is

a wedge b wedge c=a wedge (b wedge c) = a^{(b wedge c)} = a^{(b^{c})} = a^{b^{c}}

whereas, the TI-30XII associates to the left, that is

a wedge b wedge c=(a wedge b) wedge c=(a^{b})^{c}.

Mathematical precedence

Many programming languages conform to mathematical order of operations, however some, such as APL use different operator precedence rules. APL (for A Programming Language) is an array programming language based on a notation invented in 1957 by Kenneth E. Iverson while at Harvard University. ...


The logical bitwise operators in C (and all programming languages that borrowed precedence rules from C) are known to have incorrect precedence (i.e. they should be placed above the comparison operators) due to a historical quirk and backwards compatibility with that quirk.[2] The order in C-style languages is as follows: C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ...

1 ()   []   ->   .   :: Grouping, scope, array/member access
2  !   ~   ++   --   -   +   *   &   sizeof   type cast (most) unary operations, sizeof and type casts
3 *   /   % Multiplication, division, modulus
4 +   - Addition and subtraction
5 <<   >> Bitwise shift left and right
6 <   <=   >   >= Comparisons: less-than, ...
7 ==   != Comparisons: equal and not equal
8 & Bitwise AND
9 ^ Bitwise exclusive OR
10 | Bitwise inclusive (normal) OR
11 && Logical AND
12 || Logical OR
13  ?: Ternary operator
14 =   +=   -=   *=   /=   %=   &=   |=   ^=   <<=   >>= Assignment operators

Examples: Modular arithmetic (sometimes called modulo arithmetic, or clock arithmetic because of its use in the 24-hour clock system) is a system of arithmetic for integers, where numbers wrap around after they reach a certain value — the modulus. ...

  •  !A + !B ========> (!A) + (!B)
  • ++A + !B ========> (++A) + (!B)
  • A * B + C =======> (A * B) + C
  • A AND B OR C ====> (A AND B) OR C

References and notes

  1. ^ Some programs, notably Microsoft Excel and Unix bc, give a higher priority to negation than to exponentiation, which results in -3^2 = (-3)^2 = 9. [1]
  2. ^ [2]

This article or section does not adequately cite its references or sources. ... bc is an arbitrary precision calculator language with syntax similar to the C programming language. ...

See also

This article is about the concept of operator precedence. ... In mathematics, associativity is a property that a binary operation can have. ... A map or binary operation from a set to a set is said to be commutative if, (A common example in school-math is the + function: , thus the + function is commutative) Otherwise, the operation is noncommutative. ... In mathematics, and in particular in abstract algebra, distributivity is a property of binary operations that generalises the distributive law from elementary algebra. ... In computer programming, operator overloading (less commonly known as operator ad-hoc polymorphism) is a specific case of polymorphism in which some or all of operators like +, = or == have different implementations depending on the types of their arguments. ...

External links


  Results from FactBites:
 
Order of operations - Wikipedia, the free encyclopedia (1015 words)
In arithmetic and algebra, certain rules are used for the order in which the operations in expressions are to be evaluated.
The chart which gives the order of operations can help in remembering that roots and exponents distribute over multiplication and division, while multiplication and division distribute over addition and subtraction.
For a rationale behind the use of the order of operations, see Math and Text.
  More results at FactBites »

 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your location
Your comments
Please enter the 5-letter protection code


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.