Sub topic 14
Checking Polynomial Results by Substitution
What substitution checks
This chapter assumes you can evaluate algebraic expressions, use integer arithmetic with negative numbers, and combine or multiply polynomials. Substitution means replacing the variable with a chosen number. It provides a quick check that two polynomial expressions give the same result.
For example, suppose you expanded
\[ (x+2)(x^2+3x+1) \]
as
\[ x^3+5x^2+7x+2. \]
Choose \(x=2\). Evaluate both forms:
\[ (2+2)(2^2+3(2)+1)=4(4+6+1)=44 \]
and
\[ 2^3+5(2^2)+7(2)+2=8+20+14+2=44. \]
The matching values support that the expansion is correct.
Checking addition and subtraction
Suppose you add
\[ p(x)=3x^2+2x+1 \]
and
\[ q(x)=x^2-4x+5. \]
The proposed sum is
\[ 4x^2-2x+6. \]
Use \(x=-1\):
\[ p(-1)=3(-1)^2+2(-1)+1=2 \]
\[ q(-1)=(-1)^2-4(-1)+5=10. \]
The original expressions give \(2+10=12\). The proposed sum gives
\[ 4(-1)^2-2(-1)+6=4+2+6=12. \]
The values agree.
For subtraction, remember that the second polynomial is evaluated as a complete expression:
\[ p(-1)-q(-1)=2-10=-8. \]
Parentheses matter when the substituted value is negative.
| Operation | Check |
|---|---|
| Addition | Evaluate each polynomial and add the values |
| Subtraction | Evaluate each polynomial and subtract the second value |
| Multiplication | Evaluate each factor and multiply the values |
Checking multiplication
Suppose the proposed expansion is
\[ (x+2)(x^2+3x+1)=x^3+5x^2+7x+2. \]
At \(x=2\), the left side is \(44\), and the expanded side is also \(44\). At \(x=-1\), the left side is
\[ (1)(1-3+1)=-1. \]
The expanded side is
\[ (-1)^3+5(-1)^2+7(-1)+2=-1+5-7+2=-1. \]
Both tests agree.
The following program evaluates polynomials stored as coefficient lists. The first coefficient is the constant term.
def evaluate(coefficients, x):
return sum(coefficient * x**power
for power, coefficient in enumerate(coefficients))
factor_a = [2, 1] # x + 2
factor_b = [1, 3, 1] # x^2 + 3x + 1
expanded = [2, 7, 5, 1] # x^3 + 5x^2 + 7x + 2
for x in [2, -1, 0]:
left = evaluate(factor_a, x) * evaluate(factor_b, x)
right = evaluate(expanded, x)
print(x, left, right, left == right)The output is:
2 44 44 True
-1 -1 -1 True
0 2 2 TrueA reliable checking routine
- Choose a small value, including a negative value when practical.
- Substitute it into the original expression.
- Use parentheses around substituted negative numbers.
- Evaluate the proposed result separately.
- Compare the two values.
- If they differ, inspect signs, exponents, and omitted terms.
A substitution check can find an error quickly. It cannot replace careful distribution and combining of like terms.
Exercise
An expansion claims that (x - 3)(x + 3) = x^2 - 9. Check the claim at x = 4.
Show answer
The factored form gives (4 - 3)(4 + 3) = 1 * 7 = 7. The expanded form gives 4^2 - 9 = 16 - 9 = 7, so the claim passes this check.