0

Let $p_{n}(x)$ be the Taylor polynomial of degree $n$ of the function $$\boxed{\ f(x)=\log{(1-x)} \quad\text{about $a=0$.}\ }$$

(a) How large should $n$ be such that $\vert f(x) - p_{n}(x)\vert\le 10^{-4}$ for $-0.5\le x\le0.5$?

(b) Does this choice of $n$ change if $x$ lies between $[-1, 0.5]$?


Part a) From repeated differentiation we see that

$$ \frac{d^{n}}{dx^{n}}\log(1-x)=(-1)^{2n+1}\frac{(n-1)!}{(1-x)^{n}}$$

and, from

$$ \vert R_{n}\vert \le \frac{\vert(x-a)\vert^{n+1}}{(n+1)!}\max_{a<c<x} |f^{(n+1)}(c)|, $$ we obtain \begin{alignat*}{2} & &\vert R_{n} \vert &\le \frac{\vert{x}\vert^{n+1}}{(n+1)!}\max_{0<c<0.5} \left\lvert(-1)^{2n+1}\frac{n!}{(1-c)^{n+1}}\right\rvert \tag{1}\\ &\implies\quad & &\le \frac{\vert{x}^{n+1}\vert}{n+1}\max_{0<c<0.5} \left\lvert\frac{1}{(1-c)^{n+1}}\right\rvert \tag{2}\\ &\implies \quad& &\le \frac{\vert{2x}\vert^{n+1}}{n+1}.\tag{3}\\ &\implies \quad&\vert{R_{n}\vert} &\le \frac{1}{n+1}.\tag{4}\\ \end{alignat*} Now, $$ \frac{1}{n+1}<10^{-4}\implies R_{9999} <10^{-4}. $$


Part b) If we're allowed a value of $x=-1$, we may subsitute this in step $(3)$; however, this yields

$$ \frac{2^{n+1}}{n+1}<10^{-4} $$

giving $n=-1$, which doesn't make sense. What am I doing wrong, and can someone help me with part b?

Alex D
  • 1,252
  • 3
    Step $(3)$ is too late. Try step $(2)$. – metamorphy Sep 12 '19 at 11:09
  • Note that for the series remainder of the power series you get $$\left|\sum_{k=n+1}^\infty\frac{x^k}k\right|\le \frac{|x|^{n+1}}{n+1}\sum_{k=0}^\infty|x|^k=\frac{|x|^{n+1}}{(n+1)(1-|x|)},$$ which gives for $|x|\le0.5$ the more manageable inequality $$\frac{2^{-n}}{n+1}<10^{-4}.$$ This is satisfied for $n=10$, much smaller. There may be forms of the Taylor remainder term that are better suited to this task, start with the integral form. – Lutz Lehmann Sep 12 '19 at 12:35
  • @metamorphy I think it still gives you the same answer because pluging in $-1$ gives $ \frac{1}{n+1}\max_{0<c<0.5} \left\lvert\frac{1}{(1-c)^{n+1}}\right\rvert$ and picking $c=.5$ which gives the max value gives $ \frac{1}{n+1} \lvert 2^{n+1}\rvert.$ What am I doing wrong? – Alex D Sep 12 '19 at 12:41
  • @LutzL If I may ask, where does the right side of the inequality come from? (more specifically the series) – Alex D Sep 12 '19 at 12:49
  • It comes from $\frac1{n+1+k}<\frac1{n+1}$ which gives an upper bound by a geometric series. – Lutz Lehmann Sep 12 '19 at 12:54
  • See https://math.stackexchange.com/q/307077/115115 or https://math.stackexchange.com/q/1059461/115115 for a treatment of the Taylor expansion remainder with the Schlömilch remainder term. – Lutz Lehmann Sep 12 '19 at 13:08

2 Answers2

1

First of all, $-1\notin[0,0.5]$. Instead you should have

$$|R_n(-1)|\le\frac{|-1|^{n+1}}{n+1}\max_{-1\le c\le0}\left|\frac1{(1-c)^{n+1}}\right|$$

from which one can see this reduces down to

$$|R_n(-1)|\le\frac1{n+1}$$

Secondly, for negative values of $x$, it suffices to note that $-\frac1nx^n$ is alternating and decreasing in magnitude, so the magnitude of the first omitted term bounds the error:

$$|R_n(x)|\le\frac{|x|^{n+1}}{n+1}\tag{$\forall x\le0$}$$

Third, for $x\in[0,1)$, a better remainder is given using

$$|R_n(x)|=\left|\sum_{k=n+1}^\infty\frac{x^k}k\right|\le\frac{x^{n+1}}{n+1}\sum_{k=0}^\infty x^k=\frac{x^{n+1}}{(n+1)(1-x)}\tag{$\forall x\in[0,1)$}$$

as pointed out by LutzL.

However, for negative $x$, an improved series can be found using log rules. Note that

$$\ln(1-x)=-\ln\left(\frac1{1-x}\right)=-\ln\left(1+\frac x{1-x}\right)$$

and that

$$\left|\ln(1-x)+P_n\left(\frac x{x-1}\right)\right|=\left|R_n\left(\frac x{x-1}\right)\right|\le\frac{|x|^{n+1}}{(n+1)(1-x)^{n+2}}\tag{$\forall x\le0$}$$

which converges faster. For example,

$$\left|\ln(2)+P_n\left(\frac12\right)\right|\le\frac1{(n+1)2^{n+2}}$$

which only requires $10$ terms to approximate $\ln(2)$ with a margin of error of $10^{-4}$.

1

There is no indication in the task that a Taylor remainder term has to be used. Thus explore the full Taylor series $$\ln(1-x)=-\sum_{k=0}^\infty\frac{x^k}k.$$ This power series has radius of convergence equal $1$.

For positive $x$ use the remainder estimate $$ 1>x\ge 0\implies |\ln(1-x)-p_n(x)|\le\sum_{k=n+1}^\infty\frac{x^k}k\le \frac{x^{n+1}}{n+1}\sum_{k=0}^\infty x^k=\frac{x^{n+1}}{(n+1)(1-x)}, $$ For negative $x$, the series is alternating. By the Leibniz test, the remainder of the series is smaller than the next term after the partial sum, thus $$ -1<x<0\implies |\ln(1-x)-p_n(x)|\le \frac{|x|^{n+1}}{n+1} $$ To get both error terms below $10^{-4}$ for $|x|\le 0.5$, the first bound is the worse one and gives $$ \frac{2^{-n}}{n+1}\le 10^{-4}. $$ Now remember $2^{10}=1024\sim 10^3$ to find $n=10$ sufficient to satisfy this inequality.

While the second bound guarantees convergence for $x\in[-1,0]$, the remainder in $x=-1$ has size $\frac1{n+1}$ so that much more terms are required.

Lutz Lehmann
  • 131,652