Using Taylor’s inequality for ln(1+x)

calculustaylor expansion

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.

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)$$

Related Question