Sub topic 1
Order of Operations and Parentheses: The Foundation
Prerequisites
This chapter assumes you can add, subtract, multiply, and divide integers, fractions, and decimals. You should know the order of operations (PEMDAS: parentheses, exponents, multiplication and division, then addition and subtraction). You should also be comfortable with exponents and single-letter variables.
Order of Operations and Parentheses: The Foundation
Parentheses tell you which part of an expression to compute first. Exponents come next, then multiplication and division, then addition and subtraction. Every method in this chapter depends on this order.
Reading Function Notation f(x)
The notation f(x) names a function f and says that its input is x. The parentheses do not mean multiplication. f(3) means "apply the rule f to the input 3." Each input gives exactly one output.
Made-Up Symbols as Rules, Not Standard Math
On the GRE, a symbol such as ★ may appear with no standard meaning. The question gives a definition, and that definition is the only rule that counts. If a★b = 2a + b², then a★b does not mean a times b or a plus b. Ignore the usual meaning of the symbol and follow the given definition exactly.
Evaluating by Substitution
To evaluate a defined operation, replace each variable with the given number, then apply the order of operations. Put each substituted number in parentheses.
def star(a, b):
# Defined operation: a star b = 2a + b^2
return 2 * a + b ** 2
print(star(3, 4)) # 2*3 + 4**2 = 6 + 16 = 22
print(star(-2, -3)) # 2*(-2) + (-3)**2 = -4 + 9 = 5Exercise
If a★b = 2a + b², what is 1★(2★3)?
Show answer
First compute 2★3 = 2(2) + 3² = 4 + 9 = 13. Then compute 1★13 = 2(1) + 13² = 2 + 169 = 171.