# Thread: Maximum error Taylor Series

1. ## Maximum error Taylor Series

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

$\displaystyle 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 $\displaystyle (\sin x)/2$ on $\displaystyle [0,\pi]$ up to 0.015. We have $\displaystyle \sin x=S_n(x)+R_n(x)$ where $\displaystyle S_n(x)$ is a partial sum of the Taylor series that goes up to $\displaystyle (x-a)^n$ (here $\displaystyle a=\pi/2$) and $\displaystyle R_n(x)=\sin(x)-S_n(x)$. Then $\displaystyle (\sin x)/2=S_n(x)/2+R_n(x)/2$, and we need to ensure that $\displaystyle \sup_{x\in[0,\pi]}|R_n(x)/2|\le 0.015$, i.e., $\displaystyle \sup_{x\in[0,\pi]}|R_n(x)|\le0.03$.

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

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

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

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

I did this check: $\displaystyle 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 \displaystyle R_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!} (x-a)^{n+1}$ where $\displaystyle \xi$ is some point between $\displaystyle a$ and $\displaystyle x$. Since $\displaystyle |\sin^{(n)}x|\le 1$ for all n and x, we have $\displaystyle \displaystyle |R_n(x)|\le \frac{(\pi/2)^{n+1}}{(n+1)!}$.
Isn't the $\displaystyle 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 \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 $\displaystyle \sin x$. By $\displaystyle \sin^{(n)}x$ (as opposed to $\displaystyle \sin^n x$) I denoted the $\displaystyle n$th derivative of $\displaystyle \sin x$, which is either $\displaystyle \pm\sin x$ or $\displaystyle \pm\cos x$; in both cases $\displaystyle \lvert\sin^{(n)}x\rvert\le1$.

Since $\displaystyle x\in[0,\pi]$, we have $\displaystyle \lvert x-\pi/2\rvert\le\pi/2$. Altogether, $\displaystyle \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 \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,

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

9. Originally Posted by emakarov
We determined that n = 5. So we throw $\displaystyle R_5(x)$ away and approximate $\displaystyle f(x)=x-1-(S_5(x)+R_5(x))/2$ by $\displaystyle g(x)=x-1-S_5(x)/2$. You should be able to find an upper bound on $\displaystyle \lvert f(x)-g(x)\rvert$ knowing the upper bound on $\displaystyle 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.
$\displaystyle \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 $\displaystyle 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 $\displaystyle 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 $\displaystyle \sup\limits_{x\in[0,\pi]}\lvert f(x)-g(x)\rvert$, i.e., the supremum of the set $\displaystyle \{\lvert f(x)-g(x)\rvert:x\in[0,\pi]\}$. (To remind, $\displaystyle f(x)=x-1-(S_5(x)+R_5(x))/2$ and $\displaystyle 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 $\displaystyle \max\limits_{x\in[0,\pi]}\lvert f(x)-g(x)\rvert$. However, the maximum would not exist if we considered an open interval $\displaystyle (0,\pi)$ instead of $\displaystyle [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 $\displaystyle \lvert f(x)-g(x)\rvert$ knowing the upper bound on $\displaystyle R_5(x)$ on the segment in question.
By this I meant that you can limit $\displaystyle \lvert f(x)-g(x)\rvert$ from above, i.e., find a number greater than $\displaystyle \lvert f(x)-g(x)\rvert$ for all $\displaystyle 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.