Interactive math explainers
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
Place N queens so none attack. Watch backtracking try, fail and back up, with the call stack and diagonal math live.
φ = 1.618…: the number in Fibonacci ratios, sunflower heads and pentagrams, and the hardest number to approximate with fractions.
Draw walls and race BFS, Dijkstra, A* and greedy search. Grow spanning trees two ways. Try to cross the bridges of Königsberg.
Sieve out the primes and spot them on the Ulam spiral. Follow the Collatz conjecture through its coral. Tile rectangles with Euclid.
Solve each small problem once and write it in a table. Watch cells fill from their neighbors, then trace the answer back.
A problem solved by smaller copies of itself, drawn instead of run. From the Tower of Hanoi to the Mandelbrot set.
Randomness that settles on a number: why switching wins at Monty Hall, π from dropped needles, and a bell curve from bouncing balls.
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.
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.
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.
The classic warm-up, taken apart: why branch order matters, why the pattern repeats every 15, and how to scale to any rules.
Check a phrase with two pointers, find the longest palindrome inside a string, and chase numbers that refuse to become palindromes.
Watch the naive call tree explode, collapse it with a memo, then compute F(1000) in a handful of steps.
Every pair versus one pass with a hash map: the same answer with n² work or n.
Read MCMXCIV with one look-ahead, write any number back greedily, and see why the system stops at 3999.
Three reversals rotate an array in place. Cyclic replacement splits into gcd(n, k) cycles.
Gauss's sum and XOR cancellation both find the one number missing from 0..n in a single pass with no extra memory.
Pass allowed ranges down the tree, or read it in order. Watch the classic trap that a parent-only check misses.
Backtracking on a 9×9 grid, then smarter cell order and constraint propagation that cut the search by orders of magnitude.
Pick two nodes and watch answers flow up the recursion, then split a BST and jump up a deep tree in powers of two.
Flatten a tree into a string with null markers, rebuild it token by token, and see which encodings are ambiguous.
Order tasks so every prerequisite comes first, with Kahn's queue and with DFS finish times, and catch the cycles that make it impossible.
Match . and * with a DP table, compare it with memoized recursion, and watch naive backtracking blow up.
Recover an unknown alphabet from a sorted word list: read the clues, build the letter graph, sort it, and spot broken dictionaries.
Betraying is best whatever the other does, so both betray and both lose. Repeat the game and cooperation can win.
Pick a number closest to two thirds of the average. Logic says 0. Winning against real people takes something else.
Take the pot or pass it and let it grow. Backward induction says take it at once. Most people don’t.
XOR the piles: zero means the player to move loses. The same idea solves every impartial game.
When any pattern can be exploited, randomize so that the opponent can’t gain by guessing.
A thousand people can speak for a nation if they’re chosen at random. See what ±3% promises, and the biases it can’t catch.
The same numbers tell two stories. Measure the lie factor of a cropped axis, a swollen pictogram and a cherry-picked window.
A treatment wins in every group and loses overall. Move people between groups and watch the paradox appear and vanish.
Measure how two things move together, then find the hidden third thing behind the link, and see why random assignment settles it.
A 99% accurate test for a rare disease is wrong most of the time it says yes. Bayes’ theorem shows why, with ten thousand dots.
Why storms spin, why they spin faster near the eye, why each category is so much worse, and why the forecast cone widens.
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.
Air rushes from high to low pressure, the spinning Earth turns it sideways, and friction lets it spiral in. Fronts lift the warm air.
Trade winds tilt the Pacific, Kelvin waves carry warmth east, and a delayed feedback makes the whole system oscillate.
Three convection loops per hemisphere carry heat poleward. Hydrostatic balance and angular momentum decide where each one ends.
Lift a parcel through a sounding, measure its CAPE, watch latent heat power the updraft, and see cold pools organize storm lines.
Forecasts come from chopping the sky into boxes and stepping the physics forward. Grids, stability limits and chaos set the rules.
Colliding ice charges the cloud until the air gives way. The leader grows like a fractal, and the thunder tells you how far.
Every ray through a raindrop bends, reflects and bends again. They pile up at 42°, split by color.
Air scatters blue light about six times more than red. Low sun means a long path, so only red gets through.
The Moon pulls the near side harder than the far side, stretching the ocean into two bulges. Add the Sun and they beat.
The jet forms where cold air meets warm. Planetary waves bend it into ridges and troughs that steer storms.
Land warms faster than water. By afternoon the pressure tilts and cool air blows in off the sea.
Arctic air crossing open water picks up heat and moisture, then dumps it as narrow bands of heavy snow.
A sea breeze the size of a continent: the land heats, the winds reverse, and mountains wring out the rain.
A hanging chain finds the catenary on its own. Flip it into an arch that only pushes, then solve the forces inside a truss.
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.
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.
Every simple machine trades distance for force. Balance a lever, rig a block and tackle, and pick the right bike gear.
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.
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.
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.
Weight pulls down, buoyancy pushes up, and the gap between them twists the boat back upright, until it doesn't.
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.
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.
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.
Pluck a string and watch it split into halves, thirds and quarters. Mix those harmonics to build a flute, a clarinet or a violin.
Sweet intervals are simple ratios. Stack twelve perfect fifths and miss by a comma, then see how the twelfth root of two splits the difference.
Wind any signal around a circle to find the frequencies inside it, then redraw a picture with nothing but spinning circles.
Why a siren drops in pitch as it passes, what happens when a plane outruns its own sound, and how a radar gun clocks a car.
Turn sound into numbers, find the sounds your ears ignore, and keep only the big coefficients: a CD shrinks about eleven times.
Everything a computer holds is a row of switches. Flip eight of them to make a number, a letter or a negative, then see why 0.1 + 0.2 misses 0.3.
Gates that add, a toy processor you can step one instruction at a time, and the tricks that let real chips do billions of them a second.
Memory is a long street of numbered boxes. Follow a pointer, measure how far away the data really is, and watch a cache reward neighbors.
A message leaves as numbered packets, finds its own way across a web of routers, survives lost pieces, and is reassembled in order.
Fingerprints you can’t run backwards, a shared secret agreed in public, and RSA built from primes and Euclid’s algorithm.
Learning is rolling downhill on a surface of mistakes. Train a line, then a small neural network, and catch a model memorizing instead of learning.
Meaning becomes coordinates and similarity becomes an angle. See how a vector database finds the nearest meaning without checking everything.
Chop text into tokens, guess the next one from a probability table, let attention decide which words matter, and loop.