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?

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 $\displaystyle p_n$ is the degree n Taylor polynomial about $\displaystyle x_0$ for $\displaystyle f$ ($\displaystyle f$ is $\displaystyle (n+1)$ times differentiable), then

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

----

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

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

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

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

$\displaystyle 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 $\displaystyle f(0) = 0, f'(0) = 1, f''(0) = 0, f'''(0) = 6$, giving $\displaystyle 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 $\displaystyle f$ by $\displaystyle p_3$ pn the interval $\displaystyle (-R, R)$, for some $\displaystyle R>0$. Note $\displaystyle 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 $\displaystyle R_3(x) = \frac{f^{(3)+1}(c_x)}{((3)+1)!}(x-(0))^{(3)+1}$ for some $\displaystyle c_x$ between $\displaystyle 0$ and $\displaystyle x$, where $\displaystyle x \in (-R, R)$.

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

But then $\displaystyle \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 $\displaystyle \lvert f^4(c_x) \rvert$ where $\displaystyle c_x \in (-R, R)$.

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

$\displaystyle \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

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

Thus $\displaystyle \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 $\displaystyle R = 1/2$. Then $\displaystyle \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 $\displaystyle R = 1$. Then $\displaystyle \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 $\displaystyle R = 10$. Then$\displaystyle \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 $\displaystyle \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 $\displaystyle x = R$, in which case:

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

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

If $\displaystyle R = 10$. Then $\displaystyle \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 $\displaystyle e^{x^2}$ is), but if we're sticking to the interval (-1/2, 1/2), approximating $\displaystyle f$ by $\displaystyle 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.