Contents
Deep Breakdown
What it tells me (Situation Awareness): De Moivre's Formula gives a clean way to compute the -th power of a complex number in polar form: raise the modulus to the -th power and multiply the argument by . In polar notation: . In DA/DS, De Moivre underlies: computing powers of rotation matrices, deriving multi-step forecasting equations in complex-eigenvalue linear systems, computing roots of complex numbers, and understanding why Fourier basis functions behave as they do.
Flowchart
Real-world use
Where it is used
Computing -step forecasts in ARMA models with complex roots, finding all -th roots of unity (, ), understanding FFT butterfly operations (powers of ), and proving trigonometric identities like .
Problem it solves
Without De Moivre, computing requires 9 complex multiplications. With De Moivre: , so . One clean calculation.
How it solves the problem
is just the exponent rule applied to the polar form. It works because is an exponential and exponent rules apply: . This is computationally efficient and reveals the geometric meaning: taking the -th power -times the angle and stretches by .
Example in a business
ARMA time series with complex eigenvalues: if the companion matrix has eigenvalue , then the -step-ahead contribution from this eigenvalue is . If , the contribution decays to zero over time (stationary process). If , it oscillates persistently (unit root, non-stationary). De Moivre gives the exact -step value.
The formula, piece by piece
Breaking the notation:
- : modulus of the complex number ().
- : unit complex number at angle (polar form with ).
- : the exponent (can be any integer; also extends to rationals for root-finding).
- : modulus raised to power .
- : the unit complex number at angle . Compact form: .
Special cases:
- : (unit circle rotations).
- : (inverse = conjugate/divide modulus).
- Roots: the distinct -th roots of are , .
The formula in words
"Raising a complex number to the -th power just raises its distance from zero to the -th power and multiplies its angle by . It's like spinning a point on the complex plane: each power rotates it further by the same angle and stretches/shrinks its distance by each time."
Critical Concepts
- Roots of unity: the -th roots of unity are for . These are equally spaced points on the unit circle. The DFT twiddle factors are roots of unity.
- Stability via modulus: in a linear recurrence , . If : decaying oscillation (stable). If : persistent oscillation (unit root). If : explosive growth (unstable).
- Trigonometric identities: De Moivre is the standard derivation of double/triple angle formulas. E.g., .
- Python:
z**nworks for complex numbers:(1 + 1j)**10returns the correct complex result.
Step-by-step calculation (tiny example)
Task: compute using De Moivre.
Step 1: Convert to polar form , (45°). So .
Step 2: Apply De Moivre: .
Step 3: Simplify . So .
Step 4: Verify by Cartesian multiplication , , . Confirmed.
Code examples
Beginner example (Python)
# De Moivre's Formula: (r·e^(iφ))^n = r^n · e^(i·n·φ)
import numpy as np
import cmath # Compute (1+i)^8 using De Moivre
z = 1 + 1j
n = 8 # Method 1: De Moivre (polar)
r, phi = cmath.polar(z)
r_n = r**n
phi_n = n * phi
z_n_moivre = cmath.rect(r_n, phi_n) # Method 2: Direct Python power
z_n_direct = z**n
print(f"z = {z}")
print(f"r = {r:.4f}, φ = {phi:.4f} rad ({np.degrees(phi):.1f}°)")
print(f"r^{n} = {r_n:.4f}, {n}φ = {phi_n:.4f} rad ({np.degrees(phi_n):.1f}°)")
print(f"z^{n} via De Moivre: {z_n_moivre:.4f}")
print(f"z^{n} direct: {z_n_direct:.4f}")
print(f"Equal: {abs(z_n_moivre - z_n_direct) < 1e-10}") # Roots of unity: n-th roots of 1 = e^(i·2π·k/n)
n_roots = 6
print(f"\n6th Roots of Unity (z^6 = 1):")
for k in range(n_roots):
root = np.exp(1j * 2 * np.pi * k / n_roots)
check = root**n_roots
print(f" k={k}: e^(i·{k}·60°) = {root:.4f} | raised to 6 = {check:.4f}")Beginner example (R)
# De Moivre's Formula in R
z <- 1 + 1i
n <- 8L # Polar form
r <- Mod(z)
phi <- Arg(z)
r_n <- r^n
phi_n <- n * phi
z_moivre <- complex(modulus=r_n, argument=phi_n)
z_direct <- z^n
cat(sprintf("z = %s\n", z))
cat(sprintf("r = %.4f, φ = %.4f rad\n", r, phi))
cat(sprintf("z^%d via De Moivre: %.4f+%.4fi\n", n, Re(z_moivre), Im(z_moivre)))
cat(sprintf("z^%d direct: %.4f+%.4fi\n", n, Re(z_direct), Im(z_direct))) # Roots of unity
cat("\n6th Roots of Unity:\n")
for (k in 0:5) { root <- exp(1i * 2 * pi * k / 6)
cat(sprintf(" k=%d: %.4f+%.4fi | |z^6-1| = %.2e\n", k, Re(root), Im(root), Mod(root^6 - 1)))
}Professional example (Python)
import numpy as np
import pandas as pd # Scenario: De Moivre in time-series — n-step forecast decay for complex eigenvalue # AR(2) process: x_t = phi1*x_{t-1} + phi2*x_{t-2}
# Companion matrix eigenvalues determine dynamics
phi1 = 1.0 # AR coefficient 1
phi2 = -0.7 # AR coefficient 2 # Companion matrix
companion = np.array([[phi1, phi2], [1.0, 0.0]])
eigenvalues = np.linalg.eigvals(companion)
print("AR(2) Complex Eigenvalue Analysis via De Moivre")
print("=" * 50)
for i, lam in enumerate(eigenvalues):
r, phi = abs(lam), np.angle(lam)
period = 2 * np.pi / abs(phi)
stable = r < 1
print(f" λ{i+1} = {lam:.4f} |λ|={r:.4f} φ={np.degrees(phi):.1f}° period={period:.1f} steps stable: {stable}")
print()
print("n-step multiplier via De Moivre (λ^n = r^n · e^(i·n·φ)):")
print(f"{'n':>4} {'|λ|^n':>10} {'cos(nφ)':>10} {'sin(nφ)':>10} {'Re(λ^n)':>10}")
lam = eigenvalues[0] # use first eigenvalue
r, phi = abs(lam), np.angle(lam)
rows = []
for n in [1, 2, 5, 10, 20, 50]:
r_n = r**n
phi_n = n * phi
lam_n_moivre = r_n * np.exp(1j * phi_n)
lam_n_direct = lam**n
rows.append({ "n": n, "|λ|^n": round(r_n, 6), "cos(nφ)": round(np.cos(phi_n), 4), "sin(nφ)": round(np.sin(phi_n), 4), "Re(λ^n)": round(lam_n_moivre.real, 6), "match": abs(lam_n_moivre - lam_n_direct) < 1e-10 })
df = pd.DataFrame(rows)
print(df.to_string(index=False))
print()
print(f" |λ| = {r:.4f} < 1 → decaying oscillations → stationary AR(2)")
print(f" Cycle length ≈ {2*np.pi/abs(phi):.1f} steps (periodicity from Im eigenvalue)")Professional example (R)
# De Moivre: λ^n for complex eigenvalue; |λ| < 1 => stationary AR(2)
lambda <- 0.7 + 0.3i
r <- Mod(lambda)
phi <- Arg(lambda)
n_vals <- c(1, 5, 10)
for (n in n_vals) { lam_n_direct <- lambda^n
lam_n_moivre <- r^n * (cos(n * phi) + 1i * sin(n * phi))
cat(sprintf("n=%d: De Moivre match: %s\n", n, isTRUE(all.equal(lam_n_direct, lam_n_moivre))))
}
cat(sprintf(" |λ| = %.4f < 1 → decaying oscillations\n", r))
cat(sprintf(" Cycle length ≈ %.1f steps\n", 2*pi / abs(phi)))Source: 1300 p. 17