I am using the Taylor series for $f(x) = ln(1+x)$, $a = 0$, to try and estimate $ln(0.5)$. I am trying to find how big $n$ must be in order to estimate $ln(0.5)$ to within $10^{-5}$. The problem I am running into is that when I compute $M$ to use in Taylor's Inequality, I get $M$ = $n!\cdot2^{n+1}$, which when I plug this into Taylor's inequality for $M$, I get $R_n(-1/2) = \frac{n!\cdot2^{n+1}}{(n+1)!\cdot2^{n+1}}$. which simplifies to $\frac{1}{n+1}$. But I can't imagine this is correct since this would mean $n$ would have to be $9999$ to estimate $ln(0.5)$ within $10^{-5}$. Any help you can give me is greatly appreciated.
Using Taylor’s inequality for ln(1+x)
calculustaylor expansion
Related Solutions
A not unreasonable thing to do, and probably what you are expected to do, is to expand $\sqrt{x}$ in powers of $x-9$.
The formula for the $n$-th degree Taylor polynomial for $f(x)$ in powers of $x-a$ is $$f(a)+\frac{f'(a)}{1!}(x-a)+\frac{f''(a)}{2!}(x-a)^2+\cdots +\frac{f^{(n)}(a)}{n!}(x-a)^n.$$ In our case we have $f(x)=x^{1/2}$, $a=9$, and $n=2$. To finish getting the second degree polynomial, you need to calculate $f(9)$, $f'(9)$, and $f''(9)$.
We now turn to the error term. By the Lagrange form of the remainder, the absolute value of the error if we use the Taylor polynomial of degree $2$ is $$\frac{|f'''(\xi)|}{3!}|x-9|^3,$$ where $f(x)=x^{1/2}$ and $\xi$ is a number between $x$ and $9$. In our case, we have $x=8$.
Note that $f'''(x)=\frac{3}{8}x^{-5/2}$. Between $8$ and $9$, it is positive and bounded above by $\frac{3}{8}8^{-5/2}$. Thus, putting things together, and noting that $|8-9|=1$, we find that the absolute value of the error is less than $\frac{3}{(8)(3!)}8^{-5/2}$.
For the sine function, the best thing to do is to note that when $|x|\lt 1$ then the usual series for $\sin x$ is an alternating series. For such a series, the absolute value of the error is less than the absolute value of the first "neglected" term. In our case, that term is $-\frac{x^7}{7!}$, so in the interval $[0,1]$ the error has absolute value $\lt \frac{1}{7!}$.
Alternately, but less attractively, we can use the Lagrange formula for the remainder. It is useful to note that the given series up to $\frac{x^5}{5!}$ can be considered to be the expansion up to the term in $x^6$, which happens to be $0$. Thus the Lagrange formula gives absolute value of the error equal to $$\frac{|f^{(7)}(\xi)|}{7!}|x|^7,$$ where $f(x)=\sin x$. The $7$-th derivative of $f(x)$ is $-\cos x$, so the absolute value of the $7$-th derivative is $\lt 1$. That gives us that the absolute value of the error if $|x|\lt 1$ is $\lt \frac{1}{7!}$.
Based on the excerpt from your book, the form of the Taylor remainder that you are using is called the Lagrange remainder. It says that
$$f(x)-T_n(x)=\frac{f^{(n+1)}(\xi(x))}{(n+1)!} (x-a)^{n+1}$$
where $\xi(x)$ is an unknown number between $x$ and $a$. (Generally it is also unknowable, in the sense that you wouldn't be doing Taylor approximation at all if you knew what $\xi(x)$ was.) Thus you can obtain a bound for the absolute error of
$$\frac{M}{(n+1)!} |x-a|^{n+1}$$
if you can show that $|f^{(n+1)}(y)| \leq M$ for all $y \in [a,x]$. An example is
$$|e^x-T_n(x)| \leq \frac{e^x}{(n+1)!} x^{n+1}$$
for $x>0$.
Best Answer
The integral form of the remainder is: $$R_n(x) = \int_a^x \frac{f^{(n+1)}(t)}{n!}(x-t)^n\;dt$$ this is exact, not an approximation, not a bound. If we now bound $|f^{(n+1)}(t)|$ on $[a,x]$ by some $M$ then
\begin{align}|R_n(x)| &= \left|\int_a^x \frac{f^{(n+1)}(t)}{n!}(x-t)^n\;dt\right| = \frac{1}{n!}\left|\int_a^x f^{(n+1)}(t)(x-t)^n\;dt\right|\\ &\overset{(*)}{\leq} \frac{1}{n!}\left|\int_a^x M|x-t|^n\;dt\right| \\ &= \frac{M}{n!}\frac{|x-a|^{n+1}}{n+1} = \frac{M}{(n+1)!}|x-a|^{n+1} \end{align} This is of the form of the Taylor inequality. Taking the smallest such $M$ we get the typical inequality, $|R_n(x)| \leq U_n(x) \equiv \frac{\max_{t\in[x,a]}|f^{(n+1)}(t)|}{(n+1)!} |x-a|^{n+1}$.
My reason for starring $(*)$ is to emphasize the bluntness of this approximation. If $M|x-t|^n$ is a sufficiently loose upperbound for $|f^{(n+1)}(t)(x-t)^n|$ then the bound on the remainder could be way off.
In the specific case of $f(x) = \ln(1+x)$ we have $f^{(n+1)}(x) = (-1)^n \frac{n!}{(1+x)^{n+1}}$. As you correctly noted $|f^{(n+1)}(x)| \leq 2^{n+1} n!$ on $[-\tfrac12,0]$. The true remainder is:
\begin{align} R_n(-\tfrac12) &= \frac{1}{n!}\int_0^{-\tfrac12} f^{(n+1)}(t)(-\tfrac{1}{2} - t)^n\;dt = \frac{(-1)^n}{n!} \int_0^{-\tfrac12} (-1)^n\frac{n!}{(1+t)^{n+1}} (\tfrac12 + t)^n \;dt\\ &= \int_0^{-\tfrac12} \frac{1}{1+t} \left(\frac{\tfrac12 + t}{1+t}\right)^n \;dt = \frac{1}{2^n}\int_0^{-\tfrac12} \frac{1}{1+t} \underbrace{\left(2 - \frac{1}{1+t}\right)^n}_{(**)} \;dt \end{align} Using wolfram alpha to compute this integral for specific $n$ we can find $|R_{11}(-\tfrac12)| \approx 3.79\times 10^{-5}$ and $|R_{12}(-\tfrac12)| \approx 1.76\times 10^{-5}$ and $|R_{13}(-\tfrac12)| \approx 8.2\times 10^{-6}$. So the minimum $n$ is actually $13$. Indeed these match up with a direct calculation.
On the other hand $U_n(x) = \frac{2^{n+1}}{n+1} |x|^{n+1}$. This gives, as you found, $U_n(-\tfrac12) = \frac{1}{n+1}$ which is indeed a pretty dreadful upperbound on $|R_n(-\tfrac12)|$. In fact even to just get $U_n(-\tfrac12) < 10^{-1}$ we need $n>9$ terms, but at that point the true remainder is already $|R_9(-\tfrac12)|<10^{-3}$.
Note that the poorness of the approximation is due to $(**)$ in the integrand. For large $n$ it is only near $1$ very close to $0^-$ and is basically $0$ everywhere else on $[-\tfrac12,0]$. In other words the only significant contribution of $\frac{1}{1+t}$ to the integral is restricted to a small neighborhood near $0^-$. It should therefore be obvious that using a bound of the $n+1$st order derivative, far away from contributing portions of the integrand, could lead to a bad bound $U_n(x)$.
A bit beyond With a little bit more work we can get a much better asymptotic bound on the true remainder. Starting from the $(**)$ step and substituting $y = \frac{1}{1+t} - 1$,
$$R_n(-\tfrac12) = \frac{1}{2^n} \int_0^1 \underbrace{(y+1)}_{\frac{1}{1+t}} \cdot\underbrace{(1-y)^n}_{ \left(2 - \frac{1}{1+t}\right)^n} \cdot \underbrace{-\frac{dy}{(1+y)^2}}_{dt} = -\frac{1}{2^n}\int_0^1 \frac{(1-y)^n}{1+y}\;dy $$
Note that the integrand is positive in $(0,1)$, so the integral is positive, hence $R_n(-\tfrac12) < 0$. This makes sense as the terms of the Taylor approximations $-\sum_{n=1}^N \frac{1}{n\cdot 2^n}$ is decreasing in $N$, so it converges to $\ln(0.5)$ from above.
Using integration by parts with $u = \frac{1}{1+y}$ and $dv = (1-y)^n\;dy$ we get
\begin{align} |R_n(-\tfrac12)| &= \frac{1}{2^n}\left( \bigg[\underbrace{\frac{1}{1+y}}_{u}\cdot \underbrace{- \frac{(1-y)^{n+1}}{n+1}}_{v}\bigg]_0^1 - \int_0^1 \underbrace{\frac{(1-y)^{n+1}}{n+1}}_{v} \cdot \underbrace{-\frac{dy}{(1+y)^2}}_{du} \right)\\ &= \frac{1}{2^n} \frac{1}{n+1} - \frac{1}{2^n}\frac{1}{n+1}\int_0^1 \frac{(1-y)^{n+1}}{(1+y)^2} \;dy \\ &\leq \frac{1}{2^n(n+1)} - \frac{1}{2^n(n+1)}\int_0^1 \frac{(1-y)^{n+1}}{(1+(1))^2} \;dy \\ &= \frac{1}{2^n(n+1)} - \frac{1}{2^n(n+1)}\frac{1}{4} \frac{1}{n+2} \\ &= \frac{1}{2^n(n+1)} - \frac{1}{2^{n+2}(n+1)(n+2)} \\ \end{align}
To see just how much better this is than Taylor's approximation for $\ln(0.5)$, consider $n=100$. Taylor's gives the bound $U_{100}(-\tfrac12) = \frac{1}{100+1} \approx 10^{-2}$, whereas using the first term above gives us
$$ |R_{100}(-\tfrac12)| \leq \frac{1}{2^{100}\cdot (100 + 1)} = \frac {1}{\left(2^{10}\right)^{10} \cdot 101} \leq \frac{1}{\left(10^3\right)^{10} \cdot 10^2} = 10^{-32} $$
To summarize, $$R_n(-\tfrac12) = -\frac{1}{2^n(n+1)} + \Theta\left(\frac{1}{2^n \cdot n^2}\right)$$