Finding an interpolating polynomial based upon four points

84 Views Asked by At

Below is a problem I made up and my incorrect solution to it. I am hoping that somebody here can tell me where I went wrong.
Thanks,
Bob

Problem:
Given the points $(0,0), (1,3), (2,5) (4,4)$ find a second order interpolating polynomial, of the form $f(x) = Ax^2 + Bx + C$, such that the point $(4,4)$ is on the curve and the following is minimized: $$ (f(0)- 0)^2 + (f(1) -3)^2 + (f(2) - 5)^2 $$

Answer:

In my answer, I write $D_A$ for the partial derivative of $D$ with $A$. $D_B$ has a similar meaning. \begin{align*} f(4) &= A(4^2) + B(4) + C = 4 \\ 16A + 4B + C &= 4 \\ C &= 4 - 16A - 4B \\ \end{align*} Now let $D = (f(0)- 0)^2 + (f(1) -3)^2 + (f(2) - 5)^2$. \begin{align*} (f(0)- 0)^2 &= C^2 = (4 - 16A - 4B )^2 \\ (f(1) -3)^2 &= (A + B + C - 3)^2 = (A + B + 4 - 16A - 4B - 3)^2 \\ (f(1) -3)^2 &= (-15A -3B + 1)^2 \\ (f(2) - 5)^2 &= (4A + 2B + C - 5)^2 = (4A + 2B + 4 - 16A - 4B - 5)^2 \\ (f(2) - 5)^2 &= (-12A -2B - 1)^2 \\ D &= (4 - 16A - 4B )^2 + (-15A -3B + 1)^2 + (-12A -2B - 1)^2 \\ D_A &= -32( 4 - 16A - 4B) - 30( -15A - 3B + 1 ) - 24(-12A - 2B - 1) \\ D_A &= -128 + 16(32)A + 128B + 30(15)A + 90B - 30 + 24(12)A + 48B + 24 \\ D_A &= 512A + 128B + 450A + 90B + 288A + 48B - 134 \\ D_A &= 1250A + 266B - 134 \\ \end{align*} \begin{align*} D_B &= -8( 4 - 16A - 4B ) - 6( -15A - 3B + 1 ) - 4( -12A - 2B - 1 ) \\ D_B &= -32 +8(16)A + 32B + 90A + 18B - 6 + 48A + 8B + 4 \\ D_B &= 128A + 32B + 90A + 18B + 48A + 8B - 34 \\ D_B &= 266A + 98B - 34 \\ \end{align*} \begin{align*} 1250A + 266B - 134 &= 0 \\ 266A + 98B - 34 &= 0 \\ 133A + 49B - 17 &= 0 \\ A &= \frac{17-49B}{133} \\ 625A + 133B - 67 &= 0 \\ \frac{625(17-49B)}{133} + 133B &= 67 \\ \frac{10625 - 30625B}{133} + 133B &= 67 \\ 10625 - 30625B + 17689B &= 8911 \\ 10625 - 12936B &= 8911 \\ B &= -\frac{1714}{12936} \\ \end{align*} \begin{align*} A &= \frac{17 - \frac{-49(1714)}{12936} } {133} = \frac{17 + \frac{83986}{12936} }{133} \\ A &= \frac{17 + \frac{41993}{6468} }{133} \\ A &= \frac{ 17(12936) + 83986 } { 12936(133)} = \frac{303898} {1720488} \\ A &= \frac{ 6202}{ 35112 } = \frac{ 3101 }{17556} \\ A &= \frac{ 443}{2508} \\ C &= 4 - 16\left( \frac{ 443}{2508} \right) - 4 \left( -\frac{1714}{12936} \right) \\ C &= 4 - 16\left( \frac{ 443}{2508} \right) + 4 \left( \frac{1714}{12936} \right) \\ C &= 4 - \frac{4(443)}{627} + \frac{1714}{3234} \\ C &= 4 - \frac{1772}{627} + \frac{1714}{3234} \\ C &= \frac{4(627)(3234) - 1772(3234) + 1714(627)} {627(3234)} \\ C &= \frac{ 3454902} {2027718 } = \frac{191939} {112651} \\ C &= \frac{ 17449 }{ 10241 } \\ \end{align*} Using the program R, I find that: $$ f(x) = -0.72936 x^2 + 3.93119 x - 0.05505 $$ Hence, I conclude my answer must be wrong.

1

There are 1 best solutions below

4
On BEST ANSWER

I would do this differently, given you have a point on the curve.

First set $f(x)=A(x-4)(x-E)+4$ to give the point on the curve and to reduce the number of variables. We will put $AE=F$, since $E$ only appears as a product with $A$

Then

$f(0)=4F+4$,

$f(1)-3=-3A(1-E)+4-3=3F+1-3A$

$f(2)-5=-2A(2-E)+4-5=2F+4-4A$

Now I notice that I can simplify further if I set $G=F-A$ so that I can write the expression I want to minimise as $$16(F+1)^2+(3G+1)^2+4(2G-F+2)^2$$

If I fix $F$ and minimise with respect to $G$ I find I need $$6(3G+1)+8(2G-F+2)=0=34G-16F+22$$ so that $$G=\frac {8F-11}{17}$$

and I continue by substituting back for $G$, and then work back from $G$ and $F$ to $A$ and $E$, having simplified the computation somewhat.