# When is it invalid to use taylor series expansion?

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.

• I meant continuous functions sorry. – mtheorylord Nov 7 '16 at 1:57
• Continuous functions can not have a Taylor series as well. – user223391 Nov 7 '16 at 1:57
• No, actually, he's quite right. Functions that can be represented as Taylor Series are called analytic. Note $\text{Functions} \supset \text{Real Functions} \supset \text{Continuous Functions} \supset \text{Differentiable Functions} \supset \text{Infinitely Differentiable Functions} \supset \text{Analytic Functions}$ – MathematicsStudent1122 Nov 7 '16 at 1:58
• Do you really mean entire? An entire function. is by definition representable by Taylor series in the whole complex plane. – Robert Israel Nov 7 '16 at 2:00
• A more moderate approach would be to assume that he/she is mistaken. – user259242 Nov 7 '16 at 2:14

Take a look at $$f(x)=\begin{cases}e^{-1/x^2}&x\ne0\\0&x=0\end{cases}$$ and take the Taylor expansion around $x=0$

$$f(x)=f(0)+f'(0)x+\frac{f''(0)}2x^2+\dots$$

Now, you will find out that

$$f(0)=0$$

$$f'(0)=0$$

$$f''(0)=0$$

$$etc.$$

So be applying Taylor's theorem here, one has

$$e^{-1/x^2}=0$$

which is nonsense.

Then, there is a second case. As Ethan Alwaise mentions, any series expansion makes no sense if it doesn't converge. Take, for example, the expansion of $\frac1{1-r}$ at $r=0$. Then consider that expansion for $r=2$. You should get something along the following lines:

$$\frac1{1-2}=1+2+4+8+\dots+2^n+\dots$$

which is also nonsense.

• A function can have a Taylor Series, even if the Taylor Series does not converge to the function. So, technically, $0$ is the Taylor Series for $f(x)=e^{-1/x^2}$ for $x\ne 0$ and $f(0)=0$, although the series does not converge to $f(x)$ for $x\ne 0$.. – Mark Viola Nov 7 '16 at 2:22
• Interestingly, $1+2+4+\ldots$ does converge to $-1$ in the 2-adic numbers. – user76284 Nov 7 '16 at 5:06
• "Applying Taylor's theorem here, one has $e^{-1/x^2}=0$ which is nonsense." -- Taylor's theorem doesn't state that. After all, if it "returned nonsense" in some cases, it wouldn't be a theorem... – Federico Poloni Nov 7 '16 at 10:36
• @Dr.MV Yes, but you wouldn't say that $e^{-1/x^2}$ is representable by the Taylor series as the OP's question asks. – Simply Beautiful Art Nov 7 '16 at 14:25
• Correct. $f(x)$ has a Taylor series, but the series does not converge to $f(x)$. In fact, the remainder of the Taylor expansion of $f(x)$, in this case, is $f(x)$. – Mark Viola Nov 7 '16 at 15:38

If by represents a function by its Taylor series you mean equal to its Taylor series, then your friend is right.

Indeed - the Taylor series at $0$ of $f(x)=\left\{\begin{array}{ll}e^{-1/x}\textrm{, if }x>0\\0\textrm{, otherwise}\end{array}\right.$ is zero but $f$ is nonzero. Howeover, $f$ is $\mathcal{C}^{\infty}$.

You are looking for analytic functions.

He is right, many functions don't have a Taylor series. For example $f(x)=\begin{cases}1 \text{ for } x\in \Bbb{Q}\\0\text{ else}\end{cases}$ is discontinuous everywhere so not differentiable everywhere and thus doesn't have a Taylor series.

To add to Zachary's answer, a function may have a Taylor series that is valid only within a restricted domain. For example, the function $f(x) = 1/(1 - x)$ is defined on $\mathbb{R} \setminus \{1\}$. It has a Taylor series $$f(x) = \sum_{n=0}^{\infty}x^n$$ on the interval $x \in (-1,1)$, but for $\vert x \vert \geq 1$, the above series diverges.

• There are now four answers and they won't always appear in the same order. Thus, "the above answer" is unclear. Perhaps, you could refer to it with a link - like this. – Mark McClure Nov 7 '16 at 2:20

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.