Gregory Friedman The Greg Wide Web on the name →

Case Study · Math · Analysis

Onto the Curve: Taylor Series, Term by Term

2026

The idea

Here is one of the quietly astonishing facts of calculus. If you know a smooth function’s value at a single point, and its slope there, and its curvature, and the rate the curvature changes, and so on through every derivative, then for a great many functions you know the whole function. Not near the point, the whole thing. All the information spread across the graph has been folded back into an infinite list of numbers taken at one spot.

The recipe that unfolds it is the Taylor series. Around x=0x = 0 (the Maclaurin case, which is all either plate uses) it reads

f(x)  =  ∑n=0∞f(n)(0)n! xn  =  f(0)+f′(0) x+f′′(0)2 x2+f′′′(0)6 x3+⋯f(x) \;=\; \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}\, x^{n} \;=\; f(0) + f'(0)\,x + \frac{f''(0)}{2}\,x^{2} + \frac{f'''(0)}{6}\,x^{3} + \cdots

Each term is a correction: the constant matches the height, the linear term matches the slope, the quadratic bends the line into the curve, and every term after tunes a finer wiggle. Cut the sum off after NN terms and you have a polynomial PN(x)P_N(x), the best polynomial of its degree for hugging the curve near zero. The question the first plate is built to make visible is what happens as NN grows: does PNP_N close in on ff across the whole picture, or only on part of it?

The approach

The first plate carries five functions whose series are worth knowing by heart:

ex=∑n≥0xnn!,sin⁡x=∑k≥0(−1)kx2k+1(2k+1)!,cos⁡x=∑k≥0(−1)kx2k(2k)!,e^{x} = \sum_{n\ge 0}\frac{x^{n}}{n!}, \quad \sin x = \sum_{k\ge 0}\frac{(-1)^{k}x^{2k+1}}{(2k+1)!}, \quad \cos x = \sum_{k\ge 0}\frac{(-1)^{k}x^{2k}}{(2k)!}, ln⁡(1+x)=∑k≥0(−1)kxk+1k+1,11−x=∑k≥0xk.\ln(1+x) = \sum_{k\ge 0}\frac{(-1)^{k}x^{k+1}}{k+1}, \quad \frac{1}{1-x} = \sum_{k\ge 0} x^{k}.

The first three are entire: their series converge for every real xx, so as you drag the term count up, the green partial sum swings out to meet the true curve farther and farther from the origin, and the fit never stops improving. The last two are different. Both have a radius of convergence of exactly 11, drawn as the pair of dashed vertical lines, and outside that band the partial sums do not just approximate badly, they run off to infinity while the true function sits there perfectly smooth. Watching PNP_N for 1/(1−x)1/(1-x) blow up to the left of x=−1x = -1, where ff is a calm 0.30.3, is the whole lesson of the radius in one image.

A note on the arithmetic. Summing xn/n!x^{n}/n! directly overflows the factorial fast, so neither plate ever forms a factorial. Each carries a term from the last by a ratio: for exe^{x} the step is tn=tn−1⋅x/nt_{n} = t_{n-1}\cdot x/n, for the trig series it folds in the −x2-x^{2} that turns one term into the next, and so on. That keeps every partial sum exact to double precision out to the term cap, which is what lets the reported error fall to 10−1510^{-15} for eˣ before floating point, not the mathematics, sets the floor. The idea (and the appetite for watching a series converge one term at a time) comes from a small Java routine I wrote years ago that summed configurable numbers of Taylor terms for the exponential and the trig functions; this is that experiment rebuilt as a picture.

Partial sums of the Maclaurin series for e to the x at x = 1, converging to e.
terms NPₙ(1)error vs e
1 1.000000 1.7e+0
2 2.000000 7.2e-1
4 2.666667 5.2e-2
8 2.718254 2.8e-5
Terms N
4

Plate I Taylor partial sums against the true function. Pick a function and raise the term count N; the green curve is the degree-(N−1) partial sum Pₙ(x), the faint curve is the true f(x), the ochre dot marks the expansion point at x = 0, and the axes are labelled with ticks. For eˣ, sin, and cos the fit widens with every term. For ln(1+x) and 1/(1−x) the dashed lines mark the radius of convergence of 1: inside it the polynomial closes in, outside it diverges while the true curve stays smooth. The readout gives the partial sum against the function at a sample point and the largest error across the convergence interval.

The radius is not an accident of these two examples; it is a shadow cast from the complex plane. A real function like 1/(1−x)1/(1-x) looks flawless on the real line except at x=1x = 1, where it has a pole, and ln⁡(1+x)\ln(1+x) is fine except at x=−1x = -1, where it dives to negative infinity. The Taylor series cannot see the real line in isolation: it converges in a disk around the expansion point whose radius reaches exactly to the nearest place the function misbehaves anywhere in the complex plane. The two singularities sit at distance 11 from the origin, so the radius is 11, and the real interval (−1,1)(-1, 1) is that disk seen edge-on. The entire functions have no singularity anywhere, so their disk is the whole plane, which is why eˣ and the trig series converge everywhere.

Where the fact fails

The opening claim carried a hedge, and the hedge is where the mathematics is. For a great many functions you can rebuild the whole graph from derivatives at a point; for the rest you cannot, and the rest are not exotic. Every specimen in the plate below is infinitely differentiable at every real number, with no corner, no jump, and no vertical asymptote anywhere on the line. Each one breaks the recipe anyway, and the three break it in two different ways.

The first way is the more unsettling, because nothing diverges at all. Take

f(x)={e−1/x2,x≠00,x=0,f(x) = \begin{cases} e^{-1/x^{2}}, & x \neq 0 \\ 0, & x = 0, \end{cases}

a smooth, gentle bump that sits flat against the axis near the origin and climbs toward 11 in both directions. Differentiate it and every derivative comes out as some polynomial in 1/x1/x multiplied by e−1/x2e^{-1/x^{2}}, and that exponential goes to zero faster than any power of 1/x1/x can grow. So every derivative at the origin is exactly 00. Feed those into the recipe and the Maclaurin series is 0+0⋅x+0⋅x2+⋯0 + 0\cdot x + 0\cdot x^{2} + \cdots, the zero polynomial, for every NN you ask for. The series converges beautifully. It converges for every real xx, absolutely, instantly, and it converges to the wrong function. Smoothness is not analyticity, and this is the standard counterexample that separates them.

The second way is the radius again, arriving where nothing on the real line asked for it. The function 1/(1+x2)1/(1+x^{2}) is bounded by 11, defined everywhere, and as well behaved as anything on this page, and its series still quits at ∣x∣=1|x| = 1. Squeeze the bump and it gets worse: 1/(1+25x2)1/(1+25x^{2}) has radius 0.20.2, so the polynomial that is supposed to know the whole function knows a fifth of the unit interval. The reason is the one the previous section gave. The poles of 1/(1+x2)1/(1+x^{2}) sit at ±i\pm i, and those of 1/(1+25x2)1/(1+25x^{2}) at ±i/5\pm i/5: off the real line entirely, invisible from the line, and setting the radius from there.

That explanation covers the flat bump too, which is why the second plate draws both panels side by side. Follow e−1/z2e^{-1/z^{2}} up the imaginary axis instead of along the real one, at z=iyz = iy, and the exponent becomes −1/(iy)2=+1/y2-1/(iy)^{2} = +1/y^{2}. The function does not settle down to zero as you approach the origin; it runs to infinity. The origin is an essential singularity, the disk of convergence has radius zero, and the smoothness on the real line was an artifact of approaching a bad point along the one direction that hides it.

Three smooth real functions, the nearest singularity of each in the complex plane, the resulting radius of convergence, and where the Maclaurin series actually equals the function.
specimen nearest singularity radius series equals f
e^(−1/x²) essential, at 0 itself 0 never: Pₙ ≡ 0
1/(1+x²) ±i 1 only on (−1, 1)
1/(1+25x²) ±i/5 0.2 only on (−0.2, 0.2)
Terms N
6

On the real line

In the complex plane

Plate II Three smooth functions the recipe cannot rebuild. Pick a specimen and raise N; the left panel is the real line, with the faint curve the true ff and the green curve the partial sum PNP_N, and the right panel is the complex plane the radius actually lives in. The ochre crosses are the singularities, the dashed circle is the disk of convergence they set, and the green segment along the real axis is that disk seen edge-on, which is all the left panel can ever show. For e−1/x2e^{-1/x^2} the green curve never leaves the axis at any N, because every derivative at the origin is zero: the series converges everywhere, to the wrong function, and the disk has radius zero. For 1/(1+x2)1/(1+x^2) and 1/(1+25x2)1/(1+25x^2) nothing on the real line goes wrong at all, and the radius is set from off the line by poles at ±i\pm i and ±i/5\pm i/5.

The practical moral is a small shift in what you ask for. “Does the series converge?” is the wrong question, because the flat bump answers yes and is no help. The question is whether the remainder goes to zero, that is whether f(x)−PN(x)→0f(x) - P_N(x) \to 0 as NN grows, which is a claim about the gap rather than about the terms. For eˣ and the trig functions it does, everywhere, which is the promise the word entire is making. For the flat bump the remainder is f(x)f(x) itself at every NN, unchanged and unbudging, which is exactly what the readout reports when you drag the slider and watch a number refuse to move.

What I would build next

The first plate plots the partial sum and the true function and lets you read the gap between them, but it does not draw the remainder as its own object. Taylor’s theorem gives that gap a formula, the Lagrange remainder RN(x)=f(N)(ξ) xN/N!R_N(x) = f^{(N)}(\xi)\,x^{N}/N! for some ξ\xi between 00 and xx, and a natural next version would shade the guaranteed error band around PNP_N so the reader sees not just that the fit is good but why it is provably good. The error I report is the measured maximum over the convergence interval, which is the empirical truth; the theorem’s bound is the companion claim I have not yet drawn.

Two limits sit at the edges. The expansion point is pinned at x=0x = 0 in both plates; the richer picture lets you slide the point aa and watch the disk of convergence travel with it, which is where Taylor series stop feeling like a party trick for nice functions and start being a local tool you aim. Under that change the second plate gets sharper rather than redundant, because sliding aa toward a pole is how you watch a radius shrink to nothing in real time.

The counterexamples have a plate of their own, Plate II, which is the half of the story that keeps the astonishing fact from turning into a superstition. One cautionary tale it still does not draw, and I want to be exact about which: Runge’s phenomenon is a statement about interpolation, that a high-degree polynomial pinned through equally spaced samples of 1/(1+25x2)1/(1+25x^{2}) oscillates violently near the ends of the interval. Plate II shows the same function failing as a Taylor series, which is a different mechanism with the same underlying cause (poles at ±i/5\pm i/5, close to the real axis and invisible from it). Drawing the interpolation version needs a node sampler and a Lagrange basis rather than a term-by-term recurrence, so it is its own figure, and putting the two side by side (same function, two ways of failing, one explanation) is the version of this page I would build next.

This figure belongs to the same family as the rest of the approximation work on the site: the continued-fractions plate asks the same “how close, how fast” question for rationals instead of polynomials, the Fourier plate rebuilds a function from circles rather than from derivatives, and Newton’s method is the iteration that a truncated Taylor series, kept to first order, is secretly doing.

Keys on this page

A figure's keys are its own: they answer once the figure has focus, so tab to it or click it first. Esc closes this sheet.