pigeonhole-principle

← ~/visualizations

pigeonhole-principle #

Shows n labeled boxes and m discrete items being assigned (mapped) into exactly one box each. The animation alternates between m=n (items can fit one-per-box) and m=n+1, where the extra item forces a collision so at least one box visibly contains 2+ items, illustrating the pigeonhole implication m>n ⇒ some box has ≥2 items.

canvasclick to interact

⏮◀◀▶▶STEP0.25x1xZOOM

t=0s

practical uses #

technical notes #

Pure Canvas2D, time-cycled 4.2s loop with two steps (m=n then m=n+1). Items interpolate from a start row into snapped grid slots inside boxes using ease(). Counts per box are computed from a deterministic assignment; the colliding box is highlighted and labeled with a ≥2 badge. Layout is responsive via scale = min(w,h)/240 and 6px-ish snapping for a blocky aesthetic.

← information-theoretic-boundslagrangian-duality →