I know that the Taylor/Maclaurin(?) expansion for the sine function is
$$ \sin(x) = \sum_{n=1}^{\infty} \dfrac{(-1)^{n}x^{2n+1}}{(2n+1)!} = x – \dfrac{x^3}{3!} + \dfrac{x^5}{5!} – \dfrac{x^7}{7!} + \dfrac{x^9}{9!} – \ … $$
My questions are:
-
If I have calculated the first, for example, 5 terms (the ones shown above) in the sine Taylor expansion, then at what values does the Taylor expansion have an error greater than 1% compared to the real sine function?
-
How many terms would I need to calculate of the Taylor expansion for the sine function in order to have an error less than 1% at a certain point (e.g. $ x = 2\pi$)?
I asked this question elsewhere (not on this website) and was told to reasearch "Lagrange multipliers" but I couldn't understand it…can anyone here help me?
EDIT: No wonder I was lost, I was looking at the wrong theorem…
Best Answer
Lagrange multipliers has nothing to do with this; the relevant term is the Lagrange remainder. This says that there exists a $\xi$ between $0$ and $x$ such that
$$f(x)-T_n(x)=\frac{f^{(n+1)}(\xi) x^{n+1}}{(n+1)!}$$ where $T_n$ is the Maclaurin approximant of $f$ of degree $n$. ("Maclaurin" just means that the point of Taylor expansion is $x=0$.)
In the case of sine specifically, that derivative can be uniformly bounded (regardless of what $\xi$, which we do not know, is) by $1$, so that
$$|f(x)-T_n(x)| \leq \frac{|x|^{n+1}}{(n+1)!}.$$
A relative error estimate like you ask for is problematic because $\sin(x)$ vanishes at certain points, so that your relative error estimate looks like
$$\frac{|f(x)-T_n(x)|}{|\sin(x)|} \leq \frac{|x|^{n+1}}{(n+1)! |\sin(x)|}$$
which is very awkwardly behaved near the zeroes of $\sin$ except for $0$. You can avoid the difficulty by restricting attention to the domain $[-\pi/2,\pi/2]$ and using periodicity to extract values elsewhere.
In the case of $\sin$ and also $\cos$, you can get a slightly better estimate than this one by using the alternating series error estimate, which says that if you have a sequence of positive numbers $a_n$ decreasing to zero, then $\left | \sum_{n=N}^\infty (-1)^n a_n \right | \leq a_N$. For $f=\sin$ you can use this to show that given an odd number $k$:
$$|f(x)-T_k(x)| \leq \frac{|x|^{k+2}}{(k+2)!}$$
provided $|x|<k+2$.