# Thread: Maximum error Taylor Series

1. ## Maximum error Taylor Series

To calculate a planet's space coordinates, we have to solve the function

$f(x) = x - 1 -0.5sinx$

Let the base point be a=xi=pi/2 on the interval [0, pi]. Determine the highest-order Taylor series expansion resulting in a maximum error of 0.015 on the specified interval. The error is equal to the absolute value of the difference between the given function and the specific Taylor series expansion. (Hint: Solve graphically)

I have no clue how to solve this so I don't have much direction in my work, I've just been trying a few things and seeing what happens.

Here's what I've got so far. (See figure attached)

Can someone get me going in the right direction or show me how to do these types of questions?

Thanks again!

2. Since x - 1 can be calculated precisely, we need to approximate $(\sin x)/2$ on $[0,\pi]$ up to 0.015. We have $\sin x=S_n(x)+R_n(x)$ where $S_n(x)$ is a partial sum of the Taylor series that goes up to $(x-a)^n$ (here $a=\pi/2$) and $R_n(x)=\sin(x)-S_n(x)$. Then $(\sin x)/2=S_n(x)/2+R_n(x)/2$, and we need to ensure that $\sup_{x\in[0,\pi]}|R_n(x)/2|\le 0.015$, i.e., $\sup_{x\in[0,\pi]}|R_n(x)|\le0.03$.

The Lagrange form of the remainder is $\displaystyle R_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!} (x-a)^{n+1}$ where $\xi$ is some point between $a$ and $x$. Since $|\sin^{(n)}x|\le 1$ for all n and x, we have $\displaystyle |R_n(x)|\le \frac{(\pi/2)^{n+1}}{(n+1)!}$. According to my calculations, the least n such that $\displaystyle\frac{(\pi/2)^{n+1}}{(n+1)!}\le0.03$ is 5. However, since $\sin^{(5)}(\pi/2)=0$, it is enough to approximate $\sin(x)$ by $S_4(x)$, which has only three terms.

I did this check: $S_4(\pi)=0.019968958<0.03$.

3. Originally Posted by emakarov
Since x - 1 can be calculated precisely, we need to approximate $(\sin x)/2$ on $[0,\pi]$ up to 0.015. We have $\sin x=S_n(x)+R_n(x)$ where $S_n(x)$ is a partial sum of the Taylor series that goes up to $(x-a)^n$ (here $a=\pi/2$) and $R_n(x)=\sin(x)-S_n(x)$. Then $(\sin x)/2=S_n(x)/2+R_n(x)/2$, and we need to ensure that $\sup_{x\in[0,\pi]}|R_n(x)/2|\le 0.015$, i.e., $\sup_{x\in[0,\pi]}|R_n(x)|\le0.03$.

The Lagrange form of the remainder is $\displaystyle R_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!} (x-a)^{n+1}$ where $\xi$ is some point between $a$ and $x$. Since $|\sin^{(n)}x|\le 1$ for all n and x, we have $\displaystyle |R_n(x)|\le \frac{(\pi/2)^{n+1}}{(n+1)!}$. According to my calculations, the least n such that $\displaystyle\frac{(\pi/2)^{n+1}}{(n+1)!}\le0.03$ is 5. However, since $\sin^{(5)}(\pi/2)=0$, it is enough to approximate $\sin(x)$ by $S_4(x)$, which has only three terms.

I did this check: $S_4(\pi)=0.019968958<0.03$.
Everything makes sense until you start talking about the lagrange form of the remainder, that's where you lose me.

the remainder is $\displaystyle R_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!} (x-a)^{n+1}$ where $\xi$ is some point between $a$ and $x$. Since $|\sin^{(n)}x|\le 1$ for all n and x, we have $\displaystyle |R_n(x)|\le \frac{(\pi/2)^{n+1}}{(n+1)!}$.
Isn't the $f^{(n+1)}$ representing the derivative? I don't see how we would get higher powers of sin in our Taylor Series if that's what your trying to say.

How does this allow you to conclude,

$\displaystyle |R_n(x)|\le \frac{(\pi/2)^{n+1}}{(n+1)!}$.

Could you clarify some more? I'm still very confused.

4. I am not talking about powers of $\sin x$. By $\sin^{(n)}x$ (as opposed to $\sin^n x$) I denoted the $n$th derivative of $\sin x$, which is either $\pm\sin x$ or $\pm\cos x$; in both cases $\lvert\sin^{(n)}x\rvert\le1$.

Since $x\in[0,\pi]$, we have $\lvert x-\pi/2\rvert\le\pi/2$. Altogether, $\displaystyle\left\lvert\frac{\sin^{(n+1)}\xi}{(n+ 1)!}(x-\pi/2)^{n+1}\right\rvert\le\frac{(\pi/2)^{n+1}}{(n+1)!}$.

5. Thanks that greatly clarified things. One last question.

How did you conclude the following?

According to my calculations, the least n such that $\displaystyle\frac{(\pi/2)^{n+1}}{(n+1)!}\le0.03$ is 5.
Thanks again!

6. I used a calculator to find the values of this expression for n = 2, 3, 4, 5.

7. Originally Posted by emakarov
I used a calculator to find the values of this expression for n = 2, 3, 4, 5.
Okay so our whole goal in this question was to ensure that the error is less than 0.015.

They give the error as,

$\text{error }= | \text{Actual Function} - \text{Taylor series expansion of function}|$

Did we use this at all?

I'm just confused as to what we're dealing with the remainder for.

How does the remainder term relate to the error?

8. Originally Posted by emakarov
We have $\sin x=S_n(x)+R_n(x)$ where $S_n(x)$ is a partial sum of the Taylor series that goes up to $(x-a)^n$ (here $a=\pi/2$) and $R_n(x)=\sin(x)-S_n(x)$.
We determined that n = 5. So we throw $R_5(x)$ away and approximate $f(x)=x-1-(S_5(x)+R_5(x))/2$ by $g(x)=x-1-S_5(x)/2$. You should be able to find an upper bound on $\lvert f(x)-g(x)\rvert$ knowing the upper bound on $R_5(x)$ on the segment in question.

9. Originally Posted by emakarov
We determined that n = 5. So we throw $R_5(x)$ away and approximate $f(x)=x-1-(S_5(x)+R_5(x))/2$ by $g(x)=x-1-S_5(x)/2$. You should be able to find an upper bound on $\lvert f(x)-g(x)\rvert$ knowing the upper bound on $R_5(x)$ on the segment in question.
What do you mean by upper bound?

10. Originally Posted by jegues
What do you mean by upper bound?
See Upper bound in Wikipedia, especially the Examples section.

I also have a question for you.
$\text{error }= | \text{Actual Function} - \text{Taylor series expansion of function}|$
Is error a number or a function? Because if you subtract the Taylor series from f(x), both of which are functions, you get a function, which returns a potentially different result for each $x\in[0,\pi]$. So how exactly fo you define error?

11. Originally Posted by emakarov
See Upper bound in Wikipedia, especially the Examples section.

I also have a question for you.Is error a number or a function? Because if you subtract the Taylor series from f(x), both of which are functions, you get a function, which returns a potentially different result for each $x\in[0,\pi]$. So how exactly fo you define error?
I'm not sure to be honest.

Even if it was a function, as long as the maximum error produced was 0,015 everything should still hold correct?

12. The error is $\sup\limits_{x\in[0,\pi]}\lvert f(x)-g(x)\rvert$, i.e., the supremum of the set $\{\lvert f(x)-g(x)\rvert:x\in[0,\pi]\}$. (To remind, $f(x)=x-1-(S_5(x)+R_5(x))/2$ and $g(x)=x-1-S_5(x)/2$.) The supremum is the least upper bound. It is one of the very first concepts in calculus and comes before limits, derivatives and Taylor series. In this case, the supremum is also the maximum $\max\limits_{x\in[0,\pi]}\lvert f(x)-g(x)\rvert$. However, the maximum would not exist if we considered an open interval $(0,\pi)$ instead of $[0,\pi]$. In contrast, the least upper bound always exists as long as there is some upper bound.

Originally Posted by emakarov
You should be able to find an upper bound on $\lvert f(x)-g(x)\rvert$ knowing the upper bound on $R_5(x)$ on the segment in question.
By this I meant that you can limit $\lvert f(x)-g(x)\rvert$ from above, i.e., find a number greater than $\lvert f(x)-g(x)\rvert$ for all $x\in[0,\pi]$. That would be some upper bound; the error, being the least upper bound, will not exceed that number.

13. Guys,

Pardon me for interjecting, but the hint in the problem statement ("Hint: solve graphically") seems to indicate that what is wanted is for the student to graph f(x) - g(x) for successively better approximations g(x) until one is found which is less than 0.015 in absolute value in the range 0 to pi. Easy enough if you have a graphing calculator.

14. Good point. See the graphs of f(x), g(x) as well as of f(x) - g(x) in WolframAlpha.