Tutorials › Calculus II › A Smooth Function Whose Taylor Series Misses Its Values

Taylor Series Construction · Tutorial 844 of 998

A Smooth Function Whose Taylor Series Misses Its Values

See how a function can be infinitely differentiable at zero while its Taylor series fails to capture its nearby nonzero values.

Intermediate 9 min read

What You'll Learn

  • Define the function that equals exp(−1/x²) away from zero and zero at zero.
  • Derive a recurrence describing all of its derivatives away from zero.
  • Prove that every derivative exists and vanishes at zero.
  • Find its Taylor series and compare it with the function’s actual values.
  • Explain why smoothness alone does not guarantee equality with a Taylor series.

A Taylor Series Need Not Recover Its Function

Taylor series often provide a way to describe a function near a chosen center using its derivatives there. The construction can suggest that knowing all the derivatives should determine the function. That conclusion requires care: even an infinitely differentiable function can have a Taylor series that does not represent it at nearby points.

A standard example is a function that is zero at the origin and decays extremely rapidly as the input approaches zero, while remaining positive at every other input. We will show that every derivative at the origin vanishes, so its Taylor series is the zero series, even though the function is not zero nearby.

Definition: Define \(f:\mathbb{R}\to\mathbb{R}\) by \(f(0)=0\) and \(f(x)=e^{-1/x^2}\) for \(x\ne 0\). A function is smooth (or \(C^\infty\)) if it has derivatives of every order and each of those derivatives is continuous.

For every \(x\ne 0\), the exponential \(e^{-1/x^2}\) is positive. The key question is what happens as \(x\) approaches zero: does the rapid decay overcome the powers of \(1/x\) that appear when differentiating?

The Derivatives Away from Zero

Repeated differentiation produces powers of \(1/x\) multiplied by the original exponential. To keep track of those powers, write \(u=1/x\). There are polynomials \(P_n\) such that, for every \(x\ne0\),

$$ f^{(n)}(x)=P_n(1/x)e^{-1/x^2}. $$

Here \(f^{(0)}=f\), \(P_0(u)=1\), and the polynomials are generated by a recurrence. To find it, differentiate the expression for the \(n\)th derivative. Since \(du/dx=-u^2\), the chain rule gives

$$ \begin{aligned} \frac{d}{dx}\left(P_n(u)e^{-u^2}\right) &=\left(P_n'(u)-2uP_n(u)\right)e^{-u^2}\frac{du}{dx}\\ &=\left(-u^2P_n'(u)+2u^3P_n(u)\right)e^{-u^2}. \end{aligned} $$

Thus the recurrence is \(P_{n+1}(u)=-u^2P_n'(u)+2u^3P_n(u)\). It describes the derivatives away from zero. We will separately prove that these formulas extend to actual continuous derivatives at zero.

Worked Example: Compute the First Two Derivatives Away from Zero

Start from \(P_0(u)=1\). The recurrence gives

$$ P_1(u)=-u^2(0)+2u^3(1)=2u^3. $$

Therefore \(f'(x)=2x^{-3}e^{-1/x^2}\) for \(x\ne0\). Apply the recurrence again:

$$ \begin{aligned} P_2(u) &=-u^2\frac{d}{du}(2u^3)+2u^3(2u^3)\\ &=-u^2(6u^2)+4u^6\\ &=-6u^4+4u^6. \end{aligned} $$

Consequently,

$$ f''(x)=\left(-\frac{6}{x^4}+\frac{4}{x^6}\right)e^{-1/x^2},\qquad x\ne0. $$

Check the second derivative by differentiating the first one. The product rule gives

$$ \begin{aligned} \frac{d}{dx}\left(2x^{-3}e^{-1/x^2}\right) &=-6x^{-4}e^{-1/x^2} +2x^{-3}e^{-1/x^2}(2x^{-3})\\ &=\left(-6x^{-4}+4x^{-6}\right)e^{-1/x^2}, \end{aligned} $$

which agrees with the recurrence.

Why the Exponential Overcomes Every Power

To handle derivatives at zero, we need a precise decay fact. For any polynomial \(P\) and any nonnegative integer \(q\),

$$ \lim_{x\to0}|x|^{-q}|P(1/x)|e^{-1/x^2}=0. $$

To prove this, let \(d\) be the degree of \(P\). For sufficiently large \(|u|\), there is a constant \(C>0\) such that \(|P(u)|\le C|u|^d\). Set \(t=1/x^2\), so \(t\to\infty\) as \(x\to0\). Then

$$ |x|^{-q}|P(1/x)|e^{-1/x^2} \le C t^{(q+d)/2}e^{-t}. $$

Choose an integer \(k>(q+d)/2\). The exponential series has positive terms for \(t>0\), so \(e^t\ge t^k/k!\). It follows that

$$ 0\le C t^{(q+d)/2}e^{-t} \le Ck!t^{(q+d)/2-k}\longrightarrow0. $$

The last limit holds because the exponent \((q+d)/2-k\) is negative. This proves the decay fact. In particular, the factor \(e^{-1/x^2}\) tends to zero faster than any fixed power of \(|x|\), even when additional powers arise from differentiation or difference quotients.

Every Derivative at Zero Vanishes

We can now establish smoothness, not merely guess it from the formulas away from zero. Define candidate functions \(g_n\) by \(g_n(0)=0\) and, for \(x\ne0\), \(g_n(x)=P_n(1/x)e^{-1/x^2}\). We prove inductively that \(f^{(n)}=g_n\), that \(g_n\) is continuous at zero, and that \(g_n(0)=0\).

1
Start with the function.
For \(n=0\), \(g_0=f\) because \(P_0=1\). The decay fact with \(P=1\) and \(q=0\) shows that \(f(x)\to0=f(0)\), so \(g_0\) is continuous at zero.
2
Differentiate at nonzero inputs.
If \(f^{(n)}=g_n\), the chain-rule calculation above shows that \(f^{(n+1)}(x)=g_{n+1}(x)\) for \(x\ne0\).
3
Check the derivative at zero.
The difference quotient for \(g_n\) at zero is \(g_n(h)/h\) when \(h\ne0\). The decay fact, with \(P=P_n\) and \(q=1\), shows that this quotient tends to zero. Thus \(g_n'(0)=0=g_{n+1}(0)\).
4
Check continuity of the next derivative.
The decay fact with \(P=P_{n+1}\) and \(q=0\) gives \(g_{n+1}(x)\to0=g_{n+1}(0)\). Thus \(g_{n+1}\) is continuous at zero, completing the induction.

This proves that derivatives of every order exist and are continuous, with

$$ f^{(n)}(0)=0\qquad\text{for every integer }n\ge0. $$

Worked Example: Find the Fourth-Degree Taylor Polynomial at Zero

The Taylor polynomial of degree four centered at zero is defined by

$$ T_4(x)=\sum_{j=0}^{4}\frac{f^{(j)}(0)}{j!}x^j. $$

The function value and all four derivatives used here are zero: \(f(0)=f'(0)=f''(0)=f^{(3)}(0)=f^{(4)}(0)=0\). Substitution therefore gives

$$ T_4(x)=0+0x+0x^2+0x^3+0x^4=0. $$

For a direct comparison, take \(x=1/2\). Then

$$ T_4(1/2)=0,\qquad f(1/2)=e^{-1/(1/2)^2}=e^{-4}>0. $$

Thus the polynomial does not give the function’s value at \(1/2\). The same reasoning applies to every Taylor polynomial degree: every coefficient is zero.

The Taylor Series and the Function Are Different

The Taylor series centered at zero is the formal series whose coefficients are \(f^{(n)}(0)/n!\). Since every one of these derivatives is zero, the series is

$$ \sum_{n=0}^{\infty}\frac{f^{(n)}(0)}{n!}x^n =\sum_{n=0}^{\infty}0x^n =0. $$

This series converges for every real \(x\), but its sum is the zero function. For any \(x\ne0\), the original function satisfies \(f(x)=e^{-1/x^2}>0\), so the series does not represent \(f\) at any nonzero point. In particular, there is no interval around zero on which the Taylor series equals the function.

Theorem: The function \(f(0)=0\), \(f(x)=e^{-1/x^2}\) for \(x\ne0\), is smooth and has Taylor series identically zero at zero. Nevertheless, that Taylor series fails to equal \(f(x)\) for every \(x\ne0\).

There is no contradiction: a Taylor series is built from the derivatives at its center, and smoothness guarantees that those derivatives exist. Smoothness alone does not guarantee that the function equals the sum of its Taylor series near the center. Functions with that stronger property are called real analytic; this example is smooth but not real analytic at zero.

Worked Example: Compare the Function with a Fourth-Power Scale

Although the function is nonzero near zero, it becomes smaller than \(x^4\) sufficiently close to zero. To show this, take \(x\ne0\), set \(t=1/x^2\), and suppose \(|x|<1/\sqrt{6}\). Then \(t>6\). The exponential series gives \(e^t\ge t^3/6\), and \(t^3/6>t^2\) because \(t>6\). Taking reciprocals of positive quantities yields

$$ 0<e^{-t}<\frac{1}{t^2}=x^4. $$

Since \(e^{-t}=f(x)\), we have \(0<f(x)<x^4\) for \(0<|x|<1/\sqrt{6}\). At \(x=0\), both \(f(x)\) and \(x^4\) are zero. This comparison illustrates how the function can be positive away from zero and still be smaller than a fourth power near zero. The decay fact proves the stronger statement that \(f(x)/|x|^N\to0\) for every nonnegative integer \(N\).

As a check at \(x=1/4\), the condition \(1/4<1/\sqrt{6}\) holds because \(1/16<1/6\). The conclusion is \(0<e^{-16}<1/256=(1/4)^4\), consistent with the bound.

A Common Mistake

A tempting but invalid conclusion is: “The function is smooth, so its Taylor series equals the function near the center.” The example supplies a direct counterexample. At \(x=1/2\), the Taylor series has value zero, while the function has value \(e^{-4}>0\). The error is treating existence of derivatives of all orders as if it guaranteed equality with the infinite series.

The correct conclusion is more limited: the derivatives determine the Taylor coefficients. To infer that the resulting series represents the function, one needs an additional property; smoothness by itself is not enough. This distinction matters whenever a Taylor series is used as a representation rather than simply constructed from derivatives.

Check Your Understanding

Use the definition of \(f\), its derivative recurrence, and the decay argument to answer these questions.

  1. What recurrence generates the polynomials \(P_n\) in the derivatives away from zero?
  2. Why does the difference quotient at zero for each derivative tend to zero?
  3. What is the Taylor series of \(f\) centered at zero, and where does it agree with \(f\)?
  4. Why does convergence of the Taylor series for every real input not imply that it represents \(f\)?
  5. How does the example distinguish smoothness from real analyticity?