Where Does the Taylor Expansion Come From?

— Following the derivation in the lecture notes “Taylor’s theorem” (for first- and second-year undergraduates)

Most formulas in physics are a Taylor expansion cut off somewhere. sin θ ≈ θ, E ≈ mc² + ½mv², “the bottom of a potential acts like a spring”: all of them are just this. So where does the formula of the Taylor expansion itself come from? Following the flow of the lecture notes, we will build it up one line at a time.

The crux of this derivation, up front The starting point is nothing but the fundamental theorem of calculus. Use it once and the first-order approximation comes out. But that first-order approximation works in the same way not only for f but also for f′. Substitute the first-order approximation of f′ back into the first integral and the second-order approximation comes out; substitute that again and the third order comes out, and so on — this nesting is what the Taylor expansion really is. No new tool is used at all. We just repeat the same single move (only in §5, where we turn the discarded part into an exact equality, do we borrow one theorem, the mean value theorem).

0. What Are We Proving?

If we supplement the Definition in the lecture notes so that it also guarantees the derivative at the endpoint a, it reads as follows. When the function f(x) and its derivatives f′, …, f(n) are continuous on the closed interval [a, X] and f(n+1) exists on the open interval (a, X), there exists some c (a < c < X) such that

(1) f(X)= f(a)+ f′(a)1! (X−a)+ f″(a)2! (X−a)2 +⋯+ f(n)(a)n! (X−a)n +Rn+1
(2) Rn+1= f(n+1)(c) (n+1)! (X−a)n+1
R is the error itself Rn+1 is called the Lagrange remainder. It is “the part that is missing because we truncated the series” packed together into a single term, not the tail of an infinite series. So in Eq. (1) the sign is = and not ≈ — Taylor’s theorem is an equality, not an approximation formula; that is the first important point.

Below, following the Explanation in the lecture notes, we rewrite X=a+h and proceed. h is “how far we have moved from the center.”

1. The Starting Point — The Fundamental Theorem of Calculus

We use just this one tool. If we integrate f′ from a to a+h, the increment of f comes out directly.

∫aa+h f′(x) dx= f(a+h)− f(a)

Rearranging gives

(3) f(a+h)= f(a)+ ∫aa+h f′(x) ⏟put the approximation here dx
Eq. (3) is exact No approximation has entered here yet. From here on there is only one thing to do — replace the contents of f′(x), marked by the brace, with better and better approximations, little by little. Each time we raise the accuracy of the replacement by one step, the order of the Taylor expansion goes up by one.

2. The First-Order Approximation — The Tangent Line

We start with the crudest replacement. If h is small, f is almost indistinguishable from its tangent line at a.

(4) f(a+h)≈ f(a)+ hf′(a) (first-order approximation)

Now, if we put x=a+h instead, we can eliminate h and write the result as an expression in x.

(5) f(x)≈ f(a)+ (x−a) f′(a)

Fig. 1. The figure “Imagine!!” from the lecture notes. How the error R of the tangent-line approximation becomes one quarter when h is halved. That R ∝ h² can be read off from the fact that R / h² in the numerical readout below the figure stays nearly constant.

3. Using the Same Move on f′ — The Second Order Is Born

This is the crux of the lecture notes. Eq. (5) is not an equation “about one particular function f.” It is an equation that can be used for any function that can be differentiated once. So we may put f′ in place of f.

(6) f′(x)≈ f′(a)+ (x−a) f″(a)

We put this into the brace in Eq. (3) and integrate in the straightforward way.

f(a+h)≈ f(a)+ ∫aa+h {f′(a)+ (x−a) f″(a)} dx

Inside the integral, f′(a) and f″(a) are just constants (they are values at a, so they do not depend on x). All we have to integrate are 1 and (x−a):

∫aa+h1 dx=h , ∫aa+h (x−a) dx= [(x−a)22] aa+h =h22

Therefore

(7) f(a+h)≈ f(a)+ hf′(a)+ h22! f″(a) (second-order approximation)

Again putting x=a+h, we get

(8) f(x)≈ f(a)+ f′(a) (x−a)+ f″(a)2! (x−a)2
Why 2! appears 2! does not come from “multiplying by 2”; it is the 1/2 that came out of integrating (x−a). In the next step, integrating (x−a)2/2 gives 1/6. The factorials in the denominators of the Taylor expansion are the footprints left by repeating the integration n times.

4. Once More, and Then n Times

The second-order approximation (8) that we have just obtained is also an equation that can be used for any function. So we apply it to f′ once more.

(9) f′(x)≈ f′(a)+ f″(a) (x−a)+ f‴(a)2! (x−a)2

We substitute this into Eq. (3) and integrate. This time the integral ∫aa+h(x−a)2dx=h3/3 is added, giving

(10) f(a+h)≈ f(a)+ hf′(a)+ h22! f″(a)+ h33! f‴(a) (third-order approximation)

The general step (mathematical induction)

The mechanism is now visible. Assume that “it is correct up to order n−1” and use it for f′:

f′(x)≈ ∑k=0n−1 f(k+1)(a)k! (x−a)k

Putting this into Eq. (3) and using ∫aa+h(x−a)kdx=hk+1/(k+1) we obtain

f(a+h)≈ f(a)+ ∑k=0n−1 f(k+1)(a)k! ·hk+1k+1 = f(a)+ ∑m=1n f(m)(a)m! hm

k!·(k+1)=(k+1)! holds, so just relabeling the index as m=k+1 makes the denominators line up neatly as m!. This is the formula of order n, and the induction has advanced by one step. Returning to x=a+h, we get

(11) f(x)≈ ∑n=0N f(n)(a)n! (x−a)n ≡ TN(x)
Only a single move has been used “Approximate by the tangent line” → “put that approximation back into the integral.” We merely repeated these two steps alternately. No new theorem and no clever manipulation is needed at all. The Taylor expansion is the fundamental theorem of calculus nested n times.

Another view — matching the derivatives

If we differentiate the finished Eq. (11) at x = a, something interesting turns up. TN(a)=f(a), TN′(a)=f′(a), …, and so on: all the derivatives up to order N agree with those of f (because differentiating (x−a)n n times gives n!, which exactly cancels the n! in the denominator). Conversely, there is only one “polynomial of degree N whose derivatives up to order N agree,” so the Taylor polynomial is determined uniquely by that condition alone.

5. The Remainder R — An Extension of the Mean Value Theorem

So far we have written everything with ≈. If we properly collect the part we have thrown away into a single term, we see the “bonus story” of the lecture notes — Taylor’s theorem is an extension of the mean value theorem.

Let the error be R=f(x)−TN(x). Fix x and consider the function in which the center is the variable

g(t)= f(x)− ∑k=0N f(k)(t)k! (x−t)k

Then g(x)=0 and g(a)=R. Differentiating this with respect to t, most of the terms in the sum cancel one another like a telescoping series, giving

(12) g′(t)= − f(N+1)(t)N! (x−t)N

Only one term survives. Now, taking φ(t)=(x−t)N+1 as a companion function and using Cauchy’s mean value theorem, for some c between a and x we get

g(x)−g(a) φ(x)−φ(a) = g′(c) φ′(c) ⟹ −R −(x−a)N+1 = f(N+1)(c) (N+1)!

(It is satisfying that (x−c)N cancels between the numerator and the denominator.) Tidying up gives exactly the Check! of the lecture notes.

(13) R= f(N+1)(c) (N+1)! (x−a)N+1 (c is between a and x)
Why is it an “extension of the mean value theorem”? Try putting N=0 in Eq. (13). f(x)=f(a)+f′(c)(x−a) — this is the mean value theorem itself. Taylor’s theorem is the mean value theorem lifted from the “first derivative” to the “(N+1)-th derivative.” The “bonus story” in the lecture notes refers to this fact.
It only says “exists” What the theorem guarantees is only that c exists somewhere; it does not tell us where. In practice, “the maximum of the absolute value of f(N+1)” is used to cap the remainder and obtain an upper bound. Tab ② of the simulator actually searches for that c numerically and displays it.

Fig. 2. The error R falls as hN+1. Both axes are logarithmic. The slope of each straight line is directly N+1 — when we truncate at order N, we can read by eye the power of h with which the error vanishes.

6. The Maclaurin Expansion — sin, cos, ex

What we get by setting a=0 is called the Maclaurin expansion. All that remains is to write down f(n)(0) one after another.

ff′f″f‴f(4)Values at 0
sin xsincos−sin−cossin 0, 1, 0, −1, 0, 1, …
cos xcos−sin−cossincos 1, 0, −1, 0, 1, 0, …
exexexexexex 1, 1, 1, 1, 1, 1, …

Just putting these into Eq. (11) gives three famous series.

(14) sin⁡x= x−x33! +x55! −⋯= ∑m=0∞ (−1)m (2m+1)! x2m+1
(15) cos⁡x= 1−x22! +x44! −⋯ ex= 1+x+ x22!+ x33!+⋯
Why sin has only odd-order terms sin is an odd function (f(−x)=−f(x)), so it must not have terms of even order. Indeed, as the table shows, f(0)=f″(0)=0 holds. If you choose sin in the simulator and raise the order, you will see that at even orders the band does not widen at all, and it jumps only at odd orders.

Bonus — Euler’s formula falls out

Into ex in Eq. (15), let us boldly put x=iθ. Since i2=−1, the sequence i0,i1,i2,i3,⋯=1,i,−1,−i,⋯ goes around with a period of 4. Collecting only the real parts gives the cos of Eq. (15), and collecting only the imaginary parts gives the sin of Eq. (14) — that is,

(16) eiθ= cos⁡θ+ isin⁡θ

The exponential function and the trigonometric functions, two things that look completely unrelated, have been connected. “We just split the same series into even and odd orders.” Wave functions, AC circuits, Fourier transforms — the fact that physics can use eiθ without hesitation is thanks to this one line.

7. How Far Can It Be Used? — The Radius of Convergence

It is not always true that N→∞ brings us back to f. The condition for getting back is that the remainder in Eq. (13) falls to 0 — nothing more.

FunctionContent of the remainderResult
sin x, cos x |f(N+1)|≤1 so |R|≤|x|N+1/(N+1)! Goes to 0 for any x (the factorial beats the exponential)
ex Bounded by the value at the end of the interval Likewise, converges everywhere
1/(1−x) The remainder is exactly xN+1/(1−x) Only for |x| < 1. Diverges outside

It is easy to accept that 1/(1−x) stops at x = 1: the function itself diverges there. But exactly the same thing happens for 1/(1+x²) — even though this function is smooth everywhere on the real axis, bounded, and has no place at all where it breaks down.

The answer lies in the complex plane 1/(1+z2) has a denominator that becomes 0 at z=±i. The distance from the origin to those points is 1. The radius of convergence equals the distance from the center of the expansion to the nearest singularity in the complex plane — this is a theorem of complex analysis that holds for functions that are holomorphic (differentiable in the complex sense) around the center of the expansion. (What gives the radius of convergence directly from the coefficients is the Cauchy–Hadamard formula 1/R = lim sup |cn|1/n; this is the one used in §10.) If we look only at the graph on the real axis, there is no way to see the reason why it stops at 1. The Taylor expansion is, at heart, a subject of complex analysis.

Fig. 3. Seeing the radius of convergence in the complex plane. The × marks are the singularities, and the blue circle is the circle of convergence |z − a| = R. The lower band is the real axis, and only the interval that the circle cuts out of the real axis is the “range of x where the series can be used.” As you move a, you can see the circle swell until it is just short of touching a singularity.

8. Even When It Converges, It May Not Return to the Original Function

There is one more reason why the remainder term cannot be ignored.

(17) f(x)= { e−1/x2  (x ≠ 0) 0 (x = 0)

This function can be differentiated any number of times. And yet at x = 0, the derivatives of every order are exactly 0 (because e−1/x2 goes to 0 faster than any power xn as x→0, that is, it still goes to 0 even when multiplied by (1/x)n). The Maclaurin expansion is then

TN(x)= 0+0·x+0·x2 +⋯=0 (independent of N)
The series converges. But not to f This series converges for any x (the radius of convergence is ∞). The limit is 0. On the other hand, f(1) = e−1 = 0.3679. The series and the function do not agree. The remainder R = f(x) − 0 = f(x) does not decrease at all, however much the order is raised.

In other words, “if you compute all the coefficients and build the series, you get back the original function” is itself a claim that needs proof. And proving it means showing that R→0. That is why the lecture notes have written Rn+1 into the formula from the very stage of the Definition.

9. Where It Matters in Physics

SituationExpansion usedWhat comes out of it
Simple pendulumsin θ ≈ θ The equation of simple harmonic motion, T = 2π√(L/g)
Near a stable equilibrium V(x) ≈ V(x0) + ½V″(x0)(x−x0)² Everything becomes a harmonic oscillator. Phonons, molecular vibrations
A quantity with a small correction (1+x)α ≈ 1 + αx (binomial approximation) √(1+x) for α = ½, 1/(1+x) for α = −1, and γ in the next row for α = −½
Relativity → Newtonian mechanics γ = 1 + ½β² + ⅜β⁴ + … E = mc² + ½mv² + …
Planck → classical x/(ex−1) = 1 − x/2 + x²/12 − … ⟨E⟩ = kBT (equipartition theorem, Rayleigh–Jeans)
Perturbation theoryExpand H = H0 + λV in λ First-order and second-order perturbation energies
Numerical computationFinite differences, Runge–Kutta, Simpson’s rule That the error falls as hN+1 is itself Eq. (13)

A concrete example of “near a stable equilibrium” is the Lennard-Jones potential in tab ③ of the simulator, V(r) = 4ε[(σ/r)12 − (σ/r)6]. Expanding around the bottom r0 = 21/6σ, we have V′(r0) = 0, so the expansion starts at second order, and V″(r0) is itself the spring constant. Moreover, the third-order term, which expresses the left–right asymmetry of the bottom, is the anharmonic term, the origin of thermal expansion. It is also a real example of an expansion whose center is not the origin (a ≠ 0).

The “small quantity” must be dimensionless β = v/c, x = hν/kBT, θ [rad], λ. None of them has a unit. “v is small” is meaningless (small compared to what?), but “v/c is small” is meaningful. Only when you can say what it is small compared to can you expand — this is the proper way to use a Taylor expansion in physics.

10. Checking Numerically

We checked by computer that the formulas so far really hold. The numbers below are the results of running the very code that is included in the simulator (124 items in total, all passed).

What was checkedResult
Eqs. (14), (15): do the coefficients c0…c9 of 9 functions, including sin, cos, and ex, agree with the textbook? Max. difference 6.1×10−16
Eq. (11): the analytic f(n) vs. numerical differentiation (Richardson extrapolation) Max. relative difference 4×10−5 (rounding floor)
Eq. (13): actual error ≤ Lagrange bound (9 functions × N = 0…10, 99 cases) All hold. Minimum of bound ÷ error: 1.013
Eq. (13): actually find the c that satisfies the equality and compare both sides Max. relative difference 2.0×10−15
Eq. (13): is N = 0 the mean value theorem itself? Agree in all 3 examples (10−9 or less)
Eq. (13): does the error fall as hN+1? (log–log slope, N = 0…5) 0.99, 2.04, 3.00, 4.02, 5.00, 6.02
Eq. (16): does putting x = iθ into the exp series give cos + i sin? Max. difference 2.2×10−16, real and imaginary parts of eiπ+1 each at most 2.4×10−16 in magnitude
§7: radius of convergence = distance to the complex singularity (the radius of convergence is computed with the Cauchy–Hadamard formula |cn|−1/n) Agree in all 6 cases (within 9 % at n = 60)
§7: is the remainder of 1/(1−x) exactly xN+1/(1−x)? 16 cases, within 1.8 times the rounding estimate
§8: for e−1/x², f(0)…f(30)(0) are all 0 and T40(1) = 0, yet f(1) = e−1 Error 0.3679 (constant, independent of N)
Claim of the teaching material: does the “range with error within 1 %” widen with N? (sin, N=1,3,5,9,15; 1 % is relative to the max|f| on the screen) 0.39 → 1.04 → 1.76 → 3.25 → 5.50
Same as above: for 1/(1−x), does it stay below 1 even when N is raised to 40? (N=1,5,15,40, the end on the side of the singularity x = 1) 0.24 → 0.57 → 0.78 → 0.89 (< 1)

11. Summary

  1. The starting point is the fundamental theorem of calculus alone. f(a+h)=f(a)+∫f′ is an exact equation, Eq. (3).
  2. The first-order approximation by the tangent line, Eq. (5), is not just for f; it can also be used for f′. Putting it back into the integral gives the second order, Eqs. (7), (8).
  3. Repeating the same move once more gives the third order, Eq. (10). In general, by induction, order n, Eq. (11). The factorials in the denominators are the footprints of repeated integration.
  4. Collecting the discarded part gives the Lagrange remainder, Eq. (13). N=0 is exactly the mean value theorem, and this is what the “bonus story” of the lecture notes is about.
  5. The Maclaurin expansion (a = 0) gives sin, cos, and ex, Eqs. (14), (15), and putting x=iθ into the exponential makes Euler’s formula fall out, Eq. (16).
  6. The range of use (the radius of convergence) is determined by the distance to the nearest singularity in the complex plane. That is why 1/(1+x²), though unscathed on the real axis, breaks down for |x| > 1.
  7. That a series converges and that it returns to the original function are different things, Eq. (17). What guarantees the return is always, and only, the remainder term R → 0.

Mochizuki Research Group, Tokyo University of Science / from the lecture notes “(21) Taylor’s theorem.” The proof by Cauchy’s mean value theorem in §5, the radius of convergence in §7, and the counterexample in §8 supplement what lies beyond the scope of the notes. The numerical checks use direct double-precision computation, numerical differentiation by Richardson extrapolation, and the n-th root of the Cauchy–Hadamard formula. If you want to check things on a graph, go to the simulator. The formulas are typeset with the browser’s standard MathML (no external libraries and no network communication at all).