PEMDAS Rules

What is PEMDAS? PEMDAS stands for Parenthesis, Exponents, Multiply, Divide, Add, and Subtract. This represents the order in which the CPU (ALU) does mathematical calculations. If you can't remember PEMDAS, think of it this way: "Please Excuse My Dear Aunt Sally." Silly but it works. The order of mathematical operations is particularly important if you are writing a computer program involving calculations or if you are writing a formula for software such as Excel or Access.

In the computer world some of the symbols used to designate operations are different from what we are used to. For example an exponent (a number multiplied by itself) is written 2^2=4 instead of 22 (2 times 2) or 2^4=16 instead of 24 (2 times 2 times 2 times 2). For purposes of calculation the computer does not recognize superscripts (2).

We are used to seeing multiplication written with the proverbial x, such as 2x2=4. The computer uses an asterisk to designate multiplication 2*2=4. And to divide the computer uses a forward slash /. For example 4/2=2. Now that's a FORWARD slash (found on your keyboard below the question mark (?); not to be confused with the backward slash found just above the enter key (/ forward and \ backward).

We solve our math problems from left to right; no surprise, that's the same way we read. But there's a catch or two. Eyeball the whole expression you are trying to solve, for example 2*8/10*5 or 2*8/(10*5) or 2+8^2/10*5. Think PEMDAS. In the first expression 2*8/10*5 you simply move from left to right (since there is only multiplication and division in the expression) and you get 2*8=16/10=1.6*5=8. In the second expression the numbers are the same, however there is a parenthesis around the (10*5) and that makes a big difference in this case. Think  PEMDAS. You must take care of the parenthesis first (and if there were more than one the inner parenthesis is done first). You must multiply 10*5 first and then move back to the left and go through the expression. So, you get 10*5=50 and then 2*8=16/50=0.32, a very different answer that we got with the first expression even though the numbers were identical. In the third case you must do the exponent first, then the division and multiplication and finally the addition. So . . . 8^2=64 and then 64/10=6.4 and then 6.4*5=32 and finally 32+2=34.

OPERATION

OPERATOR

EXAMPLE

Parenthesis (the order of precedence is overridden by parenthesis)

(  )

4*3/(2*5)=1.2

Exponentiation (multiplies a number by itself a specified number of times)

^

2^3=8

Multiplication
Division

*
/

4*3/2*5=30
(left to right)

Addition
Subtraction

+
-

1+4-2+6=9
(left to right)

Multiplication
Addition

*
+

1+4*2+6=15
(multiply first, then add)

Multiplication
Subtraction

*
-

1-4*2-6= -13
(multiply first, then subtract)

Division
Addition

/
+

1+4/2+6= 9    
(divide first, then add)      

Division
Subtraction

/
-

1-4/2-6= -7
(divide first, then subtract)

Top of Page