TITLE: When is it invalid to use taylor series expansion?
QUESTION [11 upvotes]: I was told by a fellow student that sometimes one cannot represent certain functions by a taylor series. I was also told that sometimes using a taylor series in a proof is invalid. Is any of this true? When is it invalid to use taylor series expansion?
Edit: By certain functions, I mean well behaved functions with nice properties, entire, countinuous, etc.

REPLY [3 votes]: Let $N$ be an integer greater than zero and let $f$ be a $C^{N+1}$ function defined on an interval $[a,b]$ which contains zero. By the fundamental theorem of calculus,
$$
f(x) = f(0) + \int_0^x f'(t) dt
$$
Integrating by parts (choose $u = f'(t)$, $v = (t-x)$) we obtain
$$
\begin{align} \int_0^x f'(t)dt &= \left. (t-x) f'(t) \right|_0^x - \int_0^x (t-x) f''(t) dt \\
&= x f'(0) - \int_0^x (t-x) f''(t) dt.
\end{align}
$$
Therefore
$$
f(x) = f(0) + xf'(0) - \int_0^x (t-x) f''(t) dt.
$$
We can continue inductively integrating the last term by parts to obtain
$$
f(x) = \sum_{n=0}^N f^{(n)}(0) \frac{x^n}{n!} + R_N(x),
$$
where the remainder term $R_N(x)$ is defined by
$$
R_N(x) = \frac{(-1)^N}{N!} \int_0^x (t-x)^N f^{(N+1)}(t) dt.
$$
This gives an exact computation of the error in the $N$th order Taylor approximation.
For a counter-example such as $f(x) = e^{-1/x}$ for $x > 0$ and $0$ otherwise, it is easy to see that for any $x > 0$ the remainder terms $R_N(x)$ diverge to infinity, and therefore the Taylor series does not converge to $f(x)$, even though the series itself converges.