# Polynomials - Examples

Does the algorithm work for actual polynomials? Any such exercise is going to seem like a tautology if it works, but lets do it one time, just to show that it is consistent. Consider the quadratic given by \(p(x)=3-2x+x^2.\) If the algorithm works, it should just give the same polynomial back.

Thus, we suppose that \(p(x)=a_0+a_1x+a_2x^2+R(x)x^3\). Note that \(R(x)\) should be zero, but we'll just treat it formally for the moment. Steps one and two of the algorithm say that \(a_0=p(0)\). We can see that \(p(0)=3-2(0)+(0)^2=3,\) so \(a_0 = 3.\). The next step of the algorithm says we should solve for \(a_1\) in terms of \(x\) and take its limit as \(x\to0\). This looks like \begin{align*} a_1 &= \lim_{x\to0}\frac{p(x)-3-a_2x^2-R(x)x^3}{x}\\ &=\lim_{x\to0}\left(\frac{(3-2x+x^2)-3}{x}-a_2x-R(x)x^2\right)\\ &=\lim_{x\to0}(-2+x)\\ &=-2. \end{align*}

Ok, so now our polynomial approximation to \(p\) looks like \(3-2x+a_2x^2+R(x)x^3\). We repeat step 3 of the algorithm for \(a_2\): \begin{align*} a_2 &= \lim_{x\to0}\frac{p(x)-(3-2x+R(x)x^3)}{x^2}\\ &=\lim_{x\to0}\left(\frac{(3-2x+x^2)-(3-2x)}{x^2}-R(x)x\right)\\ &=\lim_{x\to0}\left(\frac{x^2}{x^2}\right)\\ &=1. \end{align*} This leaves our polynomial approximation looking like \(3-2x+x^2+R(x)x^3\). At this point we can see that \(p(x)-(3-2x+x^2)=0\) only if \(R(x)=0\).

We suppose that we know the value of \(e\), it is approximately \(2.718281828459045235360287\). We also know \(e^0=1\). We can do some numerical calculations using those numbers - we have no other way of attacking the problem at this stage. We suppose, as usual, that \(\exp(x)=a_0+a_1x+a_2x^2+R(x)x^3.\) Also as usual we find that \(a_0 = \lim_{x\to0}\exp(x)=\exp(0)=1.\) The next step is to evaluate \[\lim_{x\to0}a_1=\lim_{x\to0} \left(\frac{\exp(x)-1}{x}-a_2x-R(x)x^2\right).\] We don't really have any means of doing that analytically, but we can run some numerical experiments. Table 1 shows values of \(\frac{\exp(x)-1}{x}\) as \(x\) approaches zero, using 25-digit arithmetic. We see that the numbers appear to be approaching 1. We conclude that \[a_1=\lim_{x\to0}\frac{\exp(x)-1}{x}=1.\] It is no proof, but convincing nonetheless.

\(x\) | \[\frac{\exp(x)-1}{x}\] |
---|---|

\(10^{-3}\) | 1.000500166708341668055755 |

\(-10^{-3}\) | 0.9995001666250083319446481 |

\(10^{-6}\) | 1.000000500000166666717442 |

\(-10^{-6}\) | 0.9999995000001666666304228 |

\(10^{-9}\) | 1.000000000500000007640262 |

\(-10^{-9}\) | 0.9999999995000000006006477 |

\(10^{-12}\) | 1.000000000000487685252691 |

\(-10^{-12}\) | 0.9999999999995054082752847 |

Now we do this again to find \(a_2.\) We have \[a_2 = \left(\frac{\exp(x)-1-x}{x^2}-R(x)x\right). \]

\(x\) | \[\frac{\exp(x)-1-x}{x^2}\] |
---|---|

\(10^{-3}\) | 0.5001667083416680557545491 |

\(-10^{-3}\) | 0.4998333749916680553518673 |

\(10^{-6}\) | 0.5000001666667174424940336 |

\(-10^{-6}\) | 0.4999998333333695771623772 |

\(10^{-9}\) | 0.5000000076402615138050785 |

\(-10^{-9}\) | 0.4999999993993522514395795 |

It looks like this limit goes to \(\frac12\). We conclude that our numerical experiments show that \[\exp(x)\approx 1+x+\frac{x^2}2.\] Figure 1 illustrates this and shows the error. The exponential function is shown in blue; the quadratic is green.

Figure 1: Polynomial approximation to \(\exp(x)\)