Monocurl Essays
Series Download

Euler's formula: why e^(iπ) = -1

You cannot multiply e by itself iπ times, so the famous equation needs a definition first. Compound interest supplies one, and it leads around a circle.

22 min·High school·

AssumesComplex numbers: why multiplying by i is a quarter turnCompound interest and where e comes fromRadians: measuring an angle by the arc it cuts

The number $\left(1 + \frac{i\pi}{n}\right)^n$ is reached from 1 by $n$ multiplications, drawn here as a path with $n$ straight steps. As $n$ doubles from 1 to 64 the path settles onto the upper half of the unit circle (dashed) and its end closes in on $-1$.
Monocurl source
let LV = [1, 2, 4, 8, 16, 32, 64]
let CH = map(LV, |n| chain(PI, n))
# each chain with a midpoint added to every step, so it can morph into the next
let SPLIT = block {
    for (l in range(0, 6)) {
        let c = CH[l]
        var pts = []
        for (j in range(0, len(c) - 1)) {
            pts .= c[j]
            pts .= lerp(c[j], c[j + 1], 0.5)
        }
        pts .= c[len(c) - 1]
        . pts
    }
}
let Scene = |lv| {
    let l = min(to_int(floor(lv + 0.0001)), 6)
    let f = lv - l
    var pts = CH[l]
    if (f > 0.001) {
        let a = SPLIT[l]
        let b = CH[l + 1]
        pts = block {
            for (j in range(0, len(b))) {
                . lerp(a[j], b[j], f)
            }
        }
    }
    let end = pts[len(pts) - 1]
    let n = 2 ^ min(to_int(floor(lv + 0.5)), 6)
    return [
        ChainMesh(O, U, pts, EMBER, 3.5, lv < 4.5),
        Pt(P(end), EMBER, 0.11),
        center{[RX, 0.3, 0]} scale{1.3} color{EMBER} Number(n, 0),
        center{[RX - 0.75, -0.95, 0]} scale{1.1} color{EMBER} Number(end[0], 2),
        center{[RX + 0.45, -0.95, 0]} scale{1.1} color{EMBER} Number(end[1], 2, 1)
    ]
}
mesh stage = Stage
mesh labels = [
    center{[RX, 1.5, 0]} Math("\left(1 + \frac{i\pi}{n}\right)^{n}", 1.0, INK),
    center{[RX, 0.78, 0]} Note("number of steps n", 0.74),
    center{[RX, -0.45, 0]} Note("the path ends at", 0.74),
    center{[RX + 1.12, -0.95, 0]} Math("i", 1.0, EMBER)
]
mesh start = Pt(P([1, 0]), LEAF, 0.09)
mesh picture = Scene(lv: 0)
mesh payoff = []

slide "limit"
    play Wait(0.8)
    for (l in range(1, 7)) {
        picture.lv = l
        play Lerp(0.9, [&picture])
        play Wait(0.35)
    }
    payoff = center{[RX, -1.65, 0]} Math("e^{i\pi} = -1", 1.2, LEAF)
    play Fade(0.5, [&payoff])
    play Wait(2)

Uses the shared definitions for this lesson's figures.

The equation $e^{i\pi} = -1$ is printed on mugs and T-shirts, and it deserves a harder look than a mug invites. A power means repeated multiplication: $e^3$ is $e \cdot e \cdot e$. Nobody can multiply $e \approx 2.718$ by itself $i\pi$ times, so before asking whether the equation is true we have to ask what its left side means.

The honest answer is that someone has to decide. The symbol $e^{i\pi}$ has no meaning until it is given one by a definition, and once it has one, “$e^{i\pi} = -1$” becomes a theorem about that definition, which can be proved. This lesson makes the definition, explains why it is the natural one, and proves the theorem. The proof gives more than one equation. For every real number $\theta$ it gives Euler’s formula, $e^{i\theta} = \cos\theta + i\sin\theta$.

A description of e to the x that survives a complex x

We need a way of computing $e^x$ that does not involve “multiplying $x$ times”. The lesson on compound interest found one. A dollar earning interest at rate $x$ per year, paid in $n$ equal instalments, is multiplied by $1 + \frac{x}{n}$ at each payment and is worth $\left(1 + \frac{x}{n}\right)^n$ at the end of the year. As the payments become more frequent this approaches a ceiling, and the ceiling is $e^x$:

$$ \lim_{n \to \infty}\left(1 + \frac{x}{n}\right)^n = e^x \qquad \text{for every real number } x. $$

Look at what the left side asks us to do: divide $x$ by a whole number, add 1, and multiply the result by itself $n$ times, where $n$ is a whole number. The exponent $x$ has moved inside the bracket, and the only power left is a whole-number power. All of these operations make sense for complex numbers, which are the points $a + bi$ of the plane, multiplied by the rule $(a + bi)(c + di) = (ac - bd) + (ad + bc)i$ that comes from $i^2 = -1$.

So let us put $x = i\pi$ into the left side and compute. With $n = 1$ there is nothing to multiply: the value is $1 + i\pi \approx 1 + 3.14i$, which is nowhere near $-1$.

Pause and try

Compute the case $n = 2$, that is $\left(1 + \frac{i\pi}{2}\right)^2$, by multiplying out. Use $\pi^2 \approx 9.87$. Is it closer to $-1$ than $1 + i\pi$ was?

Show answerHide answer

$\left(1 + \frac{i\pi}{2}\right)^2 = 1 + 2 \cdot \frac{i\pi}{2} + \frac{i^2\pi^2}{4} = \left(1 - \frac{\pi^2}{4}\right) + i\pi \approx -1.47 + 3.14i$. Its real part has moved past $-1$, but it is just as high above the real axis as before, so its distance from $-1$ has only fallen from about $3.72$ to about $3.18$.

Here are more values, computed the same way (by machine, for the larger $n$).

$n$$\left(1 + \frac{i\pi}{n}\right)^n$
1$1.000 + 3.142i$
2$-1.467 + 3.142i$
4$-2.321 + 1.204i$
10$-1.593 + 0.156i$
100$-1.051 + 0.001i$
1000$-1.005 + 0.000i$

The values wander through the plane and then close in on $-1$. The table shows that it happens and gives no hint of why. For that we have to watch the multiplications one at a time.

One multiplication is a small turn and a small stretch

Take any complex number $z$ and multiply it by $1 + \frac{i\pi}{n}$:

$$ z\left(1 + \frac{i\pi}{n}\right) = z + \frac{\pi}{n}\,(iz). $$

Multiplying by $i$ is a quarter turn about 0, so $iz$ is as long as $z$ and at a right angle to it. The new point is therefore the old point plus a step sideways: at a right angle to the line from 0 to $z$, of length $\frac{\pi}{n}$ times the distance of $z$ from 0. Here is $n = 4$, where each step is $\frac{\pi}{4} \approx 0.79$ times the current distance.

  1. Start at 1 and multiply by 1 + iπ/4. That adds a step of length 0.79 straight up, at a right angle to the line from 0. The point is now 1.27 from 0.
  2. Multiply again. The step is again at a right angle to the line from 0, and 0.79 times as long as that line. The new triangle is the old one, turned and enlarged.
  3. A third multiplication. Each one turns the point through the same angle, 0.67 radians, and multiplies its distance from 0 by the same factor, 1.27.
  4. After four multiplications the point is 2.61 from 0, at an angle of 2.66 radians. We were hoping for distance 1 and angle π = 3.14.
The four multiplications that make up $\left(1 + \frac{i\pi}{4}\right)^4$. Each adds a step at a right angle to the line from 0, so each builds a right triangle on the previous one. The four triangles have the same shape.
Monocurl source
let Z4 = chain(PI, 4)
let T4 = arctan(PI / 4)
let Corner = |a, b, c, s = 0.15| {
    let d1 = s * normalize(a - b)
    let d2 = s * normalize(c - b)
    return stroke{SLATE, 2} Polyline([b + d1, b + d1 + d2, b + d2])
}
let Step = |k| [
    Shape([O, P(Z4[k - 1]), P(Z4[k])], AZURE, 0.12, 2),
    Corner(O, P(Z4[k - 1]), P(Z4[k])),
    Seg(P(Z4[k - 1]), P(Z4[k]), EMBER, 4.5),
    Pt(P(Z4[k]), EMBER, 0.09)
]
let Read = |k| [
    center{[RX, 0.5, 0]} Note("distance from 0", 0.74),
    center{[RX, 0.0, 0]} Math(to_string(cabs(Z4[k]), 2), 1.1, AZURE),
    center{[RX, -0.8, 0]} Note("angle, in radians", 0.74),
    center{[RX, -1.3, 0]} Math(to_string(k * T4, 2), 1.1, LEAF),
    ArcAt(O, 0.4, 0, k * T4, LEAF, 3.5)
]
mesh stage = Stage
mesh title = [
    center{[RX, 1.75, 0]} Note("each step multiplies by", 0.74),
    center{[RX, 1.2, 0]} Math("1 + \frac{i\pi}{4}", 0.95, INK)
]
mesh tris = []
mesh start = Pt(P([1, 0]), LEAF, 0.09)
mesh readout = []

slide "Start at 1 and multiply by 1 + iπ/4. That adds a step of length 0.79 straight up, at a right angle to the line from 0. The point is now 1.27 from 0."
    tris .= Step(1)
    readout = Read(1)
    play Fade(0.8, [&tris, &readout])

slide "Multiply again. The step is again at a right angle to the line from 0, and 0.79 times as long as that line. The new triangle is the old one, turned and enlarged."
    readout = []
    play Fade(0.3, [&readout])
    tris .= Step(2)
    readout = Read(2)
    play Fade(0.8, [&tris, &readout])

slide "A third multiplication. Each one turns the point through the same angle, 0.67 radians, and multiplies its distance from 0 by the same factor, 1.27."
    readout = []
    play Fade(0.3, [&readout])
    tris .= Step(3)
    readout = Read(3)
    play Fade(0.8, [&tris, &readout])

slide "After four multiplications the point is 2.61 from 0, at an angle of 2.66 radians. We were hoping for distance 1 and angle π = 3.14."
    readout = []
    play Fade(0.3, [&readout])
    tris .= Step(4)
    readout = Read(4)
    play Fade(0.8, [&tris, &readout])

Uses the shared definitions for this lesson's figures.

From here on, angles are measured in radians: the size of an angle is the length of the arc it cuts from a circle of radius 1. A full turn is $2\pi \approx 6.28$, a half turn is $\pi$, a right angle is $\frac{\pi}{2}$. The reason for the switch is in the figure. The first step has length $\frac{\pi}{4} \approx 0.785$ and turns the point through $0.666$ radians, two numbers that are suspiciously close, and with degrees ($38.1^\circ$) the kinship would be invisible.

The lesson on complex numbers proved that multiplication is a stretch together with a turn. Every complex number $w \ne 0$ has a modulus $|w|$, its distance from 0, and an argument, the angle from the positive real axis to the direction of $w$; when two numbers are multiplied, their moduli multiply and their arguments add. Our multiplier $w = 1 + \frac{i\pi}{n}$ is the point one unit right and $\frac{\pi}{n}$ up, so

$$ |w| = \sqrt{1 + \frac{\pi^2}{n^2}}, \qquad \text{argument of } w = \arctan\frac{\pi}{n}. $$

Multiplying $n$ copies of $w$ multiplies $n$ equal moduli and adds $n$ equal arguments:

$$ \left(1 + \frac{i\pi}{n}\right)^n \text{ has modulus } \left(1 + \frac{\pi^2}{n^2}\right)^{n/2} \text{ and argument } n\arctan\frac{\pi}{n}. $$

For $n = 4$ these are $1.2716^4 \approx 2.61$ and $4 \times 0.6658 \approx 2.66$, as in the figure. For the value to approach $-1$, the modulus must approach 1 and the argument must approach $\pi$. The second is plausible, since each turn is a bit less than $\frac{\pi}{n}$ and there are $n$ of them. The first is not obvious at all.

Pause and try

Every step stretches, by a factor greater than 1. Taking more steps makes each stretch milder, but there are more of them. Compute the total stretch $\left(\sqrt{1 + \pi^2/n^2}\right)^n$ for $n = 10$ and for $n = 100$ with a calculator, and decide which effect is winning.

Show answerHide answer

For $n = 10$ each step stretches by $\sqrt{1.0987} \approx 1.0482$, and $1.0482^{10} \approx 1.60$. For $n = 100$ each step stretches by $\sqrt{1.000987} \approx 1.000493$, and $1.000493^{100} \approx 1.051$. The mildness wins. With ten times as many steps, the excess of each stretch over 1 fell by a factor of about 100 (from $0.048$ to $0.0005$), which more than pays for having ten times as many.

  1. One step: the path goes straight up from 1 to 1 + 3.14i.
  2. Two steps of half the size. The end is 3.47 from 0, even farther out than before.
  3. Four steps: the path of the previous figure. It has begun to curl around 0.
  4. Ten steps. The end is 1.60 from 0 and almost on the negative real axis.
  5. A hundred steps. The path is hard to tell from the upper half of the unit circle, and it ends at about -1.05.
The path of $\left(1 + \frac{i\pi}{n}\right)^n$ for $n = 1, 2, 4, 10$ and $100$, with earlier paths left in gray. More steps give a path that stays closer to the unit circle and an end point closer to $-1$.
Monocurl source
let Read = |n| {
    let c = chain(PI, n)
    let z = c[n]
    return [
        center{[RX, 1.75, 0]} Note("steps", 0.74),
        center{[RX, 1.28, 0]} Math(str_join(["n = ", to_string(n)]), 1.05, EMBER),
        center{[RX, 0.45, 0]} Note("the path ends at", 0.74),
        center{[RX, -0.05, 0]} Math(str_join([to_string(z[0], 2), " + ", to_string(z[1], 2), "i"]), 0.95, EMBER),
        center{[RX, -0.9, 0]} Note("distance from 0", 0.74),
        center{[RX, -1.4, 0]} Math(to_string(cabs(z), 2), 1.05, AZURE)
    ]
}
let Old = |n| ChainMesh(O, U, chain(PI, n), MIST, 3, 0)
let New = |n| [ChainMesh(O, U, chain(PI, n), EMBER, 3.5, 1), Pt(P(chain(PI, n)[n]), EMBER, 0.11)]
mesh stage = Stage
mesh old = []
mesh cur = New(1)
mesh start = Pt(P([1, 0]), LEAF, 0.09)
mesh readout = Read(1)

slide "One step: the path goes straight up from 1 to 1 + 3.14i."
    play Fade(0.6)

slide "Two steps of half the size. The end is 3.47 from 0, even farther out than before."
    readout = []
    play Fade(0.3, [&readout])
    old .= Old(1)
    cur = New(2)
    readout = Read(2)
    play Fade(0.8)

slide "Four steps: the path of the previous figure. It has begun to curl around 0."
    readout = []
    play Fade(0.3, [&readout])
    old .= Old(2)
    cur = New(4)
    readout = Read(4)
    play Fade(0.8)

slide "Ten steps. The end is 1.60 from 0 and almost on the negative real axis."
    readout = []
    play Fade(0.3, [&readout])
    old .= Old(4)
    cur = New(10)
    readout = Read(10)
    play Fade(0.8)

slide "A hundred steps. The path is hard to tell from the upper half of the unit circle, and it ends at about -1.05."
    readout = []
    play Fade(0.3, [&readout])
    old .= Old(10)
    cur = New(100)
    readout = Read(100)
    play Fade(0.8)

Uses the shared definitions for this lesson's figures.

Here is the reason the stretch dies out. For a small number $x$, a step of size $x$ at a right angle changes the distance from 0 from 1 to $\sqrt{1 + x^2}$, and $\sqrt{1 + x^2}$ is less than $1 + \frac{x^2}{2}$ (square both to compare). The excess depends on the square of the step. With $x = \frac{\pi}{n}$ each step contributes an excess of at most $\frac{\pi^2}{2n^2}$, and $n$ such contributions amount to roughly $\frac{\pi^2}{2n}$, which shrinks as $n$ grows. For $n = 100$ this estimate is $0.049$, and the true excess in the table is $0.051$. The turn, by contrast, is proportional to the step itself: about $\frac{\pi}{n}$ each, about $\pi$ in total, whatever $n$ is. A sideways step turns you in proportion to its length and pushes you outward only in proportion to its length squared.

The modulus of \left(1 + \frac{i\pi}{n}\right)^n (orange) and its argument divided by \pi (blue), plotted against the number of steps n on a scale where each gridline is ten times more steps. Both approach 1: the modulus from above and the argument from below.
The modulus of $\left(1 + \frac{i\pi}{n}\right)^n$ (orange) and its argument divided by $\pi$ (blue), plotted against the number of steps $n$ on a scale where each gridline is ten times more steps. Both approach 1: the modulus from above and the argument from below.
Monocurl source
let fg = Frame(0, 3, 0, 3.6, [0.2, 0.35, 0], 6.2, 3.0)
let modn = |x| (1 + PI * PI / (10 ^ (2 * x))) ^ ((10 ^ x) / 2)
let argn = |x| (10 ^ x) * arctan(PI / (10 ^ x)) / PI
mesh grid = GridLines(fg, [1, 2, 3], [1, 2, 3])
mesh axes = [
    Axes(fg),
    YTicks(fg, [1, 2, 3]),
    center{[fx(fg, 3) - 1.0, fy(fg, 0) - 0.72, 0]} Note("number of steps n", 0.74)
]
mesh xticks = block {
    for (k in range(0, 4)) {
        . Seg([fx(fg, k), fy(fg, 0) - 0.07, 0], [fx(fg, k), fy(fg, 0) + 0.07, 0], SLATE, 2)
        . center{[fx(fg, k), fy(fg, 0) - 0.33, 0]} Math(to_string(10 ^ k), 0.72, SLATE)
    }
}
mesh target = Dash(at(fg, 0, 1), at(fg, 3, 1), LEAF, 3)
mesh curves = [
    Graph(fg, modn, 0, 3, EMBER, 4),
    Graph(fg, argn, 0, 3, AZURE, 4)
]
mesh dots = block {
    for (n in [1, 2, 4, 10, 100, 1000]) {
        . Pt(at(fg, log10(n), modn(log10(n))), EMBER, 0.085)
        . Pt(at(fg, log10(n), argn(log10(n))), AZURE, 0.085)
    }
}
mesh names = [
    center{at(fg, 1.45, 2.7)} Cap("modulus (distance from 0)", 0.74, EMBER),
    center{at(fg, 1.25, 0.45)} Math("\text{argument} \div \pi", 0.8, AZURE),
    center{at(fg, 2.45, 1.4)} Cap("both approach 1", 0.74, LEAF)
]

Uses the shared definitions for this lesson's figures.

The definition, and Euler’s formula

Nothing in this reasoning was special to $\pi$. Replace it by any real number $\theta$: each step is at a right angle and has relative size $\frac{\theta}{n}$, the total turn should be about $\theta$, and the stretch should die out. So $\left(1 + \frac{i\theta}{n}\right)^n$ ought to approach the point of the unit circle at angle $\theta$. Here is a path of 200 steps while $\theta$ runs from 0 to $2\pi$.

The path of $\left(1 + \frac{i\theta}{200}\right)^{200}$ (orange) as $\theta$ grows from 0 to $2\pi$. Its end stays close to the point of the unit circle at arc length $\theta$ from 1 (green ring), a little outside it and a little behind.
Monocurl source
let O6 = [-1.45, 0, 0]
let U6 = 0.9
let p = |z| cpt(O6, U6, z)
let Sweep = |th| {
    let c = chain(th, 200)
    var out = [ArcAt(O6, U6, 0, max(th, 0.02), LEAF, 5)]
    if (th > 0.3) {
        out .= stroke{EMBER, 3.5} Polyline(map(range(0, 51), |j| p(c[4 * j])))
    }
    out .= Ring(p(polar(1, th)), LEAF, 0.12, 3.5)
    out .= Pt(p(c[200]), EMBER, 0.085)
    out .= center{[2.3, 0.85, 0]} scale{1.3} color{LEAF} Number(th, 2)
    out .= center{[2.3, -1.2, 0]} scale{1.3} color{EMBER} Number(cabs(c[200]), 3)
    return out
}
mesh plane = [CPlane(O6, U6, -2, 2, -2, 2), UnitCircle(O6, U6)]
mesh labels = [
    center{[2.3, 1.4, 0]} Math("\theta \text{, in radians}", 0.8, LEAF),
    center{[2.3, -0.3, 0]} Note("end of the path:", 0.74),
    center{[2.3, -0.68, 0]} Note("distance from 0", 0.74)
]
mesh sweep = Sweep(th: 0)

slide "sweep"
    play Wait(0.6)
    sweep.th = TAU
    play Lerp(6, [&sweep], linear)
    play Wait(1.6)

Uses the shared definitions for this lesson's figures.

We now state exactly what we are defining and what we claim. First, the meaning of a limit for points of the plane: it is the meaning for real numbers, with distance in the plane in place of distance on the line.

Be clear about the roles. For a real exponent, $e^x$ already had a meaning and “$(1 + \frac{x}{n})^n \to e^x$” was a theorem. For an imaginary exponent there is no earlier meaning, so we promote that theorem to a definition. Nothing has been proved by doing so. The content is in the theorem: the limit exists, and it is the point of the unit circle that trigonometry calls $(\cos\theta, \sin\theta)$.

The proof needs two estimates. The first is an inequality for whole-number powers, Bernoulli’s inequality: if $0 \le x \le 1$ and $n \ge 1$, then $(1 - x)^n \ge 1 - nx$. It is true for $n = 1$, and if it is true for some $n$ then multiplying both sides by $1 - x \ge 0$ gives $(1 - x)^{n+1} \ge (1 - nx)(1 - x) = 1 - (n+1)x + nx^2 \ge 1 - (n+1)x$, so it is true for $n + 1$, and hence for every $n$. The second estimate compares an angle with its tangent, and it is the one place where radians are indispensable.

The multiplier 1 + ix and the angle t it makes with the real axis, so that x = \tan t. On the unit circle the arc from 1 has length t. The arc is longer than the height \sin t of its end point and shorter than the straight step x.
The multiplier $1 + ix$ and the angle $t$ it makes with the real axis, so that $x = \tan t$. On the unit circle the arc from 1 has length $t$. The arc is longer than the height $\sin t$ of its end point and shorter than the straight step $x$.
Monocurl source
let O5 = [-3.05, -1.5, 0]
let U5 = 3.1
let X5 = 0.9
let T5 = arctan(X5)
let p = |z| cpt(O5, U5, z)
mesh base = [
    Seg(p([-0.08, 0]), p([1.3, 0]), SLATE, 2.5),
    ArcAt(O5, U5, 0, 1.2, SLATE, 2)
]
mesh tri = Shape([O5, p([1, 0]), p([1, X5])], AZURE, 0.1, 2.5)
mesh marks = [
    ArcAt(O5, 0.75, 0, T5, SLATE, 2.5),
    Seg(p([cos(T5), 0]), p(polar(1, T5)), PLUM, 4.5),
    Seg(p([1, 0]), p([1, X5]), EMBER, 5),
    ArcAt(O5, U5, 0, T5, LEAF, 5.5),
    Pt(O5, INK, 0.08),
    Pt(p([1, 0]), INK, 0.08),
    Pt(p([1, X5]), EMBER, 0.09),
    Pt(p(polar(1, T5)), LEAF, 0.09)
]
mesh names = [
    center{p([0.33, 0.1])} Math("t", 0.9, SLATE),
    center{p([0.02, -0.1])} Math("0", 0.8, INK),
    center{p([1.0, -0.1])} Math("1", 0.8, INK),
    center{p([1.2, X5 + 0.06])} Math("1 + ix", 0.9, EMBER),
    center{p([1.09, 0.45])} Math("x", 0.95, EMBER),
    center{p([0.6, 0.25])} Math("\sin t", 0.8, PLUM)
]
mesh facts = [
    center{[2.4, 1.6, 0]} Note("height of the arc's end", 0.72),
    center{[2.4, 1.15, 0]} Math(str_join(["\sin t = ", to_string(sin(T5), 3)]), 0.9, PLUM),
    center{[2.4, 0.62, 0]} Math("<", 0.9, INK),
    center{[2.4, 0.15, 0]} Note("length of the arc", 0.72),
    center{[2.4, -0.3, 0]} Math(str_join(["t = ", to_string(T5, 3)]), 0.9, LEAF),
    center{[2.4, -0.83, 0]} Math("<", 0.9, INK),
    center{[2.4, -1.3, 0]} Note("length of the step", 0.72),
    center{[2.4, -1.75, 0]} Math(str_join(["x = \tan t = ", to_string(X5, 3)]), 0.9, EMBER)
]

Uses the shared definitions for this lesson's figures.

The figure shows the standard fact that $\sin t < t < \tan t$ whenever $0 < t < \frac{\pi}{2}$ and $t$ is in radians. The reason is a comparison of areas: the triangle with corners 0, 1 and the end of the arc has area $\frac12\sin t$; it sits inside the circular sector, of area $\frac12 t$; and the sector sits inside the blue triangle, of area $\frac12\tan t$. We cite this inequality and do not prove it, because a full proof has to start from a definition of arc length.

Three things in the proof were used without proof and should be named: the inequality $\sin t < t < \tan t$; the fact that a straight path between two points is shortest (the triangle inequality in step 4, and “chord at most arc”, which Problem 8 turns into a formula); and the squeeze principle, that a sequence trapped between two sequences with the same limit has that limit too (the lesson on limits proves it for functions, and the proof for sequences is the same). Steps 2 and 3 also took for granted that $\frac{\theta^2}{n}$ and $\frac{\theta^2}{n^2}$ have limit 0 as $n$ grows, and step 1 used the rule from the lesson on complex numbers that moduli multiply and arguments add. Everything else was computed in front of you. Check step 2 against the table: for $\theta = \pi$ and $n = 100$ it promises $1 \le r_n \le \frac{1}{1 - 0.0987} \approx 1.110$, and the true value is $1.051$.

The point $e^{i\theta}$ as $\theta$ grows from 0 to $2\pi$. The green arc has length $\theta$. The real part of the point is $\cos\theta$ (blue) and its imaginary part is $\sin\theta$ (purple). At $\theta = \pi$ the point is at $-1$.
Monocurl source
let O7 = [-1.6, 0, 0]
let U7 = 1.7
let p = |z| cpt(O7, U7, z)
let nz = |v| v * (abs(v) >= 0.005)
let Walk = |th| {
    let z = polar(1, th)
    var out = [ArcAt(O7, U7, 0, max(th, 0.02), LEAF, 5.5)]
    if (abs(z[0]) > 0.01) {
        out .= Seg(O7, p([z[0], 0]), AZURE, 5)
    }
    if (abs(z[1]) > 0.01) {
        out .= Seg(p([z[0], 0]), p(z), PLUM, 5)
    }
    out .= Seg(O7, p(z), SLATE, 2.5)
    out .= Pt(p(z), LEAF, 0.12)
    out .= center{[2.3, 1.05, 0]} scale{1.3} color{LEAF} Number(th, 2)
    out .= center{[2.3, -0.2, 0]} scale{1.3} color{AZURE} Number(nz(z[0]), 2)
    out .= center{[2.3, -1.45, 0]} scale{1.3} color{PLUM} Number(nz(z[1]), 2)
    return out
}
mesh plane = [CPlane(O7, U7, -1, 1, -1, 1), UnitCircle(O7, U7)]
mesh labels = [
    center{[2.3, 1.6, 0]} Math("\theta = \text{arc walked}", 0.8, LEAF),
    center{[2.3, 0.35, 0]} Math("\cos\theta", 0.85, AZURE),
    center{[2.3, -0.9, 0]} Math("\sin\theta", 0.85, PLUM)
]
mesh walk = Walk(th: 0)

slide "walk"
    play Wait(0.6)
    walk.th = PI
    play Lerp(3, [&walk])
    play Wait(1.2)
    walk.th = TAU
    play Lerp(3, [&walk])
    play Wait(1.5)

Uses the shared definitions for this lesson's figures.

Pause and try

Someone types e^(180i) into a calculator, intending a half turn in degrees. By the definition, which point of the unit circle is $e^{180i}$? Give its angle as a number between 0 and $2\pi$, and in degrees.

Show answerHide answer

The definition walks a distance of 180 around a circle whose circumference is $2\pi \approx 6.283$. That is 28 full laps ($28 \times 6.2832 = 175.93$) and $4.07$ more, so the point is at angle $4.07$ radians, which is $4.07 \times \frac{180^\circ}{\pi} \approx 233^\circ$. Its coordinates are $\cos 180 \approx -0.598$ and $\sin 180 \approx -0.801$. The formula $e^{i\theta} = \cos\theta + i\sin\theta$ is true only with $\theta$ in radians, because the step of length $\frac{\theta}{n}$ turns the point through nearly $\frac{\theta}{n}$ units of arc, and arc length on the unit circle is what a radian is.

Why this definition deserves the name

A definition cannot be wrong, but it can be a poor use of a good symbol. Writing our limit as a power of $e$ is justified if it behaves like one. The property that matters most is $e^{x}e^{y} = e^{x+y}$.

Written with cosines and sines, this theorem is the pair of angle addition formulas. The rule “arguments add” was itself proved from those formulas, so this is the same fact in new notation and not a new proof of it. The gain is in the notation: two formulas that are hard to remember have become one law of exponents.

There is also a second route to the same function, and many books take it as the definition. Calculus shows that for real $x$

$$ e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots, $$

the Taylor series of the exponential. Put $x = i\theta$ and use $i^2 = -1$, $i^3 = -i$, $i^4 = 1$:

$$ 1 + i\theta - \frac{\theta^2}{2!} - i\frac{\theta^3}{3!} + \frac{\theta^4}{4!} + \cdots = \left(1 - \frac{\theta^2}{2!} + \frac{\theta^4}{4!} - \cdots\right) + i\left(\theta - \frac{\theta^3}{3!} + \cdots\right). $$

The two brackets are the Taylor series of $\cos\theta$ and $\sin\theta$. This is a third piece of evidence, and it can be made into a proof, but as it stands it is a sketch: one must define what an infinite sum of complex numbers is, show that this one converges, and justify regrouping its terms. It is a theorem, which we cite, that the series converges for every complex number and has the same value as our limit. Either can be taken as the definition, and then the other is a theorem.

For a general complex exponent $a + bi$ one defines $e^{a + bi} = e^a\,e^{ib}$: the point at distance $e^a$ from 0 in the direction $b$ radians.

Worked examples

Values of e^{i\theta} around the unit circle. Each is found by walking the arc length \theta from 1 and reading off the coordinates \cos\theta and \sin\theta.
Values of $e^{i\theta}$ around the unit circle. Each is found by walking the arc length $\theta$ from 1 and reading off the coordinates $\cos\theta$ and $\sin\theta$.
Monocurl source
let O8 = [0, 0, 0]
let U8 = 1.4
let p = |z| cpt(O8, U8, z)
let angles = [0, PI / 3, PI / 2, 3 * PI / 4, PI, 5 * PI / 4, 3 * PI / 2, 5 * PI / 3]
mesh axes = [
    Tip([-2.1, 0, 0], [2.15, 0, 0], SLATE, 2.5, 0.15),
    Tip([0, -2.0, 0], [0, 2.1, 0], SLATE, 2.5, 0.15)
]
mesh spokes = map(angles, |a| Seg(O8, p(polar(1, a)), MIST, 2))
mesh circle = fill{alpha{0} PAPER} stroke{AZURE, 3.5} Circle(U8, 96)
mesh points = block {
    for (a in angles) {
        . Pt(p(polar(1, a)), EMBER, 0.085)
    }
    . Pt(p([-1, 0]), LEAF, 0.12)
}
mesh names = [
    center{[2.85, -0.42, 0]} Math("e^{0} = e^{2\pi i} = 1", 0.8, INK),
    center{[2.5, 1.45, 0]} Math("e^{i\pi/3} = \frac12 + \frac{\sqrt3}{2}i", 0.8, INK),
    center{[-0.95, 1.8, 0]} Math("e^{i\pi/2} = i", 0.8, INK),
    center{[-2.6, 1.15, 0]} Math("e^{3\pi i/4} = \frac{-1 + i}{\sqrt2}", 0.8, INK),
    center{[-2.85, 0.4, 0]} Math("e^{i\pi} = -1", 0.9, LEAF),
    center{[-2.6, -1.15, 0]} Math("e^{5\pi i/4} = \frac{-1 - i}{\sqrt2}", 0.8, INK),
    center{[-0.95, -1.8, 0]} Math("e^{3\pi i/2} = -i", 0.8, INK),
    center{[2.5, -1.45, 0]} Math("e^{5\pi i/3} = \frac12 - \frac{\sqrt3}{2}i", 0.8, INK)
]

Uses the shared definitions for this lesson's figures.

Where care is needed

Two limits of the result should be stated. The theorem is about the limit, and no term of the sequence equals it: the modulus $\left(1 + \frac{\pi^2}{n^2}\right)^{n/2}$ from step 1 is greater than 1 for every $n$, so none of the numbers $\left(1 + \frac{i\pi}{n}\right)^n$ is $-1$. And modulus 1 belongs to real $\theta$ only. For instance $e^{i \cdot i} = e^{-1} \approx 0.37$ under the general definition, a point inside the circle.

Stepping back, the hard part was the first question: what the symbol means. Once $e^{i\theta}$ is read as “take $n$ steps of relative size $\frac{\theta}{n}$ at right angles, and let $n$ grow”, the circle appears because a sideways step turns a point in proportion to its length and pushes it outward only in proportion to the square. The same idea, growth at a right angle to position, is how physics and engineering describe anything that rotates or oscillates. The power series we passed over is an infinite sum, and infinite sums need a definition of their own; the next lesson builds it on the simplest example, the geometric series.

Check yourself

Where in the complex plane is $e^{100i}$?

Problems

Work these on paper, with a sketch of the unit circle beside you. The first three repeat the lesson’s moves, the next three combine them, and the last two go further.

Problem 1

Write $e^{i\pi/6}$, $e^{3\pi i/2}$, $e^{-i\pi}$ and $e^{5\pi i/4}$ in the form $a + bi$.

Show solutionHide solution

Use $e^{i\theta} = \cos\theta + i\sin\theta$. $e^{i\pi/6} = \frac{\sqrt3}{2} + \frac12 i$. $e^{3\pi i/2} = 0 + (-1)i = -i$, three quarters of the way around. $e^{-i\pi} = \cos(-\pi) + i\sin(-\pi) = -1$: half the circle walked clockwise ends at the same point as half the circle walked counterclockwise. $e^{5\pi i/4} = -\frac{\sqrt2}{2} - \frac{\sqrt2}{2}i$, in the third quadrant.

Problem 2

The two-step approximation to $e^{i\pi/2}$ is $\left(1 + \frac{i\pi}{4}\right)^2$. Compute it in the form $a + bi$, and find its modulus and argument. How do they compare with those of $e^{i\pi/2} = i$?

Show solutionHide solution

$\left(1 + \frac{i\pi}{4}\right)^2 = 1 - \frac{\pi^2}{16} + \frac{i\pi}{2} \approx 0.383 + 1.571i$. The modulus is the square of $|1 + \frac{i\pi}{4}|$, which is $1 + \frac{\pi^2}{16} \approx 1.617$. The argument is $2\arctan\frac{\pi}{4} \approx 2 \times 0.6658 = 1.332$ radians. The target $i$ has modulus 1 and argument $\frac{\pi}{2} \approx 1.571$. As the lesson predicts, the approximation is too far out and has not turned far enough. (These are the first two steps of the four-step figure.)

Problem 3

Write $\sqrt3 + i$ in the form $re^{i\theta}$ and use it to compute $(\sqrt3 + i)^6$. Check by another method.

Show solutionHide solution

The modulus is $\sqrt{3 + 1} = 2$, and $\sqrt3 + i = 2\left(\frac{\sqrt3}{2} + \frac12 i\right) = 2e^{i\pi/6}$. So $(\sqrt3 + i)^6 = 2^6 e^{i\pi} = -64$. Check: $(\sqrt3 + i)^2 = 3 + 2\sqrt3\,i - 1 = 2 + 2\sqrt3\,i$; multiplying by $\sqrt3 + i$ gives $2\sqrt3 + 2i + 6i + 2\sqrt3\,i^2 = 8i$; and $(8i)^2 = -64$.

Problem 4

(a) Show that $e^{-i\theta}$ is the reciprocal of $e^{i\theta}$. (b) Show that $\cos\theta = \dfrac{e^{i\theta} + e^{-i\theta}}{2}$ and $\sin\theta = \dfrac{e^{i\theta} - e^{-i\theta}}{2i}$.

Show solutionHide solution

(a) By the law of exponents, $e^{i\theta}e^{-i\theta} = e^{i(\theta - \theta)} = e^{0} = \cos 0 + i\sin 0 = 1$. (b) Since $\cos(-\theta) = \cos\theta$ and $\sin(-\theta) = -\sin\theta$, Euler’s formula gives $e^{-i\theta} = \cos\theta - i\sin\theta$. Adding this to $e^{i\theta} = \cos\theta + i\sin\theta$ gives $2\cos\theta$, and subtracting it gives $2i\sin\theta$. Divide by 2 and by $2i$.

Problem 5

Use $e^{3i\theta} = \left(e^{i\theta}\right)^3$ to express $\cos 3\theta$ in terms of $\cos\theta$ alone and $\sin 3\theta$ in terms of $\sin\theta$ alone.

Show solutionHide solution

With $c = \cos\theta$, $s = \sin\theta$: $(c + is)^3 = c^3 + 3c^2(is) + 3c(is)^2 + (is)^3 = (c^3 - 3cs^2) + i(3c^2s - s^3)$. Comparing with $\cos 3\theta + i\sin 3\theta$ and using $s^2 = 1 - c^2$ and $c^2 = 1 - s^2$:

$$ \cos 3\theta = c^3 - 3c(1 - c^2) = 4\cos^3\theta - 3\cos\theta, \qquad \sin 3\theta = 3(1 - s^2)s - s^3 = 3\sin\theta - 4\sin^3\theta. $$

Check at $\theta = \frac{\pi}{3}$: $4 \cdot \frac18 - \frac32 = -1 = \cos\pi$.

Problem 6

Find all complex numbers $z$ with $z^3 = -8$ by writing $z = re^{i\theta}$. Verify one non-real solution by multiplying out.

Show solutionHide solution

$z^3 = r^3e^{3i\theta}$ and $-8 = 8e^{i\pi}$. Comparing moduli, $r^3 = 8$, so $r = 2$. Comparing directions, $3\theta$ and $\pi$ differ by a multiple of $2\pi$: $3\theta = \pi, 3\pi, 5\pi$, giving $\theta = \frac{\pi}{3}, \pi, \frac{5\pi}{3}$ (the next value, $\frac{7\pi}{3}$, is the first direction again). So $z = 2e^{i\pi/3} = 1 + \sqrt3\,i$, $z = 2e^{i\pi} = -2$, or $z = 2e^{5\pi i/3} = 1 - \sqrt3\,i$. Check: $(1 + \sqrt3\,i)^2 = 1 + 2\sqrt3\,i - 3 = -2 + 2\sqrt3\,i$, and $(-2 + 2\sqrt3\,i)(1 + \sqrt3\,i) = -2 - 2\sqrt3\,i + 2\sqrt3\,i + 6i^2 = -8$.

Problem 7

Use the bound in step 2 of the proof to find a number of steps $n$ that guarantees the modulus of $\left(1 + \frac{i\pi}{n}\right)^n$ is within $0.001$ of 1. Then use the estimate “excess $\approx \frac{\pi^2}{2n}$” from the lesson to judge how wasteful the guarantee is.

Show solutionHide solution

Step 2 gives $1 \le r_n \le \frac{1}{1 - \pi^2/n}$ for $n > \pi^2$. We need $\frac{1}{1 - \pi^2/n} \le 1.001$, that is $1 - \frac{\pi^2}{n} \ge \frac{1}{1.001}$, that is $\frac{\pi^2}{n} \le \frac{0.001}{1.001}$, so $n \ge 1001\pi^2 \approx 9879.5$. Any $n \ge 9880$ is guaranteed to work. The estimate $\frac{\pi^2}{2n} \approx 0.001$ suggests that $n \approx 4935$ is already about enough, so the guarantee asks for twice as many steps as needed. The proof gave away a factor of 2 when it replaced $r_n$ by $r_n^2$. A bound used in a proof has to be true and simple; it does not have to be tight.

Problem 8

Let $\alpha$ and $\beta$ be real. Show that the straight distance between the points $e^{i\alpha}$ and $e^{i\beta}$ of the unit circle is $2\left|\sin\frac{\alpha - \beta}{2}\right|$. Deduce the fact used in step 4 of the proof: the chord is at most the arc $|\alpha - \beta|$.

Show solutionHide solution

Throughout, read $e^{i\theta}$ as a name for the point $\cos\theta + i\sin\theta$. The law of exponents for these points is the rule that arguments add, which does not depend on Euler’s formula, so using it here to supply a step of that formula’s proof is not circular. Let $m = \frac{\alpha + \beta}{2}$ and $\delta = \frac{\alpha - \beta}{2}$, so $\alpha = m + \delta$ and $\beta = m - \delta$. By the law of exponents, $e^{i\alpha} - e^{i\beta} = e^{im}\left(e^{i\delta} - e^{-i\delta}\right) = e^{im} \cdot 2i\sin\delta$, using Problem 4. Moduli multiply, and $|e^{im}| = 1$, $|2i| = 2$, so the distance is $2|\sin\delta|$. For the deduction we need $|\sin\delta| \le |\delta|$. If $0 < \delta < \frac{\pi}{2}$ this is the cited inequality $\sin t < t$. If $\delta \ge \frac{\pi}{2}$ then $|\sin\delta| \le 1 < \frac{\pi}{2} \le \delta$. Negative $\delta$ follows because both sides are unchanged when $\delta$ changes sign, and $\delta = 0$ gives $0 \le 0$. Hence the distance is at most $2|\delta| = |\alpha - \beta|$.

Shared definitions used by this lesson's figures
# house kit: prepended to every essay figure after the std imports

# palette. AZURE and EMBER are the two actors, LEAF marks an answer, ROSE a problem
let PAPER = [1, 1, 1, 1]
let INK = [0.08, 0.09, 0.11, 1]
let SLATE = [0.40, 0.44, 0.50, 1]
let MIST = [0.85, 0.86, 0.88, 1]
let AZURE = [0.13, 0.42, 0.68, 1]
let EMBER = [0.89, 0.42, 0.12, 1]
let LEAF = [0.13, 0.55, 0.36, 1]
let ROSE = [0.78, 0.22, 0.24, 1]
let PLUM = [0.47, 0.30, 0.66, 1]
let GOLD = [0.85, 0.62, 0.08, 1]

background = PAPER

# an opaque pastel of col; use for fills so overlaps do not darken
let tint = |col, amount = 0.18| [
    1 - (1 - col[0]) * amount,
    1 - (1 - col[1]) * amount,
    1 - (1 - col[2]) * amount,
    1
]

# text: Cap for labels, Note for quiet labels, Math for typeset maths
let Cap = |txt, size = 0.75, col = INK| color{col} Text(txt, size, "Charter")
let Note = |txt, size = 0.65| color{SLATE} Text(txt, size, "Charter")
let Math = |tex, size = 0.9, col = INK| color{col} Tex(tex, size)

# a paper rectangle to sit behind text that crosses lines
let Plate = |pos, size| center{pos} fill{PAPER} stroke{alpha{0} PAPER, 0} Rect(size)

# shapes with fill and stroke both set, so no stray black appears
let Pt = |pos, col = INK, r = 0.075| center{pos} fill{col} stroke{col, 1} Circle(r, 48)
let Ring = |pos, col = INK, r = 0.1, w = 3| center{pos} fill{PAPER} stroke{col, w} Circle(r, 48)
let Seg = |a, b, col = INK, w = 3| stroke{col, w} Line(a, b)
let Path = |pts, col = INK, w = 3| stroke{col, w} Polyline(pts)
let Region = |pts, col| fill{col} stroke{alpha{0} col, 0} Polygon(pts)
let Outline = |pts, col = INK, w = 3| fill{alpha{0} PAPER} stroke{col, w} Polygon(pts)
let Shape = |pts, col, amount = 0.18, w = 3| fill{tint(col, amount)} stroke{col, w} Polygon(pts)
let Disc = |pos, r, col, amount = 0.18, w = 3| center{pos} fill{tint(col, amount)} stroke{col, w} Circle(r, 96)
let Box = |pos, size, col, amount = 0.18, w = 3| center{pos} fill{tint(col, amount)} stroke{col, w} Rect(size)
# a line from a to b ending in a small solid arrowhead
let Tip = |a, b, col = INK, w = 3, head = 0.17| {
    let d = normalize([b[0] - a[0], b[1] - a[1], 0])
    let n = [-d[1], d[0], 0]
    let base = [b[0] - d[0] * head, b[1] - d[1] * head, 0]
    return [
        stroke{col, w} Line(a, base),
        fill{col} stroke{col, 1} Polygon([
            b,
            [base[0] + n[0] * head * 0.42, base[1] + n[1] * head * 0.42, 0],
            [base[0] - n[0] * head * 0.42, base[1] - n[1] * head * 0.42, 0]
        ])
    ]
}

# plots. a frame is [x0, x1, y0, y1, centre, width, height]: a data window and the scene box it fills
let Frame = |x0, x1, y0, y1, c = [0, 0, 0], w = 6.4, h = 3.6| [x0, x1, y0, y1, c, w, h]
let fx = |fr, x| fr[4][0] + (x - (fr[0] + fr[1]) / 2) * fr[5] / (fr[1] - fr[0])
let fy = |fr, y| fr[4][1] + (y - (fr[2] + fr[3]) / 2) * fr[6] / (fr[3] - fr[2])
let at = |fr, x, y| [fx(fr, x), fy(fr, y), 0]

# axes through the data origin (or the nearest edge of the window), with optional names
let Axes = |fr, x_name = "", y_name = "", col = SLATE| {
    let ox = clamp(fr[0], 0, fr[1])
    let oy = clamp(fr[2], 0, fr[3])
    var parts = [
        Tip(at(fr, fr[0], oy), [fx(fr, fr[1]) + 0.25, fy(fr, oy), 0], col, 2.5, 0.15),
        Tip(at(fr, ox, fr[2]), [fx(fr, ox), fy(fr, fr[3]) + 0.25, 0], col, 2.5, 0.15)
    ]
    if (x_name != "") {
        parts .= center{[fx(fr, fr[1]) + 0.5, fy(fr, oy), 0]} Math(x_name, 0.8, col)
    }
    if (y_name != "") {
        parts .= center{[fx(fr, ox), fy(fr, fr[3]) + 0.5, 0]} Math(y_name, 0.8, col)
    }
    return parts
}

# tick marks with numbers at the listed data values
let XTicks = |fr, xs, col = SLATE, places = 0| block {
    let oy = fy(fr, clamp(fr[2], 0, fr[3]))
    for (x in xs) {
        . Seg([fx(fr, x), oy - 0.07, 0], [fx(fr, x), oy + 0.07, 0], col, 2)
        . center{[fx(fr, x), oy - 0.33, 0]} Math(to_string(x, places), 0.72, col)
    }
}
let YTicks = |fr, ys, col = SLATE, places = 0| block {
    let ox = fx(fr, clamp(fr[0], 0, fr[1]))
    for (y in ys) {
        . Seg([ox - 0.07, fy(fr, y), 0], [ox + 0.07, fy(fr, y), 0], col, 2)
        . center{[ox - 0.36, fy(fr, y), 0]} Math(to_string(y, places), 0.72, col)
    }
}

# faint grid lines at the listed data values
let GridLines = |fr, xs, ys, col = MIST| block {
    for (x in xs) {
        . Seg(at(fr, x, fr[2]), at(fr, x, fr[3]), col, 1.5)
    }
    for (y in ys) {
        . Seg(at(fr, fr[0], y), at(fr, fr[1], y), col, 1.5)
    }
}

# the graph of f over [a, b], drawn in the frame. values are clamped to the window
let Graph = |fr, f, a, b, col = AZURE, w = 4, n = 160|
    stroke{col, w} Polyline(map(sample(a, b, n), |x| at(fr, x, clamp(fr[2], f(x), fr[3]))))

# the region between the graph of f and the x axis over [a, b]
let AreaUnder = |fr, f, a, b, col = AZURE, amount = 0.2, n = 80| {
    var pts = [at(fr, a, 0)]
    for (x in sample(a, b, n)) {
        pts .= at(fr, x, clamp(fr[2], f(x), fr[3]))
    }
    pts .= at(fr, b, 0)
    return fill{tint(col, amount)} stroke{alpha{0} col, 0} Polygon(pts)
}

# complex numbers are pairs [a, b]; a plane has an origin o (scene point) and a unit length u
let cpt = |o, u, z| [o[0] + u * z[0], o[1] + u * z[1], 0]
let cmul = |z, w| [z[0] * w[0] - z[1] * w[1], z[0] * w[1] + z[1] * w[0]]
let cabs = |z| sqrt(z[0] * z[0] + z[1] * z[1])
let polar = |r, th| [r * cos(th), r * sin(th)]
# grid over whole numbers x0..x1 and y0..y1, both axes, numbers along the bottom and left edges
let CPlane = |o, u, x0, x1, y0, y1| {
    var out = []
    for (x in range(x0, x1 + 1)) {
        out .= Seg(cpt(o, u, [x, y0]), cpt(o, u, [x, y1]), MIST, 1.5)
        out .= center{[o[0] + u * x, o[1] + u * y0 - 0.27, 0]} Math(to_string(x), 0.72, SLATE)
    }
    for (y in range(y0, y1 + 1)) {
        out .= Seg(cpt(o, u, [x0, y]), cpt(o, u, [x1, y]), MIST, 1.5)
        var name = str_join([to_string(y), "i"])
        if (y == 1) {
            name = "i"
        }
        if (y == -1) {
            name = "-i"
        }
        if (y != 0) {
            out .= center{[o[0] + u * x0 - 0.36, o[1] + u * y, 0]} Math(name, 0.72, SLATE)
        }
    }
    out .= Tip(cpt(o, u, [x0, 0]), [o[0] + u * x1 + 0.28, o[1], 0], SLATE, 2.5, 0.15)
    out .= Tip(cpt(o, u, [0, y0]), [o[0], o[1] + u * y1 + 0.28, 0], SLATE, 2.5, 0.15)
    out .= center{[o[0] + u * x1 - 0.22, o[1] - 0.26, 0]} Note("real", 0.72)
    out .= center{[o[0] + 0.85, o[1] + u * y1 + 0.2, 0]} Note("imaginary", 0.72)
    return out
}
# an arc about the scene point c from angle a0 to a1 (radians), radius r in scene units
let ArcAt = |c, r, a0, a1, col, w = 3| {
    let n = to_int(max(2, ceil(abs(a1 - a0) * 16)))
    return stroke{col, w} Polyline(map(sample(a0, a1, n), |t| [c[0] + r * cos(t), c[1] + r * sin(t), 0]))
}
let Dash = |a, b, col = SLATE, w = 2.5| stroke{col, w} dashed{[0.1, 0.08]} Line(a, b)
let UnitCircle = |o, u| stroke{SLATE, 2} dashed{[0.1, 0.08]} Polyline(map(sample(0, TAU, 96), |t| cpt(o, u, polar(1, t))))
# the partial products 1, w, w^2, ..., w^n of w = 1 + i th / n
let chain = |th, n| {
    let w = [1, th / n]
    var z = [1, 0]
    var pts = [[1, 0]]
    for (k in range(0, n)) {
        z = cmul(z, w)
        pts .= z
    }
    return pts
}
let ChainMesh = |o, u, pts, col = EMBER, w = 3.5, dots = 1| {
    var out = [stroke{col, w} Polyline(map(pts, |z| cpt(o, u, z)))]
    if (dots and len(pts) <= 20) {
        for (z in pts) {
            out .= Pt(cpt(o, u, z), col, 0.06)
        }
    }
    return out
}
# the plane used by the first three figures
let O = [-0.75, -1.0, 0]
let U = 0.72
let RX = 2.45
let P = |z| cpt(O, U, z)
let Stage = [CPlane(O, U, -3, 2, -1, 4), UnitCircle(O, U)]