Skip to content

Power series

Level: 201 · for anyone who has read velocity equals position

One line: If e^x is a polynomial that never ends, the rule "velocity = position" forces every one of its coefficients, 1/k!; the sums reach e in a dozen terms, and with an imaginary input the terms split into the series for cos and sin, which is Euler's formula read off a list of fractions.

The talk's other road

The talk takes a second road to e^{πi} = −1. It writes

e^x  =  1 + x + x²/2 + x³/6 + x⁴/24 + ⋯ + xⁿ/n! + ⋯

puts x = πi in, and draws the terms as arrows laid end to end, each one turning a quarter turn from the one before, spiralling in onto −1. That picture is section 8 of Euler's identity. This page is about the line above it: where the series comes from, and why its coefficients are 1, 1, 1/2, 1/6, 1/24.

What the program prints

Verified output of power_series.py — regenerated by tools/run_examples.py, never hand-typed.

1. THE COEFFICIENTS ARE FORCED
   Matching f = a0 + a1 x + a2 x^2 + ... with its derivative, term by
   term, gives ak = a(k-1) / k. Starting from e^0 = a0 = 1:
     a0 = 1        = 1/0!
     a1 = 1        = 1/1!
     a2 = 1/2      = 1/2!
     a3 = 1/6      = 1/3!
     a4 = 1/24     = 1/4!
     a5 = 1/120    = 1/5!
     a6 = 1/720    = 1/6!
     a7 = 1/5040   = 1/7!
     a8 = 1/40320  = 1/8!
   So e^x = 1 + x + x^2/2 + x^3/6 + x^4/24 + ... + x^k/k! + ...

2. EACH TERM'S DERIVATIVE IS THE TERM BEFORE IT
     S6(x)  = 1 + x + x^2/2 + x^3/6 + x^4/24 + x^5/120 + x^6/720
     S6'(x) = 1 + x + x^2/2 + x^3/6 + x^4/24 + x^5/120
     S5(x)  = 1 + x + x^2/2 + x^3/6 + x^4/24 + x^5/120
   S6' = S5: True. The derivative of the sum up to x^6
   is the sum up to x^5: every term moves down one place. The sum that
   never stops is its own derivative.

3. AT x = 1 THE SUMS REACH e, FAST
     terms 0..0   sum = 1                      = 1.0000000000
     terms 0..1   sum = 2                      = 2.0000000000
     terms 0..2   sum = 5/2                    = 2.5000000000
     terms 0..3   sum = 8/3                    = 2.6666666667
     terms 0..4   sum = 65/24                  = 2.7083333333
     terms 0..5   sum = 163/60                 = 2.7166666667
     terms 0..6   sum = 1957/720               = 2.7180555556
     terms 0..9   sum = 98641/36288            = 2.7182815256
     terms 0..12  sum = 260412269/95800320     = 2.7182818283
     e                                         = 2.7182818285
   Thirteen terms give nine correct decimals: the term 1/k! shrinks
   faster than any power of 10. Compounding, (1 + 1/n)^n, needed
   n = 10^5 steps for four.

4. OTHER x: THE TERMS MAY GROW BEFORE THEY SHRINK
     x      largest term         sum of 40 terms    e^x, from math.exp
     2      x^1/1! = 2.000       7.389056           7.389056
     -1     x^0/0! = 1.000       0.367879           0.367879
     5      x^4/4! = 26.042      148.413159         148.413159
     10     x^9/9! = 2755.732    22026.465795       22026.465795
   Each term is the one before times x/k, so the terms grow while k is
   less than x and shrink after. The sum still settles, for every x.

5. PUT IN it: THE TERMS SPLIT INTO cos AND sin
   (it)^k cycles through 1, i, -1, -i as k counts up, so the even terms
   are real and the odd ones imaginary:
     real part       1 - t^2/2 + t^4/24 - t^6/720 + t^8/40320 ...
     imaginary part  t - t^3/6 + t^5/120 - t^7/5040 ...
   Summed with 30 terms, they are the cosine and the sine, in radians:
     t      cos series   math.cos     sin series   math.sin
     1      0.540302     0.540302     0.841471     0.841471
     pi/2   0.000000     0.000000     1.000000     1.000000
     pi     -1.000000    -1.000000    0.000000     0.000000
     2      -0.416147    -0.416147    0.909297     0.909297
   So e^(it) = cos t + i sin t, Euler's formula, as a fact about
   coefficients.

6. THE DERIVATIVES OF sin AND cos, TERM BY TERM
     d/dt sin t = 1 - t^2/2 + t^4/24 - t^6/720 + t^8/40320 ...
     cos t      = 1 - t^2/2 + t^4/24 - t^6/720 + t^8/40320 ...
   equal: True
     d/dt cos t = -t + t^3/6 - t^5/120 + t^7/5040 ...
     -sin t     = -t + t^3/6 - t^5/120 + t^7/5040 ...
   equal: True
   The same facts the radians lesson measured, now read off the lists.
   The series speak radians: t in them is the arc length.

The coefficients are forced

Suppose e^x can be written as a polynomial that never ends, a₀ + a₁x + a₂x² + a₃x³ + ⋯. The derivative of x^k is k x^(k−1) (the case k = 2 is d/dt t² = 2t), so differentiating term by term gives a₁ + 2a₂x + 3a₃x² + ⋯. The rule from velocity equals position says the two lists are the same function, so they match coefficient by coefficient:

a₁ = a₀        2a₂ = a₁        3a₃ = a₂        …        k·aₖ = aₖ₋₁

With e⁰ = 1, a₀ = 1, and then there is no choice left: a₁ = 1, a₂ = 1/2, a₃ = 1/6, a₄ = 1/24, and aₖ = 1/k!. Section 1 builds them as exact fractions from the rule alone. Section 2 checks the reason: differentiate the sum up to x⁶ and the result is exactly the sum up to x⁵. Each term's derivative is the term before it, so the sum that never stops is its own derivative.

At x = 1 the sums reach e, fast

Section 3 adds the terms at x = 1: 1, 2, 5/2, 8/3, 65/24, and by thirteen terms 2.7182818283, nine correct decimals. Compounding, (1 + 1/n)ⁿ, needed a hundred thousand steps for four. The terms 1/k! shrink faster than any power of 10, which is why a calculator computes e^x from a series and not by compounding.

Section 4 tries other x. Each term is the one before it times x/k, so the terms grow while k is less than x and shrink after: at x = 10 the largest is 10⁹/9! ≈ 2756, and forty terms still land on e¹⁰ = 22026.47. That growing-then-shrinking is the talk's spiral: at x = πi each arrow is the one before it times πi/k, a quarter turn and a scaling by π/k, so the arrows grow up to k = 3 and then shrink ever faster.

Put in it: cos and sin fall out

Section 5 puts an imaginary number in. The powers of i cycle through 1, i, −1, −i, which is the quarter turn four times round, so the even terms of e^{it} are real with alternating signs and the odd terms are imaginary with alternating signs:

real part        1 − t²/2 + t⁴/24 − t⁶/720 + ⋯          = cos t
imaginary part   t − t³/6 + t⁵/120 − t⁷/5040 + ⋯        = sin t

Summed with thirty terms they agree with math.cos and math.sin to six places at t = 1, π/2, π and 2. So e^{it} = cos t + i sin t, Euler's formula, as a fact about coefficients. Section 6 differentiates the two lists term by term and finds d/dt sin t = cos t and d/dt cos t = −sin t, the facts radians measured on a turning point: the series speak radians, because the t in them is the arc length.

What this page does not prove

It assumed that e^x can be written as a series, and it checked, rather than proved, that the series settles on a number for every x and that the number is the e^x of the motion. Those are theorems, the subject of a chapter called "Taylor series" or "Power series" in a second calculus course, and the books in where this is taught prove them. What this page shows is why the coefficients could not have been anything else.

Run it yourself

From the root of your clone of this repository:

python3 09_Calculus/power_series/examples/power_series.py

Po polsku, w skrócie

Załóżmy, że eˣ da się zapisać jako wielomian, który się nie kończy: a₀ + a₁x + a₂x² + ⋯. Pochodna liczona wyraz po wyrazie to a₁ + 2a₂x + 3a₃x² + ⋯, a reguła „prędkość = położenie" każe obu listom być równymi, więc k·aₖ = aₖ₋₁. Z e⁰ = 1 wynika a₀ = 1 i dalej nie ma już wyboru: aₖ = 1/k!. Pochodna każdego wyrazu to wyraz poprzedni, więc suma bez końca jest swoją własną pochodną. Trzynaście wyrazów daje e z dziewięcioma poprawnymi cyframi po przecinku; procent składany potrzebował stu tysięcy kroków na cztery.

Po wstawieniu it potęgi i krążą: 1, i, −1, −i, więc wyrazy parzyste są rzeczywiste, a nieparzyste urojone. Część rzeczywista to szereg cos t, a urojona to szereg sin t, i stąd e^{it} = cos t + i sin t, wzór Eulera odczytany ze współczynników. Na wykładzie te wyrazy to strzałki, każda obrócona o 90° względem poprzedniej, które najpierw rosną, a potem maleją i zwijają się w spiralę kończącą się w −1.

Auf Deutsch: Stichwörter

„Geschwindigkeit = Ort“ erzwingt jeden Koeffizienten von eˣ = 1 + x + x²/2 + x³/6 + ⋯, und cos und sin fallen heraus.

Stichwörter: Potenzreihe, Taylorreihe, Koeffizient, Fakultät, Exponentialreihe, Sinus- und Kosinusreihe, Konvergenz, Partialsumme.

See also