Winding numbers and domain coloring
Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Domain coloring maps complex outputs to hues (direction) and brightness (distance), making zeros appear black because the output has no direction at 0.
Briefing
Winding numbers turn a visually intuitive “colorful loop” idea into a reliable two-dimensional equation solver—one that can guarantee a zero exists inside a region and do so efficiently by checking only boundary loops. The key upgrade is replacing a fragile criterion (“the loop hits every color”) with a robust, additive invariant: how many times the function’s output winds around the origin as the input traces a loop. When that winding number is non-zero, at least one subregion created by splitting the loop must also have non-zero winding, so the search can keep halving until it homes in on an actual solution.
The setup begins with the familiar one-dimensional logic for solving f(x)=0. If a continuous function takes opposite signs at two points, continuity forces a zero in between; bisection repeatedly shrinks an interval whose endpoints straddle the sign change. Extending this to two dimensions requires an analog of “sign.” Complex numbers provide a natural 2D target: their outputs have direction (angle) and magnitude, and domain coloring assigns a hue to direction and brightness to distance from the origin. In this scheme, zeros appear as black because the output has no direction there.
A tempting first attempt mimics the 1D sign test: if the boundary of a region maps to outputs that sweep through every direction (every hue), perhaps a zero must lie inside. Tiny loops around a nonzero output point look nearly constant in color, so only the true zero can sustain the full rainbow as loops shrink. But the property fails under region splitting: two subregions can each have boundaries that miss some colors, yet together their combined boundary can still sweep all colors. That means the naive “all colors” criterion doesn’t combine predictably, so the algorithm can stop without finding a zero.
The fix is to track not just which colors appear, but the direction of their progression around the color wheel. As the input walks clockwise along a loop, the output’s hue can advance clockwise through the rainbow or counterclockwise; the net effect is measured by a winding number. This number behaves like an odometer: clockwise winding increases it, counterclockwise winding decreases it, and reversing a path cancels winding exactly. Crucially, winding numbers add when paths combine, and—via the same oriented-border cancellation logic behind Stokes’ theorem—winding numbers on region boundaries add correctly when regions are merged.
With that stronger invariant, the earlier failure mode disappears. A loop whose boundary has non-zero winding cannot split into two halves where both have zero winding, because the totals would have to add to zero. Therefore, repeatedly halving a region while preserving a non-zero winding condition guarantees the search keeps narrowing toward a point where the output is actually zero. The method is also efficient: it checks winding on boundary loops rather than evaluating the function everywhere in the interior.
Applied to complex equations, the algorithm finds zeros of examples like x^5 − x − 1 over the complex plane, converging to multiple roots by repeatedly splitting regions with non-zero winding. The discussion also connects winding behavior to theory: for a polynomial with leading term x^n, large loops wind n times around the origin, ensuring at least one zero inside—an algorithmic reflection of the fundamental theorem of algebra. The winding-number machinery thus serves both practical computation and topological-style existence guarantees, with further topology applications promised in a follow-up.
Cornell Notes
Winding numbers provide a dependable way to solve two-dimensional equations by guaranteeing a zero inside a region when the function’s boundary loop winds around the origin a non-zero number of times. Domain coloring turns complex outputs into hues (direction) and brightness (distance), making zeros appear black. A naive “boundary hits every color” rule fails because that property doesn’t combine well when regions are split. Tracking the net clockwise vs counterclockwise progress around the color wheel yields an integer winding number that adds correctly for combined paths and region boundaries. With non-zero winding, splitting a region always leaves at least one subregion with non-zero winding, so repeated halving converges to an actual zero while only sampling boundary loops.
Why does the 1D sign-change idea work for finding zeros, and what is the 2D analog being attempted first?
What goes wrong with the “boundary hits every color” criterion when splitting regions?
How is winding number defined in this setting, and why does it fix the combining problem?
Why does non-zero winding guarantee that at least one half-region still contains a zero?
How does the algorithm achieve efficiency compared with brute-force sampling?
What does the winding number imply about complex polynomials and the fundamental theorem of algebra?
Review Questions
- How does winding number differ from the simpler “boundary hits every color” test, and why does that difference matter when regions are split?
- Explain how clockwise vs counterclockwise movement through the color wheel affects the sign of winding number.
- Why does checking boundary loops (rather than interior points) still allow a guaranteed convergence to zeros?
Key Points
- 1
Domain coloring maps complex outputs to hues (direction) and brightness (distance), making zeros appear black because the output has no direction at 0.
- 2
A 1D zero-finding strategy based on sign changes does not directly carry over to 2D if “all colors on the boundary” is used as the criterion.
- 3
The winding number measures the net number of clockwise turns the output makes around the origin as the input traces a loop.
- 4
Winding numbers add correctly when paths and oriented region boundaries are combined, with cancellations when segments are traversed in opposite directions.
- 5
A non-zero winding number on a region’s boundary guarantees that at least one subregion produced by splitting also has non-zero winding, enabling reliable bisection.
- 6
The resulting algorithm converges by repeatedly shrinking regions while computing winding only along boundaries, making it efficient compared with full-area search.
- 7
For complex polynomials, the leading term x^n forces large loops to wind n times, supporting existence guarantees consistent with the fundamental theorem of algebra.