# Polynomials

It is an open secret in mathematics that the only objects we can actually compute with over the real numbers are polynomials, and by extension, rational functions. While we all learn about trigonometry and exponential functions in high school, we are actually never able to evaluate those functions except at a few points, e.g. $$0, \pi/4, \pi/3, \pi/2$$, and so on. If we need the value of $$\cos(0.2)$$, we can't find it.

You will tell me, "of course we can find that - here, I'll just plug it into my calculator." However, the fact is that your calculator does not find $$\cos(0.2)$$; it finds the value of a polynomial approximation to the cosine function at 0.2, accurate to 12 or 16 digits. And that is the real point: we don't need to know the exact value of $$\cos(0.2)$$. All we need is to know the value with a few digits of accuracy. The way we get those values is to approximate the cosine by a polynomial, and then evaluate that. Let's do this in an example.

Let's try to find the value of $$\cos(0.2)$$, by finding some polynomial that approximates $$\cos(x)$$ near 0.2. We'll find some quadratic polynomial $$c_2(x)=a_0+a_1x+a_2x^2$$ that is close to $$\cos(x)$$ for $$x$$ near zero. In fact, we want to write $$\cos(x)=c_2(x)+R(x)x^{3}$$ where $$R(x)$$ is some bounded remainder term for $$x$$ near zero.

The first thing we need to require is that $$c_2(0)=\cos 0$$. Since $$\cos(0)=1$$ and $$c_2(0)=a_0$$, then let's set $$a_0=1$$. That's great!. What's left? We can write $\cos(x)=1+a_1x+a_2x^2+R(x)x^{3}.$ This means that $$a_1 = (\cos(x)-1)/x-a_2x-R(x)x^n.$$ This is where the limits we learned about in Chapter 1 could come in handy. Since $$a_1$$ does not depend on $$x$$ at all, we can require $a_1=\lim_{x\to0}a_1=\lim_{x\to0}\frac{\cos(x)-1}{x}+\lim_{x\to0}a_2 x+ \lim_{x\to0} R(x)x^2.$ But we saw in [CosFirstOrderLimit]that this limit on the right is zero. Thus, $$a_1=0,$$ and now $$\cos(x)=1+a_2x^2+R(x)x^{3}.$$

Let's repeat this process to try to find $$a_2$$. We write $a_2=\frac{\cos(x)-1}{x^2}-R(x)x,$ so $\lim_{x\to0}a_2= a_2 =\lim_{x\to0}\frac{\cos(x)-1}{x^2}.$ But this is another limit we computed in [CosDiffLimit]. We found that \begin{align*} \frac{\cos(x)-1}{x^2} &= -\frac12. \end{align*} It follows that $$\cos x=1-\frac12 x^2+R(x)x^3$$. At this point we can see that \begin{align*} R(x)&=\frac1x\cdot\left(\frac{\cos x - 1}{x^2}+\frac12\right).\\ \end{align*} Intuitively, when $$x$$ is small that looks like something that is going to zero times something that is blowing up. Maybe it will remain bounded. Later we will show that it does.

We conclude that our polynomial $$c_2(x)=1-\frac12 x^2$$ is an approximation to $$\cos(x)$$ when $$x$$ is near 0. Indeed, on our calculator we find that $$\cos(0.2)\approx .9800665$$, while $$c_2(0.2)=0.9800000.$$ Already by approximating the cosine by a quadratic we have error smaller than $$10^{-4}$$.

Choose $$x_0$$:

Figure 1: Polynomial approximation to $$\cos x$$

Let's review what we did to get this approximation.

#### Algorithm to find a quadratic approximation to a function

1. We assumed that the function could be expressed as $$a_0+a_1x+a_2x^2+R(x)x^3$$ near $$x=0$$, where $$R(x)$$ was bounded.
2. In that case, we found that $$a_0$$ was the limit of the function at 0.
3. We then solved for $$a_1$$ in terms of $$x$$, and took the limit of that as $$x$$ went to zero. This gave us a value for $$a_1$$.
4. We repeated the last step to find $$a_2$$. I.e. we solved for $$a_2$$ and took the limit as $$x$$ went to zero to get a value.
You can see that we could repeat that last step as many times as we can stand in order to get a higher degree polynomial. We will treat many of our functions this way for the rest of the chapter.