Chapter 8 Project

Ordering Operations

An activity to explore the orders of operations.

Did you know that the order of operations you learn in math courses is a relatively new set of rules? The rules were created in the early 1900s and solidified into the current form along with the creation of computers and computer languages. Before the 1600s, mathematical notation was not commonly used, and mathematical expressions and equations were written out in words. Any phrasing that was ambiguous (that is, could be understood in more than one way) was avoided. When simplifying expressions in mathematics, care must be taken to properly follow the order of operations. If you stray from the order, you will reach a different conclusion than intended.

Suppose you are creating a computer program to follow the rules for the order of operations. The computer uses * for multiplication, / for division, and ^ to indicate exponents.

  1. As your first test, you enter " 8 + 0 * 3 10 / 2 " into the computer program and it returns a value of 7 .

    1. Following the order of operations, what would you expect as the result?

    2. Explain the error(s) made by the computer program.

    3. Insert grouping symbols into the expression so that it will simplify to the value returned by the computer.

    4. Rewrite the expression (using parentheses if needed) so that the computer program will return the expected value from part a. if the computer program is not modified.

    5. Compare the answers from parts c. and d. What do you notice?

  2. After modifying your code, you verify that the previous expression returns the correct value. For the next test, you enter " 4 ^ 2 10 / 2 + 4 " and the computer returns a value of 15.

    1. Following the order of operations, what would you expect as the result?

    2. Explain the error(s) made by the computer program.

    3. Rewrite the original expression so that it will simplify to the value returned by the computer.

  3. After further modification, the computer program can now properly follow the order of operations. You next add code to allow the program to simplify algebraic expressions. You test your code by entering " 2 ( 3 x + 5 y ) " and it returns 16 x y .

    1. What would you expect the program to return?

    2. Explain the error(s) made by the computer program.

    3. Is this the same error as the computer returning a result of 30 x y when you enter " 3 ( 5 x + 6 y ) "?

  4. As a final step, you write code to allow the program to translate English phrases into algebraic expressions. You enter the phrase "five times two plus three" and the program returns " 5 * 2 + 3 ".

    1. If you expected " 5 ( 2 + 3 ) " in return, is the issue with the computer program or your phrasing? Explain what the issue is.

    2. Next, you enter the phrase "twelve less two times a number" and the program returns " 2 x 12 ". Is the issue the computer program or phrasing?