# Math Help - Cannot figure out the remainder function of a Taylor series

1. ## Cannot figure out the remainder function of a Taylor series

I get that f(x) = P_n(x) + R(x), and calculating P_n(x) is no big deal--it's just a finite Taylor series. But I am struggling with the R(x). Case in point is a function such as f(x) = xe^(x^2). P_n(x) is just x^3 + x. But what the heck do I do with the R(x)? I know it's a big-O of x^4, since that's the next term, but what on earth do I do from there?

2. ## Re: Cannot figure out the remainder function of a Taylor series

The point is usually to *bound* the remainder term. That will typically involve using the specifics of the domain on which the approximation is to hold.

If $p_n$ is the degree n Taylor polynomial about $x_0$ for $f$ ( $f$ is $(n+1)$ times differentiable), then

$f(x) = p_n(x) + R_n(x)$, where $R_n(x) = \frac{f^{n+1}(c_x)}{(n+1)!}(x-x_0)^{n+1}$ for some $c_x$ between $x_0$ and $x$.

----

In your example, if $f(x) = xe^{x^2}$, then to find the remainder after the 3rd degree Taylor poly at $x_0 = 0$ do:

$f'(x) = (1)e^{x^2} + (x)(2xe^{x^2}) = (2x^2 +1) e^{x^2}$.

$f''(x) = (4x) e^{x^2} + (2x^2 +1)(2x e^{x^2}) = (4x^3+6x)e^{x^2}$.

$f'''(x) = (12x^2+6)e^{x^2} + (4x^3+6x)(2xe^{x^2}) = (8x^4+24x^2+6)e^{x^2}$.

$f^{(4)}(x) = (32x^3+48x)e^{x^2} + (8x^4+24x^2+6)(2xe^{x^2}) = (16x^5 + 80 x^3 + 60x)e^{x^2}$.

Thus $f(0) = 0, f'(0) = 1, f''(0) = 0, f'''(0) = 6$, giving $p_3(x) = x^3 + x$, just as you said.

Now to bound the remainder term, we need to specify the domain on which we're using this approximation.

Let's suppose we want to approximate $f$ by $p_3$ pn the interval $(-R, R)$, for some $R>0$. Note $x_0 = 0 \in (-R, R)$.

APOLOGIES - that's terrible notation. I'm using capital R for both the real number defining the interval, and the Taylor remainder term. I hope the context makes it clear which is which. I don't feel like trying to go back and change it everywhere.

Then $R_3(x) = \frac{f^{(3)+1}(c_x)}{((3)+1)!}(x-(0))^{(3)+1}$ for some $c_x$ between $0$ and $x$, where $x \in (-R, R)$.

And thus $R_3(x) = \frac{f^4(c_x)}{4!}x^4$ for some $c_x \in (-R, R)$.

But then $\lvert R_3(x) \rvert = \lvert \frac{f^4(c_x)}{4!}x^4 \rvert = \frac{\lvert f^4(c_x) \rvert}{4!}x^4$.

So we want to bound $\lvert f^4(c_x) \rvert$ where $c_x \in (-R, R)$.

$\rvert f^{(4)}(c_x) \rvert = \lvert 16c_x^5 + 80 c_x^3 + 60c_x \rvert \lvert e^{c_x^2} \rvert$, so

$\rvert f^{(4)}(c_x) \rvert \le ( 16 \lvert c_x \rvert^5 + 80 \lvert c_x \rvert ^3 + 60 \lvert c_x \rvert ) e^{c_x^2}$, so

$\rvert f^{(4)}(c_x) \rvert \le ( 16 R^5 + 80 R^3 + 60 R) e^{R^2}$.

Thus $\lvert R_3(x) \rvert = \frac{\lvert f^4(c_x) \rvert}{4!}x^4 \le \frac{(16 R^5 + 80 R^3 + 60 R) e^{R^2}}{4!}x^4$.

Suppose $R = 1/2$. Then $\lvert R_3(x) \rvert \le \frac{(.5 + 10 + 30) e^{0.25}}{4!}x^4 = \frac{(40.5) e^{0.25}}{24}x^4 = 2.17 x^4$.

Suppose $R = 1$. Then $\lvert R_3(x) \rvert \le \frac{(16 + 80 + 60) e^{1}}{4!}x^4 = \frac{156e}{24}x^4 = 17.76 x^4$

Suppose $R = 10$. Then $\lvert R_3(x) \rvert \le \frac{(1,600,000 + 80,000 + 600) e^{100}}{4!}x^4 = \frac{(1,680,600) e^{100}}{24}x^4$

so that $\lvert R_3(x) \rvert \le (1.88 \times 10^{48}) x^4$

It's customary to keep those x powers there, but you could bound it absolutely on the specified domain by inserting $x = R$, in which case:

If $R = 1/2$. Then $\lvert R_3(x) \rvert \le 2.17 R^4 = 0.14$.

If $R = 1$. Then $\lvert R_3(x) \rvert \le 17.76 R^4 = 17.6$.

If $R = 10$. Then $\lvert R_3(x) \rvert \le (1.88 \times 10^{48}) R^4 = 1.88 \times 10^{52}$.

Obviously, the approximation can get real bad real fast (not surprising given how explosive $e^{x^2}$ is), but if we're sticking to the interval (-1/2, 1/2), approximating $f$ by $p_3(x) = x^3 + x$ is a pretty good approxiation.

There's of course a fair amount of algebraic skill in figuring the upper bounds for the remainder term. But that should hopefully give you some idea.