# Workbook 0 — Euler's Formula
> [!abstract] The problem
> Using the fact that $z\bar{z} = |z|^2$ lets us define a length $|z| = \sqrt{z\bar z}$ on $\mathbb{C}$ — and that this length lets us extend the ratio test to complex series so that $e^{z}$ converges **absolutely** for every $z \in \mathbb{C}$ — prove "our gem,"
> $e^{i\theta} = \cos(\theta) + i\sin(\theta).$
---
## 0. What are we actually being asked to do?
Read the problem statement carefully. It does **not** ask us to *define* $e^{i\theta}$ to be $\cos\theta + i\sin\theta$. That would make the formula true by fiat and prove nothing. Instead it hands us three tools and asks us to connect them:
1. A notion of **length** on the complex numbers, $|z| = \sqrt{z\bar z}$.
2. The fact that, with this length, the series for $e^{z}$ converges **absolutely** for every complex $z$.
3. Permission to **reorder** the terms of an absolutely convergent series without changing its sum.
Our job is to take the one object whose meaning we already trust — the power series for the exponential — feed it the imaginary input $z = i\theta$, and *discover* that the real and imaginary parts that fall out are exactly the series for cosine and sine. The proof is really a bookkeeping argument: nothing deep happens, but every step has to be licensed by something, and the problem statement is telling us which licenses we are allowed to use.
> [!tip] The one idea to hold onto
> A real number fed to the cosine/sine series is "spread out" along a single number line. The *same* exponential series, evaluated at $i\theta$, sorts itself into two interleaved pieces — the even-power terms and the odd-power terms — and those two pieces are cosine and sine. Euler's formula is the statement that the powers of $i$ act like a metronome that sends terms alternately to the real axis and the imaginary axis.
---
## 1. The starting point: the exponential as a power series
For a real variable $x$, the Maclaurin (Taylor-at-0) series of the exponential is
$
e^{x} = \sum_{n=0}^{\infty} \frac{x^{n}}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots .
$
We *define* the complex exponential by the same series, now allowing the input to be any complex number $z$:
$
e^{z} := \sum_{n=0}^{\infty} \frac{z^{n}}{n!}. \tag{1}
$
This is the only sensible way to even *talk* about "$e$ to a complex power," since repeated multiplication ("$e$ multiplied by itself $i\theta$ times") has no meaning. The power series, by contrast, only ever asks us to **add and multiply** complex numbers, both of which we know how to do.
We will take this series as our starting object and manipulate it directly to reach Euler's formula. Two honest debts come due as we do — that the series actually converges, and that we are allowed to rearrange it — and we pay both off in the **Points of rigor** section that follows the proof.
---
## 2. The proof — this is what the problem asks for
Substitute $z = i\theta$ into (1) and expand:
$
e^{i\theta} = \sum_{n=0}^{\infty} \frac{(i\theta)^{n}}{n!}
= \sum_{n=0}^{\infty} \frac{i^{\,n}\,\theta^{n}}{n!}.
$
Everything hinges on the factor $i^{n}$, whose powers cycle with period $4$:
$
i^{0}=1,\quad i^{1}=i,\quad i^{2}=-1,\quad i^{3}=-i,\quad i^{4}=1,\ \dots
$
Sort these by the parity of $n$:
| $n$ | $i^{n}$ | lands on the… |
|----|---------|---------------|
| even, $n=2k$ | $(i^2)^k = (-1)^k$ | **real** axis, with sign $(-1)^k$ |
| odd, $n=2k+1$ | $i\,(-1)^k$ | **imaginary** axis, with sign $(-1)^k$ |
So the **even-power** terms are always real and the **odd-power** terms are always $i$ times a real number — the metronome from §0, ticking each term onto either the real or the imaginary axis and flipping sign every other tick.
Because the series converges absolutely (this is the guardrail; it is verified in §3 and is exactly what makes the next move legal), we may separate it into its even-indexed and odd-indexed terms and sum each group on its own:
$
e^{i\theta}
= \underbrace{\sum_{k=0}^{\infty} \frac{i^{\,2k}\,\theta^{2k}}{(2k)!}}_{\text{even powers}}
\;+\;
\underbrace{\sum_{k=0}^{\infty} \frac{i^{\,2k+1}\,\theta^{2k+1}}{(2k+1)!}}_{\text{odd powers}}.
$
Insert $i^{2k} = (-1)^k$ and $i^{2k+1} = i\,(-1)^k$, and factor the constant $i$ out of the second sum:
$
e^{i\theta}
= \sum_{k=0}^{\infty} \frac{(-1)^{k}\,\theta^{2k}}{(2k)!}
\;+\;
i\sum_{k=0}^{\infty} \frac{(-1)^{k}\,\theta^{2k+1}}{(2k+1)!}.
$
Each remaining sum has **only real terms**, so we have written $e^{i\theta}$ as a real part plus $i$ times a real part. Now compare with the standard Maclaurin series for cosine and sine (each obtained by Taylor-expanding about $0$):
$
\cos(\theta) = \sum_{k=0}^{\infty} \frac{(-1)^{k}\,\theta^{2k}}{(2k)!}
= 1 - \frac{\theta^{2}}{2!} + \frac{\theta^{4}}{4!} - \cdots,
$
$
\sin(\theta) = \sum_{k=0}^{\infty} \frac{(-1)^{k}\,\theta^{2k+1}}{(2k+1)!}
= \theta - \frac{\theta^{3}}{3!} + \frac{\theta^{5}}{5!} - \cdots .
$
These are **exactly** the two real series we just produced. Substituting,
$
\boxed{\,e^{i\theta} = \cos(\theta) + i\sin(\theta).\,}
$
This is Eq. (euler), and it is the answer the problem asks for. $\blacksquare$
---
# Points of rigor and sanity checks
> [!note] What the rest of this document is
> The boxed formula above is the **complete answer** to the problem. Nothing below adds a new step to the proof. The next section pays off the two debts the proof took on credit — that the series *converges* and that we were *allowed to reorder it* — and the remaining sections are sanity checks and context: a numerical spot-check, the geometric payoff, common pitfalls, and questions to test yourself.
## 3. Rigor: why the series converges, and why we may reorder it
This is where the length $|z| = \sqrt{z\bar z}$ earns its keep. The complex modulus is multiplicative and satisfies the triangle inequality, exactly like absolute value on $\mathbb{R}$, so the ratio test works verbatim. Apply it to the series of moduli $\sum_{n=0}^\infty \left|\dfrac{z^n}{n!}\right| = \sum_{n=0}^\infty \dfrac{|z|^n}{n!}$:
$
\lim_{n\to\infty}
\frac{\left| z^{n+1}/(n+1)! \right|}{\left| z^{n}/n! \right|}
=
\lim_{n\to\infty} \frac{|z|^{\,n+1}}{|z|^{\,n}} \cdot \frac{n!}{(n+1)!}
=
\lim_{n\to\infty} \frac{|z|}{n+1}
= 0 < 1 .
$
The limit is $0$ for **every** fixed $z$, so the series of moduli converges for every $z \in \mathbb{C}$. By definition, that means (1) converges **absolutely** everywhere — in particular at $z = i\theta$, so the symbol $e^{i\theta}$ we manipulated in §2 is well defined to begin with.
> [!warning] Why absolute convergence is the load-bearing fact
> In §2 we **split one series into two and re-collected the terms** — a rearrangement. Ordinary (conditional) convergence is fragile: rearranging a conditionally convergent series can change its sum or even break convergence entirely (Riemann's rearrangement theorem). The rearrangement is legal *only* because the series is **absolutely** convergent. This is the single technical fact the problem statement insists we use; it is the "theoretical guardrail" that keeps the symbolic manipulation in §2 honest.
## 4. Sanity check: a numerical spot-check
Proofs deserve a spot-check. Take $\theta = \pi/2$, where we expect $e^{i\pi/2} = \cos(\pi/2) + i\sin(\pi/2) = 0 + i\cdot 1 = i$. Summing the first several terms of $\sum (i\theta)^n/n!$ with $\theta = \pi/2 \approx 1.5708$:
| terms kept | partial sum (approx.) |
|-----------|------------------------|
| through $n=2$ | $-0.2337 + 1.5708\,i$ |
| through $n=4$ | $0.0199 + 0.9248\,i$ |
| through $n=6$ | $-0.0009 + 1.0045\,i$ |
| through $n=8$ | $0.00002 + 0.99984\,i$ |
The partial sums march toward $0 + 1\,i = i$, just as the formula predicts: the real part collapses toward $\cos(\pi/2)=0$ and the imaginary part toward $\sin(\pi/2)=1$.
## 5. The payoff: Euler's identity and what the formula *means*
Setting $\theta = \pi$ in our result gives, since $\cos\pi = -1$ and $\sin\pi = 0$,
$
e^{i\pi} = -1 \qquad\Longleftrightarrow\qquad e^{i\pi} + 1 = 0,
$
the celebrated identity tying together $e$, $i$, $\pi$, $1$, and $0$ in a single equation.
Geometrically, $e^{i\theta} = \cos\theta + i\sin\theta$ is the point on the **unit circle** at angle $\theta$ — its modulus is
$
\big|e^{i\theta}\big| = \sqrt{\cos^2\theta + \sin^2\theta} = 1
$
for every $\theta$. So the map $\theta \mapsto e^{i\theta}$ wraps the real line around the unit circle, and multiplying a complex number by $e^{i\theta}$ **rotates** it by angle $\theta$. This is the fact that makes complex exponentials the natural language for anything that rotates or oscillates — and it is why this formula opens a numerical-methods course: oscillation, periodicity, and rotation are everywhere downstream.
## 6. Common pitfalls
> [!warning] Watch out for these
> - **Defining instead of proving.** If you start from "$e^{i\theta}$ is *defined* as $\cos\theta + i\sin\theta$," you have assumed the conclusion. The legitimate starting point is the power series (1).
> - **Reordering without justification.** Splitting the single sum into even and odd parts is a rearrangement; cite **absolute** convergence (§3) as the license. Skipping this is the most common gap.
> - **Mishandling $i^{n}$.** The four-fold cycle $1, i, -1, -i$ is the whole mechanism. A sign slip here (e.g. forgetting $i^2 = -1$) flips a cosine into a "wrong-sign" series.
> - **Index off-by-one in the split.** Even terms are $n = 2k$ and odd terms are $n = 2k+1$ for $k = 0, 1, 2, \dots$; double-check that together they cover every $n$ exactly once.
## 7. Checkpoint questions
1. Where, *precisely*, in the argument did we use absolute convergence rather than ordinary convergence? Why would the proof be incomplete without it?
2. Repeat the substitution with $z = -i\theta$. Which series do you get, and what known identity ($\cos$ even, $\sin$ odd) does the result confirm?
3. Add $e^{i\theta}$ and $e^{-i\theta}$. Solve for $\cos\theta$ in terms of complex exponentials. Then do the same to isolate $\sin\theta$. (These are the formulas you'll reach for constantly later.)