You’ve been solving quadratic equations. Most of them have real solutions. But every now and then the discriminant — the bit under the square root — comes out negative.
Try \(x^2 + 1 = 0\). Rearrange: \(x^2 = -1\). Take the square root: \(x = \sqrt{-1}\).
That’s impossible on the number line. There is no real number whose square is negative. Positive times positive is positive. Negative times negative is also positive. Nothing multiplied by itself gives \(-1\).
So for a long time, equations like this were said to have “no solution.”
That answer was unsatisfying, and mathematicians knew it. The fix was the same fix that introduced negative numbers, fractions, and irrational numbers: give the new thing a name, and work out its arithmetic.
The name for \(\sqrt{-1}\) is \(i\).
Once you do that, something unexpected happens. The same number system that lets you give \(x^2 + 1 = 0\) an answer also turns out to describe oscillating voltages in electrical circuits, the quantum states of particles, and the algorithm that your phone uses to process audio. None of that was the motivation. It fell out of the arithmetic.
There’s also this: \(e^{i\pi} + 1 = 0\). Five of the most important numbers in mathematics — \(e\), \(i\), \(\pi\), \(1\), \(0\) — in one equation. We’ll see why by the end of this chapter.
23.1 What the notation is saying
23.1.1 The imaginary unit
Define \(i\) by one rule:
\[i^2 = -1\]
That’s the whole definition. \(i\) is the number whose square is \(-1\). It’s not a number on the real number line — it’s something new.
From this one rule, powers of \(i\) cycle in a pattern:
Every four powers, the cycle repeats. That’s a hint that \(i\) has something to do with rotation — four quarter-turns bring you back to where you started.
23.1.2 Complex numbers
A complex number is a number of the form:
\[z = a + bi\]
Read it as: “the real part \(a\), plus \(b\) times \(i\).” Here \(a\) and \(b\) are ordinary real numbers. \(a\) is called the real part of \(z\), written \(\operatorname{Re}(z)\). \(b\) is called the imaginary part, written \(\operatorname{Im}(z)\).
Examples: \(3 + 4i\), \(-2 + i\), \(5\) (which is \(5 + 0i\)), \(3i\) (which is \(0 + 3i\)).
Real numbers are a special case: they’re complex numbers where \(b = 0\).
23.1.3 The complex plane
Every complex number \(a + bi\) corresponds to a point in a plane. Put the real axis horizontal and the imaginary axis vertical. The number \(3 + 4i\) is the point three units right and four units up.
This is the Argand diagram, or the complex plane. The horizontal axis is the real line you already know. The vertical axis is entirely imaginary numbers. Every complex number lives at exactly one point in this plane.
Complex numbers appear in physics and engineering, but their geometry is already useful in 2D graphics. Rotating a sprite on a screen by angle \(\theta\) is the same as multiplying its position (written as a complex number \(x + yi\)) by \(\cos\theta + i\sin\theta\). Game engines doing this in bulk use the same arithmetic you are about to practise.
23.2.1 Part 1: Arithmetic
Adding and subtracting complex numbers works the way you’d expect: add the real parts together, add the imaginary parts together.
The key move: \(i^2\) always becomes \(-1\). That’s the entire rule for complex multiplication.
Dividing requires a trick. A complex denominator means the fraction can’t be split into real and imaginary parts yet — you need a real number on the bottom. Multiplying by the conjugate achieves this, because \((a + bi)(a - bi) = a^2 + b^2\), which is always real. The tool is the complex conjugate: if \(z = a + bi\), its conjugate is \(\bar{z} = a - bi\) — same real part, imaginary part negated.
Multiplying a complex number by its conjugate always gives a real number:
The argument of \(z\), written \(\arg(z)\), is the angle the line from the origin to \(z\) makes with the positive real axis. Measured in radians (or degrees):
\[\arg(z) = \arctan\!\left(\frac{b}{a}\right)\]
Be careful with the quadrant. The \(\arctan\) function returns values in the range \((-\pi/2, \pi/2)\), so you need to check whether \(z\) is in the left half of the plane and adjust by \(\pm \pi\) if so.
Together, modulus and argument give two ways to describe the same point: Cartesian form \(a + bi\) and polar form \(r \angle \theta\).
23.2.3 Part 3: Polar form and Euler’s formula
On the unit circle (where \(r = 1\)), the real part of a complex number at angle \(\theta\) is \(\cos\theta\) and the imaginary part is \(\sin\theta\) — by the same definition of cosine and sine used in trigonometry. So any point at distance \(r\) from the origin at angle \(\theta\) is \(r\) times that unit-circle point.
A complex number with modulus \(r\) and argument \(\theta\) can be written as:
\[z = r(\cos\theta + i\sin\theta)\]
This is polar form. Read it as: go distance \(r\) from the origin, at angle \(\theta\) from the positive real axis.
Now for the extraordinary fact. Euler’s formula says:
\[e^{i\theta} = \cos\theta + i\sin\theta\]
This connects the exponential function — which you know from growth and decay — to the trigonometric functions. The proof belongs to calculus (it comes from comparing the Taylor series of \(e^x\), \(\cos x\), and \(\sin x\)), but you can use the result here.
With Euler’s formula, polar form becomes simply:
\[z = re^{i\theta}\]
This is often the cleanest way to write a complex number when you’re multiplying, dividing, or raising to a power.
The famous identity \(e^{i\pi} + 1 = 0\) is just the special case \(\theta = \pi\): \(e^{i\pi} = \cos\pi + i\sin\pi = -1 + 0i = -1\).
In particular, \(i = e^{i\pi/2}\) (since \(\cos(\pi/2) = 0\) and \(\sin(\pi/2) = 1\)). Because multiplication adds arguments, multiplying any complex number by \(i\) adds \(\pi/2\) to its angle — a 90° anticlockwise rotation in the plane.
Check by direct multiplication: \((1+i)^2 = 1 + 2i - 1 = 2i\). Then \((2i)^2 = 4i^2 = -4\). Matches.
Why this works
Multiplying any complex number by \(i\) adds \(\pi/2\) to its angle — a 90° anticlockwise rotation in the complex plane. That’s why \(i^4 = 1\): four quarter-turns bring you back.
Complex multiplication in general is a rotation and scaling operation. When you multiply \(z_1 \cdot z_2\), the moduli multiply (scaling) and the arguments add (rotation). This is exactly why complex numbers are the natural language for anything involving oscillation, phase, and rotation — from AC circuits to quantum wavefunctions to signal processing. The arithmetic of complex numbers is the arithmetic of rotations.
23.3 Worked examples
23.3.1 Example 1 — Engineering: AC circuit impedance
An AC circuit has a resistor and a capacitor in series. The resistor has impedance \(Z_R = 50\,\Omega\) (purely real). The capacitor has impedance \(Z_C = -30i\,\Omega\) (purely imaginary, negative because capacitors shift the phase of current).
The negative angle means the voltage lags behind the current by about 31°, which is the expected behaviour for a capacitive circuit.
23.3.2 Example 2 — Physics: Quantum wavefunction amplitude
In quantum mechanics, a particle in a particular state has a probability amplitude that is a complex number. The probability of measuring that state is the square of the modulus of the amplitude.
Suppose the amplitude is \(\psi = \frac{3}{5} + \frac{4}{5}i\).
A probability of 1 means the particle is certain to be found in this state. The amplitude is normalised — its modulus is 1. This is a constraint quantum mechanics imposes on all valid probability amplitudes: \(|\psi| = 1\).
23.3.3 Example 3 — Computing: FFT butterfly
The Fast Fourier Transform (FFT) is an algorithm that decomposes a signal into its frequency components. Its key step multiplies a complex number by a ‘twiddle factor’ \(W\) — which is just a complex number on the unit circle — to rotate it by a precise angle.
The FFT processes a signal by repeatedly multiplying values by twiddle factors of the form \(W = e^{-2\pi i k/N}\) for various integers \(k\) and \(N\).
In polar terms: multiplication by \(W\) kept the modulus the same (since \(|W| = 1\)) and rotated the point by \(-45°\). The FFT is, at its core, a very efficient way to apply many such rotations simultaneously.
23.4 Where this goes
Polynomials (Vol 3 Ch 3) — every polynomial with real coefficients that has no real roots has complex roots. The quadratic formula \(x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\) gives complex answers when \(b^2 - 4ac < 0\). You can now say exactly what those answers are and verify them by substituting back in. The discriminant is no longer a dead end.
Complex analysis (Vol 7) extends calculus to complex-valued functions. It turns out that calculus in the complex plane is extraordinarily powerful — more constrained than real calculus in ways that produce surprising results, including a method for evaluating real integrals that seem impossible by ordinary means. The Cauchy integral theorem, residues, and conformal mapping all live here. Euler’s formula is the entry point.
Differential calculus (Vol 5) — Euler’s formula \(e^{i\theta} = \cos\theta + i\sin\theta\) is proved by comparing the Taylor series expansions of each side. That proof belongs to calculus, but once you have it, it explains why \(e\), \(i\), \(\pi\), \(1\), and \(0\) are connected: they’re all special values of the same exponential function operating on the complex plane.
Where this shows up
An electrical engineer analysing an AC circuit writes impedance as a complex number, computes its modulus to find the magnitude, and its argument to find the phase shift. The letter \(j\) is used instead of \(i\) in electrical engineering (because \(i\) is already taken for current), but the mathematics is identical.
A physicist writing down the Schrödinger equation is working with a complex-valued wavefunction. The probability of measurement outcomes is the squared modulus of that function.
A software engineer implementing a digital audio filter uses the Discrete Fourier Transform — which is an algorithm entirely built on complex multiplication. The FFT makes this computation fast enough to run in real time.
A control engineer analysing whether a feedback system is stable places poles in the complex plane. Poles in the left half-plane mean the system is stable; poles in the right half-plane mean it oscillates out of control.
23.5 Exercises
These are puzzles. Each one has a clean answer. The interesting part is knowing which form of a complex number to use for which operation.
2. Find the modulus and argument of \(z = -1 + \sqrt{3}\,i\).
Code
{const el =makeStepperHTML(2, [ { op:"Identify real and imaginary parts",eq:"a = -1,\\quad b = \\sqrt{3}",note:null }, { op:"Compute the modulus",eq:"|z| = \\sqrt{(-1)^2 + (\\sqrt{3})^2} = \\sqrt{1 + 3} = \\sqrt{4} = 2",note:null }, { op:"Compute arctan(b/a)",eq:"\\arctan\\!\\left(\\frac{\\sqrt{3}}{-1}\\right) = \\arctan(-\\sqrt{3}) = -\\frac{\\pi}{3}",note:"arctan gives a value in (−π/2, π/2). We must check the quadrant." }, { op:"Adjust for correct quadrant",eq:"z \\text{ is in the second quadrant (a < 0, b > 0), so } \\arg(z) = -\\frac{\\pi}{3} + \\pi = \\frac{2\\pi}{3}",note:"Add π when the real part is negative." }, { op:"State the answer",eq:"|z| = 2,\\quad \\arg(z) = \\frac{2\\pi}{3} \\approx 120°",note:null }, { op:"Check",eq:"2\\!\\left(\\cos\\frac{2\\pi}{3} + i\\sin\\frac{2\\pi}{3}\\right) = 2\\!\\left(-\\frac{1}{2} + \\frac{\\sqrt{3}}{2}i\\right) = -1 + \\sqrt{3}\\,i \\checkmark",note:null }, ]);return el;}
3. Convert \(z = 4e^{i\pi/6}\) to Cartesian form \(a + bi\).
Code
{const el =makeStepperHTML(3, [ { op:"Apply Euler's formula",eq:"z = 4\\!\\left(\\cos\\frac{\\pi}{6} + i\\sin\\frac{\\pi}{6}\\right)",note:"e^{iθ} = cos θ + i sin θ — this is the definition of the exponential on complex numbers." }, { op:"Evaluate the trig values",eq:"\\cos\\frac{\\pi}{6} = \\frac{\\sqrt{3}}{2},\\quad \\sin\\frac{\\pi}{6} = \\frac{1}{2}",note:null }, { op:"Multiply through by 4",eq:"z = 4 \\cdot \\frac{\\sqrt{3}}{2} + 4 \\cdot \\frac{1}{2}\\,i = 2\\sqrt{3} + 2i",note:null }, { op:"Check",eq:"|2\\sqrt{3} + 2i| = \\sqrt{(2\\sqrt{3})^2 + 2^2} = \\sqrt{12 + 4} = \\sqrt{16} = 4 \\checkmark",note:null }, ]);return el;}
4. Compute \((-1 + i)^6\) using de Moivre’s theorem.
Code
{const el =makeStepperHTML(4, [ { op:"Convert to polar form",eq:"|-1 + i| = \\sqrt{1 + 1} = \\sqrt{2},\\quad \\arg(-1 + i) = \\frac{3\\pi}{4}",note:"Real part negative, imaginary part positive: second quadrant." }, { op:"Write in exponential form",eq:"-1 + i = \\sqrt{2}\\,e^{i \\cdot 3\\pi/4}",note:null }, { op:"Apply de Moivre: raise modulus to n, multiply argument by n",eq:"(-1 + i)^6 = (\\sqrt{2})^6 \\cdot e^{i \\cdot 6 \\cdot 3\\pi/4} = 8\\,e^{i \\cdot 9\\pi/2}",note:"(\\sqrt{2})^6 = 2^{6/2} = 2^3 = 8." }, { op:"Reduce the angle mod 2π",eq:"\\frac{9\\pi}{2} = 4\\pi + \\frac{\\pi}{2},\\quad \\text{so } e^{i \\cdot 9\\pi/2} = e^{i\\pi/2} = i",note:"Angles differing by 2π are identical in the complex plane." }, { op:"Write the answer",eq:"(-1 + i)^6 = 8i",note:null }, { op:"Check",eq:"(-1+i)^2 = 1 - 2i + i^2 = -2i;\\quad (-2i)^3 = -8i^3 = -8(-i) = 8i \\checkmark",note:null }, ]);return el;}
5. Divide \(\dfrac{2 + i}{3 - 4i}\).
Code
{const el =makeStepperHTML(5, [ { op:"Multiply numerator and denominator by the conjugate of the denominator",eq:"\\frac{2 + i}{3 - 4i} \\cdot \\frac{3 + 4i}{3 + 4i}",note:"The conjugate of 3 − 4i is 3 + 4i. This clears i from the denominator." }, { op:"Expand the denominator",eq:"(3 - 4i)(3 + 4i) = 9 + 16 = 25",note:"(a − bi)(a + bi) = a² + b² — always real." }, { op:"Expand the numerator",eq:"(2 + i)(3 + 4i) = 6 + 8i + 3i + 4i^2 = 6 + 11i - 4 = 2 + 11i",note:null }, { op:"Write the answer",eq:"\\frac{2 + 11i}{25} = \\frac{2}{25} + \\frac{11}{25}i",note:null }, { op:"Check",eq:"\\left(\\frac{2}{25} + \\frac{11}{25}i\\right)(3 - 4i) = \\frac{1}{25}(2 + 11i)(3 - 4i) = \\frac{1}{25}(6 - 8i + 33i - 44i^2) = \\frac{1}{25}(50 + 25i) = 2 + i \\checkmark",note:null }, ]);return el;}