This question already has an answer here:

I am taking some courses online (machine learning) and the instructor noted that a Taylor series can be used to approximate any function. A student left a comment that a Taylor series cannot approximate ANY function, but noted that the instructor probably stated it unequivocally because it can certainly approximate any function we would need for the class.

I am curious, what functions cannot be approximated by a Taylor series?

Two things lead me to believe that any function CAN be approximated by a Taylor series:

  1. In context of regression, it seems I can always continue to add terms and adjust the coefficients on those terms (or solve for them to reduce the error) to continually get a better approximation of points in my data set.
  2. The ambiguity of the word approximate suggests that we don't have to meet a strict criteria to say that a Taylor series approximates a function.

With those things in mind, I can also see a point to the opposite view. For example, a function with large discontinuities such as

$f(x) = \begin{cases}sin(x)/x^2 & \text{if $x < 0$} \\ 2x & \text{if $x > 100$}\end{cases}$

seems like it wouldn't be well approximated by a Taylor series. But then again, without some defenition of approximate, I don't see how we can say either way.


marked as duplicate by Xander Henderson, Namaste calculus Jul 8 '18 at 14:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ Taylor series approximations only "work" in a neighborhood of some point---they only converge on some open disk centered at the point where the expansion is based. Assuming that a function has enough derivatives, the approximation can be made as good as possible on that disk, and will blow up away from that disk. $\endgroup$ – Xander Henderson Jul 8 '18 at 3:00
  • $\begingroup$ See e.g. MSE 2125155. You may also wish to read up on analytic functions (you want functions that are not analytic...). Wikilink: en.wikipedia.org/wiki/Analytic_function $\endgroup$ – Benjamin Dickman Jul 8 '18 at 3:01
  • $\begingroup$ Sorry I did search the site before posting by I think my wording was poor. I will refer to the other post. $\endgroup$ – Hanzy Jul 8 '18 at 3:02
  • $\begingroup$ I guess I took differentiability for granted. Maybe that was the point of contention by the other student, but it wasn’t stated specifically. $\endgroup$ – Hanzy Jul 8 '18 at 3:08
  • 1
    $\begingroup$ @Hanzy In the case of a better search you may also want to see the "related posts " on the right side of the web page or else you can search your questions using approach0.xyz , hope this will help u search better questions again. $\endgroup$ – BAYMAX Jul 8 '18 at 3:30

Notice that to have a taylor series, our function must be smooth (e.g. infinitely continuously differentiable). Hence, a counter example will be any function that isn't smooth. Indeed, a simple counter example is \begin{align} f(x) = |x| \end{align} We cannot obtain a taylor series around $x=0$ because $f'(0)$ is not continuous.

For more sophiscated counter examples where $f$ is smooth, https://en.wikipedia.org/wiki/Non-analytic_smooth_function.

But a curious fact is that for a complex valued function $g$, then $g$ is smooth if and only if it's analytic(e.g. has a taylor series).


Here's a function that is smooth (infinitely differentiable) but fails to have a Taylor series at $x=0$:

Consider $f(x)=e^{-\frac{1}{x^2}}$ for $x \in \mathbb{R}-0$ and $f(0)=0$.

Show that $f^{(n)}=0$ and therefore the Taylor series for this function, if it existed, must be $0$. While this function is clearly not constant in any neighborhood of $0$.

In general, analytic functions have Taylor series. This is pretty much the definition of an analytic function as far as I'm aware.


Not the answer you're looking for? Browse other questions tagged or ask your own question.