Modeling with polynomial functions
Your measurements change direction more than once, or turn once but lopsidedly, so no line or parabola passes through them. Which polynomial does, how do you find it, and for which inputs can you believe it?
Where you are 6 in Polynomial functions
When you reach for it
A line only rises or only falls. A parabola turns once, symmetrically. The depth of a river, measured from bank to bank, starts at 0, reaches a deepest point that need not be in the middle, and returns to 0. A channel with a sandbar gets deep, shallow, then deep again. When data turns more often than a parabola can, or turns once but off-center, try a polynomial of higher degree.
Three questions come with every such model: which degree, which polynomial passes through the data, and for which inputs it means anything. Choosing a function family tested lines, quadratics and exponentials, and quadratic modeling is the same work one degree down.
The procedure
Which degree?
Count the turns. A polynomial of degree n has at most n - 1 turning points (Degree, end behavior and the shape of a polynomial graph), so data that turns twice needs degree at least 3, and three turns need degree at least 4.
Take differences on equally spaced inputs. Subtract each output from the next, then do the same to those differences, and so on. Constant first differences mean a line, constant second differences a quadratic, constant third differences a cubic, and constant nth differences degree n. The reason is that one round of differences lowers the degree by one. For a term ax^n and a step h,
because the x^n terms cancel and the next term of (x + h)^n is nhx^{n-1}. Lower terms of the polynomial only drop lower. So each round takes degree n to n - 1 and multiplies the leading coefficient by nh, and after n rounds a constant is left:
Here n! = n(n - 1)\cdots 2 \cdot 1. For a cubic that is 6ah^3, or 6a when the step is 1, so the settled difference also gives the leading coefficient. Across uneven steps differences mix the change in input into the change in output, so the steps must be equal. Measured data is never exact: differences that wobble around one value, with no drift, still point to that degree.
Which polynomial?
A cubic y = ax^3 + bx^2 + cx + d has four unknown coefficients, so it takes four points. Each point gives one equation, and since x is a known number, so are x^2 and x^3: the equation is linear in a, b, c and d. Four points with different inputs always fix exactly one polynomial of degree at most 3 (Exercise 16 shows why never two), and in general n + 1 points fix one polynomial of degree at most n.
A point with x = 0 hands you d, leaving a system of three equations in three unknowns. A known zero r gives a factor x - r by the The remainder and factor theorems, removing an unknown; with all the zeros known, one point finishes the job, as in building a polynomial from its zeros. With more measured points than coefficients, usually no polynomial of that degree passes through them all, and a calculator’s cubic regression finds the closest one (Fitting linear and exponential models with technology).
What it means, and where it holds
A zero is an input where the quantity is 0, such as a bank. The y-intercept is the value at input 0, often a starting value. A turn is the largest or smallest value over a stretch: the deepest water, the top of a flood.
A model holds only on its domain: the inputs the situation allows and the data covers. Every non-constant polynomial runs off to +\infty or -\infty at both ends, which a depth or a temperature does not do. Reading between the data is interpolation and reading past it is extrapolation; Where a model holds: domain, interpolation and extrapolation explains why only the first is safe. A zero or a turn outside the domain belongs to the formula, not to the world.
Worked examples
Wenceslas sounds a channel
Wenceslas measures the depth d meters across a channel 12 m wide, at x meters from the west bank. At x = 0, 2, 4, 6, 8, 10, 12 he reads d = 0, 0.80, 1.60, 2.16, 2.24, 1.60, 0. Which polynomial family fits?
SolutionThe inputs go up in equal steps of h = 2, so differences can be compared.
| x | d | 1st | 2nd | 3rd |
|---|---|---|---|---|
| 0 | 0 | |||
| 2 | 0.80 | 0.80 | ||
| 4 | 1.60 | 0.80 | 0 | |
| 6 | 2.16 | 0.56 | -0.24 | -0.24 |
| 8 | 2.24 | 0.08 | -0.48 | -0.24 |
| 10 | 1.60 | -0.64 | -0.72 | -0.24 |
| 12 | 0 | -1.60 | -0.96 | -0.24 |
The first differences change sign, so no line fits. The second differences are not constant, so no parabola fits, and the readings agree: a parabola with zeros at both banks is symmetric about x = 6, but the deepest reading, at x = 8, is east of the middle. The third differences are all -0.24, so a cubic fits, with 6ah^3 = 48a = -0.24, so a = -0.005.
From the banks and two soundings
Find the cubic that fits Wenceslas’s soundings, and compare it with every reading.
SolutionThe depth is 0 at both banks, so x and 12 - x are factors. A cubic has degree 3, so one linear factor is still unknown. Call it px + q:
Two unknowns need two points. At x = 4: 4 \cdot 8 \cdot (4p + q) = 1.6, so 4p + q = 0.05. At x = 8: 8 \cdot 4 \cdot (8p + q) = 2.24, so 8p + q = 0.07. Subtracting, 4p = 0.02, so p = 0.005 and q = 0.03. Taking out the common factor 0.005,
Its leading coefficient is -0.005, as Example 1 found. The other readings agree: d(2) = 0.005 \cdot 2 \cdot 10 \cdot 8 = 0.8, d(6) = 0.005 \cdot 6 \cdot 6 \cdot 12 = 2.16 and d(10) = 0.005 \cdot 10 \cdot 2 \cdot 16 = 1.6. Real soundings would only come close.
What the model says about the crossing
Use d = 0.005x(12 - x)(x + 6). (a) What do its zeros and y-intercept mean? (b) What is its domain? (c) Roughly how deep is the deepest water? (d) A ferry needs at least 1.6 m of water. Where can it run?
Solution(a) The zeros 0 and 12 are the banks. The zero -6 lies 6 m west of the west bank, on dry land, where the formula says nothing about the river. The y-intercept, d(0) = 0, is the west bank itself.
(b) The water between the banks: 0 \leq x \leq 12.
(c) Expanded, d = 0.005(-x^3 + 6x^2 + 72x), and the factor 0.005 moves no turn. The turn formula of Cubic, quartic and higher degree functions, with a = -1, b = 6 and c = 72, gives b^2 - 3ac = 252 and turns at \displaystyle x = \frac{-6 \pm 6\sqrt{7}}{-3} = 2 \pm 2\sqrt{7}. Only \displaystyle 2 + 2\sqrt{7} \approx 7.29 lies in the channel, and the deepest water there is about 2.28 m.
(d) Solve d = 1.6, that is -x^3 + 6x^2 + 72x = 320:
The readings show two solutions, 4 and 10, so (x - 4)(x - 10) = x^2 - 14x + 40 is a factor, and dividing it out leaves x + 8:
The solution -8 is outside the domain. Between 4 and 10 the depth is above 1.6 (for instance d(6) = 2.16) and outside it below, so the ferry can run where 4 \leq x \leq 10, a lane 6 m wide.
Ximeno’s gauge
After a storm, Ximeno reads the water level H, in centimeters, on a gauge post. At t = 0, 1, 2, 3 hours he reads 40, 58, 60 and 52. Find the cubic through the readings.
SolutionWrite H = at^3 + bt^2 + ct + d. The reading at t = 0 gives d = 40. The others give
Dividing the second by 2 and the third by 3 keeps them true: 4a + 2b + c = 10 and 9a + 3b + c = 4. Now c has coefficient 1 throughout, so subtracting each equation from the next removes it: 3a + b = -8 and 5a + b = -6. Subtracting again, 2a = 2, so a = 1, then b = -8 - 3 = -11 and c = 18 - 1 + 11 = 28.
Check every reading, since a slip can leave some equations true: 1 - 11 + 28 + 40 = 58, 8 - 44 + 56 + 40 = 60 and 27 - 99 + 84 + 40 = 52. The differences agree too: first differences 18, 2, -8, second -16, -10, third 6 = 6a.
Testing the gauge model
Ximeno keeps reading: 41 cm at t = 4, 33 cm at t = 6 and 30 cm at t = 10. How well does Example 4’s model do, and over what times should it be trusted?
SolutionH(4) = 64 - 176 + 112 + 40 = 40, H(6) = 216 - 396 + 168 + 40 = 28 and H(10) = 1000 - 1100 + 280 + 40 = 220.
| t | reading | model | reading minus model |
|---|---|---|---|
| 4 | 41 | 40 | 1 |
| 6 | 33 | 28 | 5 |
| 10 | 30 | 220 | -190 |
One hour past the data the model is off by 1 cm; at 6 hours it is drifting; at 10 hours it forecasts 220 cm, far above the flood’s own peak, while the river has settled at 30. The leading coefficient is positive, so t^3 eventually outgrows the other terms and the model must climb forever. Trust it only over about 0 \leq t \leq 4.
Note what Example 4 did not prove. Any four points with different inputs lie on a polynomial of degree at most 3, so passing through them tested nothing. The test is a reading the model was not built from.
Honorata’s sandbar
Honorata sounds a channel 20 m wide. A sandbar runs along the middle, x = 10, its crest just reaching the surface. From each bank the water deepens, then shallows to nothing at the sandbar. At x = 5 the depth is 1.5 m. Find a polynomial model and the deepest water.
SolutionThe profile goes down, up, down and up: three turns, so degree at least 4. The banks are simple zeros, where the bed crosses from land into water. At the sandbar the depth reaches 0 and goes straight back, a zero the graph touches, so x - 10 appears squared (Zeros and multiplicity). That is degree 1 + 1 + 2 = 4:
The sounding gives k \cdot 5 \cdot 15 \cdot 25 = 1875k = 1.5, so k = 0.0008.
For the deepest point, x(20 - x) = 100 - (x - 10)^2, since the right side expands to 20x - x^2. Write u = (x - 10)^2. Then
which is largest when u = 50. So the deepest water is 2 m, where (x - 10)^2 = 50, at \displaystyle x = 10 \pm 5\sqrt{2}, about 2.93 m and 17.07 m from the west bank. The model is symmetric about the sandbar, so it describes two equal channels.
Boundaries
- Equal steps. Differences test degree only on equally spaced inputs.
- Points to spare. n + 1 points always fit degree n, so a fit is evidence only when further points, not used to build it, agree.
- The domain. A zero or turn outside it, like x = -6 in Example 3, is a fact about the formula.
- Not all turning data is polynomial. If no row of differences settles, for instance when each row is a multiple of the last, another family fits.
- Higher degree is not better. A high-degree polynomial forced through many measured points swings between them. Use the lowest degree the turns and differences call for.
Where this goes next
Judging a model’s fit makes the reading-minus-model column of Example 5 a regular test. Why four points never allow two cubics comes down to how many zeros a polynomial can have, which the The fundamental theorem of algebra settles in full.
Exercises
Choosing the degree
- At x = 0, 1, 2, 3, 4, 5 the outputs are y = 2, 4, 12, 26, 46, 72. Which family fits, and what is its leading coefficient?
- At x = 0, 1, 2, 3, 4, 5 the outputs are y = 5, 3, 1, 5, 21, 55. Which family fits, and what is its leading coefficient?
- At x = 1, 2, 3, 4, 5, 6 the outputs are y = 2, 6, 18, 54, 162, 486. Does a polynomial fit?
- Inputs x = 0, 2, 4, 6, \ldots give third differences that are all 24. What degree is the polynomial, and what is its leading coefficient?
Fitting a polynomial
- Find the cubic through (-1, 1), (0, 1), (1, -1) and (2, 7).
- The table in Exercise 2 fits a cubic with leading coefficient 1. Use that and the outputs at x = 0, 1, 2 to find it, then check it at x = 4.
- Cesaria sounds a channel 10 m wide: 0.64 m at 2 m and 1.75 m at 5 m from the west bank. Model the depth as d = x(10 - x)(px + q), find p and q, and predict the depth 7 m from the west bank.
- A channel 16 m wide has a sandbar along its middle whose crest just reaches the surface. The depth 4 m from the west bank is 1.92 m. Model it as in Example 6 and find the deepest water.
Reading and trusting a model
- A ferry on Cesaria’s channel (Exercise 7) needs at least 1.44 m of water. Show that the depth is 1.44 m at x = 4, then find where the ferry can run.
- A channel is modeled by \displaystyle d = \frac{1}{400}x(16 - x)(x + 8). (a) What does each zero mean? (b) What is the domain? (c) Find the depth 2 m from each bank. Which bank drops off more steeply?
- The river’s water temperature T, in degrees Celsius, at t = 0, 1, 2, 3 hours after nine in the morning reads 12, 14, 17 and 18. Find the cubic through these readings, predict T at t = 6, and comment.
- Evdokia fitted N = -t^3 + 10t^2 - 4t + 40 to heron nest counts in years t = 0 to 6. (a) What does it predict for t = 12? (b) Show that N = (10 - t)(t^2 + 4) and find when the model says the colony is gone. (c) What should a report say about these predictions?
Reasoning
- Explain why no quadratic can fit data that falls, rises, and then falls again.
- Find the third differences of y = x^3 at x = 0, 1, 2, 3, 4, 5. Then explain why the third differences of y = ax^3 + bx^2 + cx + d at steps of 1 are all 6a.
- Hourly readings have third differences 5.8, 6.3 and 5.9, with no drift. What model would you try, and roughly what is its leading coefficient?
- Explain why two different cubics cannot pass through the same four points with different inputs.
- A cubic passes exactly through four soundings Honorata takes at a new spot. Is that evidence that it is a good model of the river there?
Answers
- Quadratic, leading coefficient 3. First differences 2, 8, 14, 20, 26; second all 6 = 2a.
- Cubic, leading coefficient 1. First differences -2, -2, 4, 16, 34; second 0, 6, 12, 18; third all 6 = 6a.
- No polynomial of low degree. The third differences 16, 48, 144 never settle: every row of differences is 3 times the row before. Each output is 3 times the last, so an exponential fits: y = 2 \cdot 3^{x - 1}. (Degree 5 fits any six points, which proves nothing.)
- Degree 3. With step h = 2, 6a \cdot 2^3 = 48a = 24, so \displaystyle a = \frac{1}{2}.
- y = 2x^3 - x^2 - 3x + 1. From (0, 1), d = 1. Then a + b + c = -2, -a + b - c = 0 and 8a + 4b + 2c = 6. Adding the first two, b = -1; then a + c = -1 and 4a + c = 5, so a = 2, c = -3.
- y = x^3 - 3x^2 + 5. From x = 0, d = 5; then b + c = -3 and 2b + c = -6, so b = -3, c = 0. Check: 64 - 48 + 5 = 21, as in the table.
- p = 0.01 and q = 0.02, so d = 0.01x(10 - x)(x + 2), and the depth at 7 m is 1.89 m. The soundings give 2p + q = 0.04 and 5p + q = 0.07; then d(7) = 0.01 \cdot 7 \cdot 3 \cdot 9.
- \displaystyle d = \frac{1}{400}x(16 - x)(x - 8)^2, deepest 2.56 m at \displaystyle x = 8 \pm 4\sqrt{2}, about 2.34 m and 13.66 m from the west bank. 768k = 1.92 gives k = 0.0025. With u = (x - 8)^2, d = 0.0025\,u(64 - u), which is 0.0025\left(1024 - (u - 32)^2\right), largest at u = 32.
- Where \displaystyle 4 \leq x \leq 2 + 2\sqrt{10}, about 4 m to 8.32 m, a lane about 4.32 m wide. d(4) = 0.01 \cdot 4 \cdot 6 \cdot 6 = 1.44. Then x(10 - x)(x + 2) = 144 becomes (x - 4)(x^2 - 4x - 36) = 0, so x = 4 or \displaystyle x = 2 \pm 2\sqrt{10}, the negative one off the channel. In between, d(6) = 1.92.
- (a) 0 and 16 are the banks; -8 lies on land and means nothing. (b) 0 \leq x \leq 16. (c) d(2) = 0.7 m and d(14) = 1.54 m, so the east bank drops off more steeply.
- \displaystyle T = -\frac{1}{2}t^3 + 2t^2 + \frac{1}{2}t + 12, predicting T = -21. With d = 12: 3a + b = 0.5 and 5a + b = -0.5 give \displaystyle a = -\frac{1}{2}, b = 2, \displaystyle c = \frac{1}{2}. Running water at -21 degrees is impossible: t = 6 is three hours past the data, and the negative leading coefficient drags the cubic down.
- (a) -296 nests, which is impossible. (b) (10 - t)(t^2 + 4) expands to the same polynomial, and t^2 + 4 is never 0, so the only zero is t = 10. (c) The counts cover years 0 to 6; the collapse comes from the negative leading coefficient, not from the herons, so it should make no prediction past year 6.
- A parabola turns exactly once. Falling, rising, then falling is two turns, which needs degree at least 3.
- Outputs 0, 1, 8, 27, 64, 125; first differences 1, 7, 19, 37, 61; second 6, 12, 18, 24; third 6, 6, 6. In general bx^2 + cx + d has constant second differences, so third differences 0, while ax^3 has a times those of x^3, that is 6a. Differences of a sum are sums of differences, so the total is 6a.
- A cubic, since the third differences wobble around one value, about 6 = 6a. The leading coefficient is about 1.
- If cubics f and g both pass through the points, f - g has degree at most 3 and four zeros. Were it not the zero polynomial, the factor theorem would give four different linear factors, degree 4. So f - g = 0 and f = g.
- No. Any four points with different inputs lie on a polynomial of degree at most 3, so the fit was certain. Evidence comes from further soundings the cubic was not built from.