0
$\begingroup$

I am a little confused with the Taylor Series at the moment, so please forgive me for my very basic questions. If we were to approximate a function, say $cos(x)$, I let $f(x)=cos(x)$

And I have been shown that $f(x)≈f(x_0)+f'(x_0)(x-x_0)$

Just so I understand, when we say we are approximating it, are we simply saying that we can find the original function's $y$ value when given a specific $x$ value by using another, easier polynomial function that we substitute that same $x$ value into?

Anyway we found that $P_2(x)=-\frac{1}{2}x^2+1$ is an approximation of $cos(x)$. This didn't make much sense though as in the first step, we substituted zero in as $x$, and found $cos(0)=1$ But if this was another number, we would have to find the cosine of that number which defeats the whole purpose? Any help would be appreciated

$\endgroup$

4 Answers 4

3
$\begingroup$

The answer can be found in the following graph representing $\color{darkblue}{\cos x}$ and $\color{darkmagenta}{-\tfrac12x^2+1}:$

$\phantom{XXX}$Thanks Mathematica! You're very kind! ;-)

Near $0$, our polynomial approximation is pretty good, but when you start going far, this approximation becomes less accurate as the graph shows.

$\endgroup$
2
$\begingroup$

The idea is that you can control the error. Indeed, we have $\cos x \approx 1 - \frac{x^2}{2}$, if $x$ is close to zero. For instance, if I want to know $\cos 0.1$, may be reasonable that $$\cos 0.1 \approx 1 - \frac{0.1^2}{2} = 1 - 0.005 = 0.995$$

We can use Lagrange's formula for the remainder, to estimate how much we're missing. If $$\sum_{k = 0}^{n} \frac{f^{(k)}(x_0)}{k!} (x - x_0)^k $$

is the Taylor expansion of order $n$ of f, around $x_0$, then the error can be estimated by $$\frac{f^{(k+1)}(c)}{(k+1)!} (x - x_0)^{k+1}$$

for some $c$ between $x$ and $x_0$. Ok?

$\endgroup$
2
  • $\begingroup$ So if we found the approximation function centered at 0, we can still use that function to find numbers close by to get a rough y value, but if the numbers are not near zero, it will be way off? Also when would we use that same function to approximate y values rather than just move the centre and recalculate an accurate function? I think what threw me was the whole differentiating between when we CENTER it at zero, and when we find the y value when the function's x value it AT zero. $\endgroup$
    – user88720
    May 21, 2014 at 17:44
  • $\begingroup$ Yes. If you want to estimate the value of the function for some $x$ far from the center, you must use a higher order Taylor expansion. How much higher depends of your objective, and given a maximum margin of error, and a center, you can use Lagrange's formula to calculate the order you need, how far you have to go in the expansion. $\endgroup$
    – Ivo Terek
    May 21, 2014 at 17:53
1
$\begingroup$

The whole purpose (well, one purpose) is that you don't have to find the cosine! You know that, for example,

$$\cos\left(\frac{1}{2}\right) \approx -\frac{1}{2} \left( \frac{1}{2} \right)^2 + 1$$

without having to actually compute a cosine at all.

The actual first few decimal places are

  • $\cos\left(\frac{1}{2}\right) = 0.87758\ldots$
  • $-\frac{1}{2} \left( \frac{1}{2} \right)^2 + 1 = 0.875$

so it is a pretty good approximation; for many purposes, using $0.875$ when you were supposed to use $\cos\left(\frac{1}{2}\right)$ is perfectly fine.

$\endgroup$
0
$\begingroup$

Lets say we have a polynomial $P_n(x)≈\cos(x)$ and assume $P_n(x)=a_0+a_1x+a_2x^2+...+a_nx^n$ and my proposal is that as $n$ approaches infinity, $$P_\infty(x)=\cos(x)=a_0+a_1x+a_2x^2+...$$ and now, since the polynomial and the function are equal, that must mean that their values at a specific point, lets say $x=0$,for example, are equal too: $$P_\infty(0)=\cos(0)$$ ant note, that $$P_\infty(0)=a_0=\cos(0)=0$$ Also since $P_\infty(x)=\cos(x)$ their derivatives are equal too, $$P'_\infty(x)=a_1+2a_2x+3a_3x^2...=\cos'(x)=-\sin(x)$$ (this uses the fact that the derivative of a constant is zero, and the power rule: $(x^r)'=rx^{r-1}$) Now lets analize the derivatives at zero $$P'_\infty(0)=a_1=-sin(0)=0$$ Now the double derivative $$P''_\infty(x)=-sin'(x)=-cos(x)=2a_2+2*3a_3x+2*3*4a_4x^2...=2!a_2+3!a_3x+4!a_4x^2...$$ (as you can see this is where the factorial comes in, it is merely a consequance of the power rule) Once again let us analize the double derivative at $0$ $$P''_\infty(0)=2!a_2=-cos(0)=-1$$ $$a_2=-\frac{1}{2!}$$ now, by derriving the funtion ad infinitum and analyzing its value at zero, we may find all of the infinite polynomials coefficients, and by noting that $$\cos(x)'=-\sin(x)$$ $$\cos(x)''=-\sin(x)'=-\cos(x)$$ $$\cos(x)'''=-\sin(x)''=-\cos(x)'=\sin(x)$$ $$\cos(x)''''=-\sin(x)'''=-\cos(x)''=\sin(x)'=\cos(x)$$ the derivatives of the cosine are periodic with a period of four, we may note that $$a_0=1$$ $$a_1=0$$ $$a_2=-1/2!$$ $$a_3=0$$ $$a_4=1/4!$$ $$a_5=0$$ $$a_6=-1/6!$$ or generally, if $n$ is an odd number, $a_n=0$, if $n$ is divisible by $4$, then $a_n=1/n!$, and if $n$ divisible by 2 but not by 4, $a_n=-1/n!$.

Putting that all together, we get that $$\cos(x)=1-\frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}+\frac{x^8}{8!}...$$

Now as you can see, analyzing the function anywhere else other than at$x=0$ would be a pain, because if, for example $$P_2(x)=a_0+a_1x+a_2x^2$$, and we analyze at $x=3$, we get that $$P_2(3)=a_0+3a_1+9a_2≈\cos(3)$$ So as you can see, getting any coefficients out of this expression would be impossible, further more if we have an infinite polynomial.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .