Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When one needs to compute say $\cos (58^\circ)$ with an error of at most $10^{-4}$, how does one go about it?

What is an appropriate centre of the Taylor expansion, and how does one determine the required degree of the Taylor polynomial?

share|cite|improve this question

Since we have to use Taylor's Theorem to solve this problem, let's first recall what it (or at least one formulation) is:

Taylor's Theorem:
Let $n\in\Bbb N$, let $I=[a,b]$, and let $f:I\rightarrow \Bbb R$ be such that $f$ and its derivatives $f'$, $f''$, $\ldots\,$, $f^{(n)}$ are continuous on $I$ and that $f^{(n+1)}$ exists on $(a,b)$. If $x_0\in I$, then for any $x$ in $I$ there exists a point $c$ between $x$ and $x_0$ such that $$ f(x)=\color{darkgreen}{f(x_0)+f'(x_0)(x-x_0)+{f''(x_0)\over 2!}(x-x_0)^2+ {f'''(x_0)\over 3!}(x-x_0)^3}$$ $$\color{darkgreen} { +\cdots +{f^{(n)}(x_0)\over n!}(x-x_0)^n} +\color{maroon}{{f^{(n+1)}(c)\over (n+1)!}(x-x_0)^{n+1}} $$

The darkgreen term in Taylor's Theorem $$P_n(x)=\textstyle \color{darkgreen}{f(x_0)+f'(x_0)(x-x_0)+{f''(x_0)\over 2!}(x-x_0)^2+ {f'''(x_0)\over 3!}(x-x_0)^3} \color{darkgreen} { +\cdots +{f^{(n)}(x_0)\over n!}(x-x_0)^n} $$ is the Taylor polynomial of the function $f$ of degree $n$ centered at $x_0$.

The maroon term in Taylor's Theorem, $$\tag{1} E_n(x)=\color{maroon}{{f^{(n+1)}(c)\over (n+1)!} (x-x_0)^{n+1}}$$ is called the the error term. Note that the "$c$" here depends on both $n$ and $x$.


If we estimate the function $f(x)$ with the value of $P_n(x)$, then the error in approximation is given by $E_n(x)$. Now, of course, we can't in practice hope to know what $E_n(x)$ is exactly; but if we can find a number $M$ so that $$\tag{2} \max_{t\text{ btw }x_0\text{ and }x } \Biggl|\, {f^{(n+1)}(t)\over (n+1)! (x-x_0)^{n+1}} \, \Biggr | \le M, $$ then we would know from Taylor's Theorem that $$\tag{3} \bigl|\,f(x)-P_n(x)\,\bigr|\le M. $$ The general procedure for approximating a function's value $f(x)$ with a Taylor polynomial $P_n(x)$ to within a certain degree of accuracy, say $\epsilon$, is to first determine a value of $n$, the degree of the Taylor Polynomial, needed so that the right hand side of $(2)$ is less than or equal to $\epsilon$. Then $(3)$ would tell us that the Taylor polynomial of degree $n$ will approximate the value of $f(x)$ to within $\epsilon$.


Now on to your problem. This is calculus, we will use radians for angular measurements.

We wish to estimate $\cos (29\pi/90)$ to within $1/10^4$ using Taylor's Theorem. Since $29\pi/90\approx\pi/3$, we will do so by using a Taylor polynomial of $f(x)=\cos x$ centered at $x_0=\pi/3$ and using $x=29\pi/90$ in Taylor's Theorem.

But what should should the degree $n$ of the polynomial be? We can use the remarks above to determine this:

We want the error in approximation, $E_n(29\pi/90) $ to satisfy $$\tag{4} \bigl|\,E_n(29\pi/90)\,\bigr|\le {1\over 10^4}. $$ Using $(1)$ to write the term $E_n(29\pi/90)$ more explicitly, we want

$$ \Biggl|\,{ f^{(n+1)} (c)\over (n+1)!} \bigl({\textstyle{29\pi\over 90}-{\pi\over3}}\bigr)^{n+1}\,\Biggr|\le {1\over 10^4}; $$ which simplifies to

$$\tag{5} \Biggl|\,{ f^{(n+1)} (c)\over (n+1)!}\bigl({\textstyle{- \pi\over 90}}\bigr )^{n+1}\,\Biggr|\le {1\over 10^4}. $$ Since we do not know what $c$ is, we find an upper bound for the expression on the left hand side of $(5)$; that is, we find an $M$ as in $(2)$. We can be slack here and use the fact that all derivatives of $f(x)=\cos x$ produce functions with absolute value at most 1. So, we have $$\tag{6} \bigl|E_n(29\pi/90)\bigr|= \Biggl|\,{ f^{(n+1)} (c)\over (n+1)!}\bigl({\textstyle{- \pi\over 90}}\bigr )^{n+1}\,\Biggr|\le \Biggl|\, {1\over (n+1)!}({ -\pi\over 90} )^{n+1}\,\Biggr|. $$ Now we find an $n$ so that the right hand side of $(6)$ is less than or equal to $1/10^4$. Then it will follow that inequality $(4)$ holds for this value of $n$, and consequently that $P_n(29\pi/90)$ approximates $\cos(29\pi/90)$ to within $1/10^4$. It turns out that (nicely) $n=2$ does the job, as direct verification will attest (you can plug values of $n$ into the right hand side of $(6)$ until you see the inequality is satisfied).


So, $n=2$, and the desired approximation is $P_2(29\pi/90)$.

We, of course, need to find $P_2(29\pi/90)$. Towards this end we first find the general form of $P_2(x)$ which is: $$ P_2(x)=f(\pi/3)+f'(\pi/3)(x-\pi/3)+{f''(\pi/3)\over2!}(x-\pi/3)^2. $$

We have: $$ \eqalign{ f(\pi/3) &= \cos(\pi/3)=1/2\cr f'(\pi/3)&=-\sin(\pi/3)=\sqrt3/2\cr f''(\pi/3)&= -\cos(\pi/3)=-1/2\cr } $$

So $$ P_2(x) = {1\over 2}-{\sqrt3\over2}(x-{\pi/3})-{1\over 2\cdot2!}(x-{\pi/3})^2. $$

Finally, the desired approximation is: $$ P_2(29\pi/90) = {1\over 2}-{\sqrt3\over2}(-\pi/90)-{1\over 2\cdot2!}(-\pi/90)^2. $$

share|cite|improve this answer
1  
I can't decide whether to love or to hate this answer! – Chris Taylor Apr 12 '12 at 23:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.