When is it invalid to use taylor series expansion?

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.


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.