↑ ↓ to move · enter to open

Interactive math explainers

visual math

Classic problems you can run, step through and break. Each one shows the machinery at work, right next to the math that explains it.

73 explainers · 9 subjects · 227 labs · open any number to start

Math & science000 – 007 · 027 – 028

000Combinatorics · backtracking

N-Queens

Place N queens so none attack. Watch backtracking try, fail and back up, with the call stack and diagonal math live.

  • Step-through search on boards up to 20×20
  • Search space shrinking from C(N², N) to the answers
  • Exact counts to N = 27
Open 000 →
001Irrational numbers

The golden ratio

φ = 1.618…: the number in Fibonacci ratios, sunflower heads and pentagrams, and the hardest number to approximate with fractions.

  • Fibonacci rectangle and spiral
  • Fibonacci ratios closing in on φ
  • Sunflower seeds at the golden angle
  • Continued fraction of 1s
Open 001 →
002Graph theory

Graphs

Draw walls and race BFS, Dijkstra, A* and greedy search. Grow spanning trees two ways. Try to cross the bridges of Königsberg.

  • Shortest paths through walls and mud
  • Kruskal vs. Prim
  • Euler and the seven bridges
Open 002 →
003Primes · iteration · divisibility

Number theory

Sieve out the primes and spot them on the Ulam spiral. Follow the Collatz conjecture through its coral. Tile rectangles with Euclid.

  • Sieve of Eratosthenes and Ulam spiral
  • Collatz paths and record holders
  • Euclid's algorithm as squares
Open 003 →
004Algorithms

Dynamic programming

Solve each small problem once and write it in a table. Watch cells fill from their neighbors, then trace the answer back.

  • Edit distance and longest common subsequence
  • 0/1 knapsack vs. greedy
  • Pascal's triangle fractals
Open 004 →
005Self-similarity

Recursion & fractals

A problem solved by smaller copies of itself, drawn instead of run. From the Tower of Hanoi to the Mandelbrot set.

  • Tower of Hanoi with its recursion tree
  • Koch, Sierpiński and fractal trees
  • Zoomable Mandelbrot with orbits
Open 005 →
006Simulation

Probability

Randomness that settles on a number: why switching wins at Monty Hall, π from dropped needles, and a bell curve from bouncing balls.

  • Monty Hall: play it, then simulate it
  • Buffon's needle estimates π
  • Galton board and the central limit theorem
Open 006 →
007Puzzle · number bases

Bachet's weights

Four weights, 1, 3, 9 and 27, measure every load from 1 to 40 on a balance. The secret is a number system whose digits are −1, 0 and +1.

  • A working balance scale
  • Balanced ternary, step by step
  • Can you beat 1, 3, 9, 27?
Open 007 →
027Geometry · series · digits

Pi

Archimedes' polygons, darts at a square, a race of infinite sums, π turning up where no circle is, and a million digits drawn as a glowing random walk.

  • Squeezing the circle
  • Darts at a square
  • A race of infinite sums
  • π shows up uninvited
  • A million digits
Open 027 →
028Groups · permutations · search

Rubik's cube

Forty-three quintillion positions, every one reachable in 20 moves. Turn the cube, find how many times a move repeats before it undoes itself, and watch a 2×2 get solved perfectly.

  • A cube you can turn
  • Moves are permutations
  • The shortest solution
Open 028 →

Coding problems009 – 021 · easy to expert

008 EasyConditionals · modulo

FizzBuzz

The classic warm-up, taken apart: why branch order matters, why the pattern repeats every 15, and how to scale to any rules.

  • The stream 1 to 100
  • Modulo as clocks
  • Your own rules
Open 008 →
009 EasyStrings · two pointers

Palindromes

Check a phrase with two pointers, find the longest palindrome inside a string, and chase numbers that refuse to become palindromes.

  • Two pointers
  • Expand around center
  • Reverse and add
Open 009 →
010 EasyRecursion · memoization

Fibonacci

Watch the naive call tree explode, collapse it with a memo, then compute F(1000) in a handful of steps.

  • Naive recursion
  • Memoization
  • Iteration and fast doubling
Open 010 →
011 EasyHash maps

Two Sum

Every pair versus one pass with a hash map: the same answer with n² work or n.

  • Brute-force pair grid
  • One-pass hash map
  • Race and the two-pointer variant
Open 011 →
012 IntermediateMapping · iteration

Roman numerals

Read MCMXCIV with one look-ahead, write any number back greedily, and see why the system stops at 3999.

  • Roman to integer
  • Integer to Roman
  • Patterns and limits
Open 012 →
013 IntermediateIn-place manipulation

Rotate an array

Three reversals rotate an array in place. Cyclic replacement splits into gcd(n, k) cycles.

  • The obvious ways
  • Three reversals
  • Cyclic replacements
Open 013 →
014 IntermediateMath · bit tricks

The missing number

Gauss's sum and XOR cancellation both find the one number missing from 0..n in a single pass with no extra memory.

  • Gauss's sum
  • XOR cancellation
  • Other routes compared
Open 014 →
015 IntermediateTree traversal

Validate a BST

Pass allowed ranges down the tree, or read it in order. Watch the classic trap that a parent-only check misses.

  • The bounds method
  • In-order traversal
  • Build by insertion
Open 015 →
016 AdvancedBacktracking

Sudoku solver

Backtracking on a 9×9 grid, then smarter cell order and constraint propagation that cut the search by orders of magnitude.

  • Backtracking
  • Smarter order
  • Why it's hard or easy
Open 016 →
017 AdvancedTree recursion

Lowest common ancestor

Pick two nodes and watch answers flow up the recursion, then split a BST and jump up a deep tree in powers of two.

  • Recursive LCA
  • The BST shortcut
  • Binary lifting
Open 017 →
018 AdvancedTraversal · encoding

Serialize a tree

Flatten a tree into a string with null markers, rebuild it token by token, and see which encodings are ambiguous.

  • Serialize
  • Deserialize
  • Formats compared
Open 018 →
019 ExpertGraphs · ordering

Topological sort

Order tasks so every prerequisite comes first, with Kahn's queue and with DFS finish times, and catch the cycles that make it impossible.

  • Kahn's algorithm
  • DFS finishing order
  • Cycles and choices
Open 019 →
020 ExpertDynamic programming

Regex matching

Match . and * with a DP table, compare it with memoized recursion, and watch naive backtracking blow up.

  • The DP table
  • Recursion and memo
  • Catastrophic backtracking
Open 020 →
021 ExpertGraphs · topological sort

Alien dictionary

Recover an unknown alphabet from a sorted word list: read the clues, build the letter graph, sort it, and spot broken dictionaries.

  • Reading the clues
  • From clues to alphabet
  • When the dictionary is broken
Open 021 →

Game theory022 – 026 · strategy, equilibrium, play

Data & statisticsD00 – D04 · numbers that persuade, and mislead

Weather & skyW00 – W14 · the physics overhead

W00Physics · rotation · chaos

Hurricanes

Why storms spin, why they spin faster near the eye, why each category is so much worse, and why the forecast cone widens.

  • Coriolis effect at any latitude
  • Angular momentum and the eye
  • The cube law of wind power
  • Ensemble cone and the Lorenz butterfly
Open W00 →
W01Physics · vortices · radar

Tornadoes

A funnel drawn from the pressure field, spin tilted upright by an updraft, the right side that hits harder, and the radar couplet that gives a tornado away.

  • Rankine vortex and the funnel cloud
  • Tilting horizontal spin upright
  • Moving vortex and its damage path
  • Doppler radar velocity couplet
Open W01 →
W02Pressure · rotation · fronts

Highs & lows

Air rushes from high to low pressure, the spinning Earth turns it sideways, and friction lets it spiral in. Fronts lift the warm air.

  • Pressure gradient, Coriolis, friction
  • Geostrophic balance
  • Fronts and the life of a low
Open W02 →
W03Ocean · waves · feedback

El Niño

Trade winds tilt the Pacific, Kelvin waves carry warmth east, and a delayed feedback makes the whole system oscillate.

  • The Pacific seesaw
  • Kelvin waves cross the ocean
  • Why it oscillates
Open W03 →
W04Heat transport · balance

Global circulation

Three convection loops per hemisphere carry heat poleward. Hydrostatic balance and angular momentum decide where each one ends.

  • Hadley, Ferrel and polar cells
  • Hydrostatic balance and scale height
  • Why the Hadley cell stops near 30°
Open W04 →
W05Buoyancy · latent heat

Thunderstorms

Lift a parcel through a sounding, measure its CAPE, watch latent heat power the updraft, and see cold pools organize storm lines.

  • Lift a parcel
  • Latent heat is the engine
  • Organizing into lines
Open W05 →
W06Equations · grids · chaos

Weather models

Forecasts come from chopping the sky into boxes and stepping the physics forward. Grids, stability limits and chaos set the rules.

  • The equations
  • Chop the sky into boxes
  • Chaos and ensembles
Open W06 →
W07Charge · breakdown · sound

Lightning

Colliding ice charges the cloud until the air gives way. The leader grows like a fractal, and the thunder tells you how far.

  • Charging the cloud
  • The stepped leader as a fractal
  • Flash to bang
Open W07 →
W08Optics · refraction

Rainbows

Every ray through a raindrop bends, reflects and bends again. They pile up at 42°, split by color.

  • Inside a raindrop
  • Colors split
  • Where rainbows appear
Open W08 →
W09Optics · scattering

Sky color

Air scatters blue light about six times more than red. Low sun means a long path, so only red gets through.

  • The 1/λ⁴ law
  • Sunset path length
  • Molecules vs droplets
Open W09 →
W10Gravity · harmonics

Tides

The Moon pulls the near side harder than the far side, stretching the ocean into two bulges. Add the Sun and they beat.

  • Stretching the Earth
  • Sun + Moon
  • Tide prediction by harmonics
Open W10 →
W11Thermal wind · Rossby waves

Jet streams

The jet forms where cold air meets warm. Planetary waves bend it into ridges and troughs that steer storms.

  • Thermal wind
  • Rossby waves around the pole
  • Ridges, troughs and your weather
Open W11 →
W12Heat capacity · circulation

Sea breezes

Land warms faster than water. By afternoon the pressure tilts and cool air blows in off the sea.

  • Why land heats faster
  • The circulation
  • The sea-breeze front
Open W12 →
W13Fetch · instability

Lake-effect snow

Arctic air crossing open water picks up heat and moisture, then dumps it as narrow bands of heavy snow.

  • The ingredients
  • Fetch and wind direction
  • Inside the band
Open W13 →
W14Seasonal heating · the ITCZ

Monsoons

A sea breeze the size of a continent: the land heats, the winds reverse, and mountains wring out the rain.

  • Seasonal heating
  • Crossing the equator
  • Mountains wring out the rain
Open W14 →

Everyday physicsE00 – E10 · the math in things you use

E00Forces · curves

Bridges & arches

A hanging chain finds the catenary on its own. Flip it into an arch that only pushes, then solve the forces inside a truss.

  • The shape of a hanging chain
  • Flip it and it stands
  • Beams, trusses and suspension
Open E00 →
E01Balance · steering

Why bikes stay up

Riders stay up by steering into the fall. Trail makes the front wheel help, and the real story of gyroscopes is smaller than you think.

  • Steering into the fall
  • The bike that steers itself
  • Gyroscopes and speed
Open E01 →
E02Waves · flow

Traffic jams

One tap of the brakes makes a jam that drifts backward for miles. Find the density that moves the most cars, and why zippers win.

  • A jam from nothing
  • Flow, density, speed
  • Merging and the zipper
Open E02 →
E03Torque · mechanical advantage

Levers, pulleys & gears

Every simple machine trades distance for force. Balance a lever, rig a block and tackle, and pick the right bike gear.

  • Move the world with a lever
  • Pulleys trade rope for force
  • Gears and bike gears
Open E03 →
E04Lift · drag

Why planes fly

Wings fly by turning air downward. Watch the flow bend, feel the lift equation, find the stall, and work out how far a plane can glide.

  • Turning air downward
  • The lift equation
  • The four forces
Open E04 →
E05Apparent wind · lift

How sailboats sail upwind

The wind you feel isn't the wind that's blowing. Turn it into lift, let the keel push back, and zigzag your way upwind.

  • The wind you feel
  • A sail is a wing, a keel is a wing
  • Zigzag to go upwind
Open E05 →
E06Waves · drag

Hull speed & planing

A boat climbs its own bow wave and hits a wall of drag near 1.34 × √length. Longer boats go faster; planing hulls jump the wave.

  • A boat makes its own wave
  • The wall of drag
  • Longer is faster
Open E06 →
E07Buoyancy · torque

Why sailboats don't tip over

Weight pulls down, buoyancy pushes up, and the gap between them twists the boat back upright, until it doesn't.

  • Two forces, one twist
  • The righting-arm curve
Open E07 →
E08Charts · bearings · vectors

Navigation at sea

A nautical mile is a minute of latitude. Find yourself from three compass bearings, and aim upstream to cross a current in a straight line.

  • A mile is a minute
  • Where am I?
  • Steering against the current
Open E08 →
E09Tide tables · depth · streams

Tides for sailors

How deep is it right now? The rule of twelfths, under-keel clearance over a bar, and timing a passage so the tide carries you.

  • How high, and when
  • Will I clear?
  • Rivers in the sea
Open E09 →
E10Spin · drag · impact

Tennis physics

Topspin pulls the ball down into the court, the racket has two different sweet spots, and a big serve gives you about half a second.

  • Topspin makes it dip
  • The sweet spot
  • The bounce and the serve
Open E10 →

Sound & musicS00 – S04 · waves you can hear

How computers workC00 – C04 · from switches to the internet

AI & machine learningC05 – C07 · the math behind the magic

Connectionshow they link up