Order of operations

The or­der of op­er­a­tions is a no­ta­tional con­ven­tion em­ployed in ar­ith­meti­cal ex­pres­sions to dis­am­biguate the or­der in which op­er­a­tions should be performed.

It is also referred to PEMDAS, BEDMAS, BODMAS, or other such acronyms de­pend­ing on where you live. The acronym is always 6 let­ters, and refers to the fol­low­ing things in or­der:

  1. paren­the­ses (or Brack­ets), in or­der of in­side-most paren­the­ses first

  2. Ex­po­nents (or Orders or Indices), in or­der of in­side-most (or right­most) ex­po­nents first

  3. mul­ti­pli­ca­tion and di­vi­sion, in or­der from left to right

  4. ad­di­tion and sub­trac­tion, in or­der from left to right

Motivation

The in­fix no­ta­tion we use to write ex­pres­sions of math­e­mat­i­cal op­er­a­tors is in­her­ently am­bigu­ous. Only in some very spe­cial ex­am­ples where the ex­pres­sion con­sists of only a sin­gle as­so­ci­a­tive op­er­a­tion do all pos­si­ble or­ders of eval­u­a­tion eval­u­ate to the same thing. When con­sid­er­ing the ex­pres­sion \(2 - 4 + 3\), do we do the \(2 - 4\) first or the \(4 + 3\) first? The re­sult is ei­ther \(1\) or \(-5\) de­pend­ing on which you choose. When con­sid­er­ing the ex­pres­sion \(7 + 8 \times 9 - 6\), which op­er­a­tion do we do first? The re­sult could be any­where from \(31\) to \(129\) de­pend­ing on the or­der you do them in.

There­fore, to re­lieve math­e­mat­i­ci­ans of plac­ing brack­ets around ev­ery ex­pres­sion, there are some stan­dard, in­tu­itive con­ven­tions put in place.

Ex­am­ple expressions

Con­sider the ex­pres­sion \(3 + 7 \times 2^{(6 + 8)}\). We do paren­the­ses first:

$$3 + 7 \times 2^{14}$$
Then ex­po­nents:
$$3 + 7 \times 16384$$
Then mul­ti­pli­ca­tion and di­vi­sion:
$$3 + 114688$$
And fi­nally ad­di­tion and sub­trac­tion:
$$114691$$

Notable am­bigu­ous cases

The ex­pres­sion \(48 \div 2 (9 + 3)\) is a con­tro­ver­sial am­bi­guity in the or­der of op­er­a­tions that re­sults from an am­bi­guity in mul­ti­pli­ca­tion by jux­ta­po­si­tion — which is, the con­ven­tion that num­bers next to each other in brack­ets should be mul­ti­plied to­gether. For ex­am­ple, \(2(3+5)\) is equal to \(2 \times (3 + 5)\) or \(16\).

If mul­ti­pli­ca­tion by jux­ta­po­si­tion is taken as a par­en­thet­i­cal op­er­a­tion due to the paren­the­ses in the operands, then the re­sult is 2:

$$\begin{align*} 48 \div 2 (9 + 3) &= 48 \div 2 (12) \\ &= 48 \div 24 \\ &= 2 \end{align*}$$

How­ever, if mul­ti­pli­ca­tion by jux­ta­po­si­tion is taken as sim­ply a reg­u­lar mul­ti­pli­ca­tion op­er­a­tion, the re­sult is 288:

$$\begin{align*} 48 \div 2 (9 + 3) &= 48 \div 2 \times 12 \\ &= 24 \times 12 \\ &= 288 \end{align*}$$

The sec­ond step is differ­ent be­cause the 48 and 2 are op­er­ated on first, as the left most di­vi­sion or mul­ti­pli­ca­tion op­er­a­tion in the ex­pres­sion.

Children:

  • Order of rational operations (Math 0)

    Our short­hand for all the op­er­a­tions on ra­tio­nals is very use­ful, but full of brack­ets; this is how to get rid of some of the brack­ets.

Parents:

  • Mathematics

    Math­e­mat­ics is the study of num­bers and other ideal ob­jects that can be de­scribed by ax­ioms.