It turns out a function f can have a Taylor series that doesn't converge to f anywhere, except at its center. (The value at the center point a is just f(a) so no convergence issues.) It's possible that in every neighborhood of the center, the Taylor series converges to the wrong function.
The classic example of such a function is f(x)={e−1/x,0,x>0x≤0. (Its close relative g(x)={e−1/x2,0,x=0x=0 also works.) Certainly f(x)=0 for any x>0. Nevertheless, its Maclaurin series is just the constant function 0, which is not equal to f for any x>0 !!
Here's a graph of the function f:
Notice it looks pretty flat at x=0, which is intuitively how the Taylor series can just be the constant zero - All the derivatives of f at 0 are just zero!
Ready for the details and proof?
We will show that f(n)(0)=0, so that its Maclaurin series is just M(x)=0, which is not equal to f for any x>0.
Since f(x)=0 for x<0, then f(n)(x)=0 for x<0, which implies that the left handed derivative at 0 is:
f−(n)(0)=x→0−limx−0f(n−1)(x)−f(n−1)(0)=0.
So to conclude that f(n)(0)=0, we now need to show that f+(n)(0)=0.
We first use induction to show that for x>0, there exists some polynomial pn(t) such that
f(n)(x)=pn(1/x)e−1/x.
In other words, the nth derivative of f is a finite sum of terms of the form xkce−1/x for some constants c and k that may vary from term to term. (It can even be shown that pn is of degree 2n.) Taking a few derivatives of f will give you some motivation for this result.
Why is this fact useful? If we have f(n)(x)=pn(1/x)e−1/x, then we take the limit as x→0+ to compute f[n]=0 - We'll look more into these details after proving the fact.
This statement is true for n=1, since
f′(x)=e−1/x⋅x21,
where p1(t)=t2 and p1(x1)=x21.
Now we suppose that f(k)(x)=pk(1/x)e−1/x for some n=k. We differentiate once to get
f(k+1)(x)=dxd[f(k)(x)]f(k+1)(x)f(k+1)(x)=dxd[pk(1/x)e−1/x]=pk′(1/x)⋅x2−1e−1/x+pk(1/x)e−1/x⋅x21=[pk′(1/x)⋅x2−1+pk(1/x)⋅x21]e−1/x,
and we see that pk+1(1/x)=[pk′(1/x)⋅x2−1+pk(1/x)⋅x21], which is still a polynomial in terms of x1. Thus f(k+1)(x)=pk+1e−1/x, so we can conclude that f(n)(x)=pn(1/x)e−1/x for all n∈N.
Now using our formula for the kth derivative, we can compute f+[k](0).
Method 1: We have
f[n](x)=pn(1/x)e−1/x.
Now we use the fact that f+[n](0)=limx→0+f[n](x) when the limit exists. (Proof of this fact by using continuity of f[n−1] and mean value theorem.) Note that
x→0+limxk1e−1/x=t→+∞limtke−t=0
for any k∈N. Since pn(1/x) is just a bunch of powers of x1 with constants, when we multiply by e−1/x we get the limit
f+[n](x)=x→0+limpn(1/x)e−1/x=0.
Method 2 (induction): When n=1, then
f+′(0)=x→0+limx−0f(x)−f(0)=x→0+limxe−1/x=t→∞limte−t=0,
where we used the equality limx→0+f(x1)=limt→∞f(t) (provided either limit exists).
Now we suppose that f+(k)(0)=0 for some n=k. By the definition of the derivative,
f+(k+1)(0)f+(k+1)(0)=x→0+limx−0f(k)(x)−f(k)(0)=x→0+limxf(k)(x)=x→0+limpk(1/x)⋅x1⋅e−1/x=t→∞limetpk(t)⋅t=0,
since et→∞ faster than any power (or polynomial) of t. This can also be seen by repeated use of L'Hospital's Rule or other methods.
Thus f+(k+1)(0)=0, and so f+(n)(0)=0 for all n∈N. Since we already know that f−(n)(0)=0, we can now conclude that f(n)(0)=0.
Thus the Taylor series for f centered at x=0 is
M(x)=n=0∑∞n!f(n)(0)xn=n=0∑∞0=0,
which is convergent ∀x∈R. But since f(x)=0 for x>0, no open interval around x=0 exists such that M(x)=0 is equal to f(x).