Get AI summaries of any video or article — Sign up free
Winding numbers and domain coloring thumbnail

Winding numbers and domain coloring

3Blue1Brown·
6 min read

Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

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?

In one dimension, continuity implies that if f(x) is positive at one endpoint of an interval and negative at the other, then some point inside must satisfy f(x)=0. The first 2D analog tries to replace “sign” with “direction coverage”: using domain coloring for complex outputs, it looks at a region’s boundary loop and asks whether the output sweeps through every possible direction (every hue). The hope is that such a boundary rainbow forces a zero inside, just as opposite signs force a crossing in 1D.

What goes wrong with the “boundary hits every color” criterion when splitting regions?

The criterion is not stable under combining/splitting. Two subregions can each have boundary images that miss some hues, yet when those subregions are combined, the overall boundary can still sweep through every color. That means a bisection-style algorithm can reach subregions whose boundaries no longer show full color coverage, leaving no guaranteed place to continue—even if a zero exists somewhere in the original region.

How is winding number defined in this setting, and why does it fix the combining problem?

As the input traces a loop clockwise, the output’s hue moves around the color wheel. Moving through the rainbow in the clockwise order contributes positive winding; moving in the opposite order contributes negative winding. The winding number is the net total turns (an integer) the output makes around the origin as the loop is traversed. Unlike “all colors,” winding numbers add predictably when paths are concatenated or when region boundaries are combined, with cancellations occurring when one path retraces another in reverse.

Why does non-zero winding guarantee that at least one half-region still contains a zero?

When a region is split, the winding number along the boundary of the larger region equals the sum of the winding numbers along the boundaries of the parts, with internal boundary segments canceling due to opposite orientations. If the original boundary has non-zero winding, the two halves cannot both have winding number zero; otherwise their sum would be zero. So at least one subregion retains non-zero winding, keeping the search guaranteed to continue toward a zero.

How does the algorithm achieve efficiency compared with brute-force sampling?

It avoids evaluating the function across the entire interior. Each step computes winding information using only the boundary loop (and then the boundaries of subregions). Because the search repeatedly halves the region, the amount of work scales more with perimeter sampling than with full-area coverage, making it far more efficient than checking every pixel/point inside.

What does the winding number imply about complex polynomials and the fundamental theorem of algebra?

For complex polynomials, large loops around the input origin are dominated by the leading term. If the leading term is x^n, then for sufficiently large loops the output winds around the origin n times as the input loop winds once. That forces a non-zero winding condition for large regions, guaranteeing at least one zero inside. This existence guarantee is the same core idea behind the fundamental theorem of algebra.

Review Questions

  1. How does winding number differ from the simpler “boundary hits every color” test, and why does that difference matter when regions are split?
  2. Explain how clockwise vs counterclockwise movement through the color wheel affects the sign of winding number.
  3. Why does checking boundary loops (rather than interior points) still allow a guaranteed convergence to zeros?

Key Points

  1. 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. 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. 3

    The winding number measures the net number of clockwise turns the output makes around the origin as the input traces a loop.

  4. 4

    Winding numbers add correctly when paths and oriented region boundaries are combined, with cancellations when segments are traversed in opposite directions.

  5. 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. 6

    The resulting algorithm converges by repeatedly shrinking regions while computing winding only along boundaries, making it efficient compared with full-area search.

  7. 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.

Highlights

The breakthrough is replacing a fragile rainbow-coverage test with an integer winding invariant that behaves predictably under splitting.
Non-zero winding number is the “always works” condition: it survives bisection, so the search cannot get stuck without a zero.
Winding numbers act like an odometer—clockwise advances count positively, counterclockwise counts negatively, and retracing cancels exactly.
The method turns complex root finding into a boundary-only computation, avoiding brute-force evaluation across the plane.
Large complex polynomial loops wind according to the leading term, linking computation to the fundamental theorem of algebra.

Topics

  • Domain Coloring
  • Winding Numbers
  • Two-Dimensional Root Finding
  • Complex Polynomials
  • Topology Connection

Mentioned

  • Sridhar Ramesh