Sub topic 4
Evaluating by Substitution
Assume you can use order of operations, work with integers and fractions, simplify exponents, and solve basic algebraic equations. This chapter uses those skills to evaluate functions and made-up operations.
The Basic Substitution Process
A definition tells you how to turn input values into an output. For example:
a★b=2a+b^2The symbol \(★\) has no standard meaning here. The definition gives its meaning. To evaluate \(3★4\), replace \(a\) with 3 and \(b\) with 4:
3★4=2(3)+4^2Then follow order of operations:
3★4=6+16=22The reliable process is:
- Copy the rule.
- Substitute each input in the correct position.
- Put negative or fractional inputs in parentheses.
- Apply exponents before multiplication or addition.
- Simplify and check the result.
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 = 22Reading Function Notation
Function notation uses a letter to name a rule. In \(f(x)=3x-5\), \(f\) is the function name and \(x\) is the input.
To evaluate \(f(7)\), replace every \(x\) with 7:
f(7)=3(7)-5=21-5=16The expression inside the parentheses is an input, not automatically multiplication. Thus \(f(7)\) means “the output of \(f\) when the input is 7.”
For a two-input rule, position matters:
| Expression | Substitution into \(2a+b^2\) | Value |
|---|---|---|
| \(3★4\) | \(2(3)+4^2\) | 22 |
| \(4★3\) | \(2(4)+3^2\) | 17 |
| \((-2)★(-3)\) | \(2(-2)+(-3)^2\) | 5 |
The two inputs do different jobs. The first is multiplied by 2. The second is squared.
Signed and Fractional Inputs
Parentheses prevent a sign or fraction from being separated from its input. Compare:
(-3)^2=9with
-3^2=-9In the first expression, the entire negative number is squared. In the second, the exponent applies before the negative sign.
For the rule \(a★b=2a+b^2\):
(-2)★(-3)=2(-2)+(-3)^2=-4+9=5A fractional input works the same way:
\frac12★\frac34
=2\left(\frac12\right)+\left(\frac34\right)^2
=1+\frac9{16}
=\frac{25}{16}A Visual Routine
Common Errors
Using the Standard Meaning of a Symbol
A problem may define \(a★b\) as \(a^2-b\), even though the symbol looks unfamiliar. Do not assign it a meaning from another problem. Use only the definition shown in the question.
Swapping Inputs
For \(a★b=2a+b^2\), switching the inputs usually changes the result:
3★4=22,\qquad 4★3=17Keep the first input in the \(a\) position and the second input in the \(b\) position.
Skipping Parentheses
Writing \(2-3^2\) when you mean \(2(-3)^2\) changes the answer. Substitute first, then simplify.
Ignoring Order of Operations
In \(2a+b^2\), square \(b\) before adding \(2a\). Do not calculate \((2a+b)^2\), because that is a different expression.
Checking an Answer
After calculating, reread the definition and compare each part:
- Did the first input replace \(a\)?
- Did the second input replace \(b\)?
- Were negative values grouped?
- Were exponents evaluated before addition?
- Did you use the invented rule rather than a familiar symbol meaning?
def star(a, b):
return 2 * a + b ** 2
print(star(-2, -3)) # 5
print(star(3, 4), star(4, 3)) # 22 and 17Exercise
If \(a★b=3a-b^2\), what is \((-4)★(-2)\)?
Show answer
Substitute carefully: \(3(-4)-(-2)^2=-12-4=-16\).