# Find the error approximation for the function $f(x) = \dfrac{1}{1-x}$

Problem
Let $f(x) = \dfrac{1}{1-x}$, find the Taylor polynomial $P_n(x)$ about $x_0 = 0$. Find a value of $n$ such that the approximation is within $10^{-6}$ on $[0, 0.5]$.

To find $P_n(x)$ is straightforward, $$f^{(1)}(x) = \dfrac{-1}{(1 - x)^2}$$ $$f^{(2)}(x) = \dfrac{2}{(1 - x)^3}$$ $$f^{(3)}(x) = \dfrac{-6}{(1 - x)^4}$$ $$f^{(4)}(x) = \dfrac{24}{(1 - x)^5}$$ $$f^{(5)}(x) = \dfrac{-120}{(1 - x)^6}$$ $$\ldots$$

$$f^{(n)}(x) = (-1)^n \dfrac{n!}{(1-x)^{n+1}}$$ At $x_0 = 0$, the Taylor polynomial is:

$$P_n(x) = \dfrac{f(0)}{0!} + \dfrac{f^{(1)}(0)}{1!}x + \dfrac{f^{(2)}(0)}{2!}x^2 + \ldots + \dfrac{f^{(n)}(0)}{n!}x^n$$ $$= 1 - x + \dfrac{2}{2!}x^2 + \dfrac{-6}{3!}x^3 + \ldots + (-1)^n\dfrac{n!}{n!}x^n$$ $$= 1 - x + x^2 - x^3 + \ldots + (-1)^nx^n$$

However, I realize this Taylor polynomial is weird somehow, for example if I plug in $x = 0.5$ then $$f(x) = \dfrac{1}{1-0.5} = 2$$ while approximate with the Taylor polynomial, $n$ has to be extremely large. I don't even know how large it could be to get close to $10^{-6}$. On the other hand, to find the error approximation I use the formula $$R_n(x) = \dfrac{f^{(n + 1)}(\xi(x))}{(n + 1)!} \cdot x^{n + 1}$$ $$= (-1)^{n + 1} \cdot \dfrac{(n + 1)!}{(1 - \xi(x))^{n + 2}} \cdot \dfrac{x^{n + 1}}{(n + 1)!}$$ $$= (-1)^{n + 1} \dfrac{x^{n + 1}}{(1 - \xi(x))^{n + 2}}$$ where $x \in [0, 0.5] \implies \xi(x) \in [0, 0.5]$. Then to maximize $R_n(x)$, I picked $x = 0.5$ and $\xi(x) = 0.5$ which yields: $$R_n(x) = (-1)^{n+1} \dfrac{0.5^{n+1}}{(1-0.5)^{n+2}} = (-1)^{n+1}\dfrac{1}{0.5^n}$$

Apparently, this doesn't make any sense because $R_n$ is getting bigger and bigger as $n$ increase. And the solution in the textbook is $n = 19$. So there must be something wrong along the way, but I couldn't find where. I wonder if anyone could give me a hint to this problem. I'm new to Numerical Analysis and my lecture notes doesn't help at all. Thanks a lot in advance.

-
You have a sign wrong - there is both a negative power and a $-x$ - check your derivative. – Mark Bennet Sep 9 '11 at 7:29
It's just the geometric series formula, yo. You can even use it to deduce $$f(x)-P_n(x)=\frac{x^{n+1}}{1-x}\le\frac{1}{2^n}\text{ on }[0,1/2].$$ (Though maybe that's a cheap solution if some homework problem wants a more Taylor-flavored analysis.) – anon Sep 9 '11 at 7:37
@Mark Bennet: Thank you. Did you mean the formula of $f^{(n)}$ is wrong? I've been looking at this problem for hours, I really couldn't see it well. – Chan Sep 9 '11 at 7:39
@anon: Thanks for the alternative approach, however I've just learned Taylor method, so I really want to focus on understanding it. – Chan Sep 9 '11 at 7:42
The Lagrange form of the remainder is not directly useful here, unless we get a better than most pessimistic estimate of $\xi$. The problem, as quoted, does not appear to specify that the Lagrange form of the remainder be used. Thus the approach of @anon seems eminently sensible in this case. – André Nicolas Sep 9 '11 at 10:24