X heads, Y legs — skip the algebra for now. Guess first, and the answer surfaces itself
The cage holds 12 heads and 40 legs. Don't set up equations yet. Drag the "Rabbits" slider from 0: every extra rabbit turns one chicken into a rabbit, and the total leg count rises by exactly 2. Watch the leg-count chip — the moment it says "exact", you have your answer.
Every guess lands in the attempt log on the right; click any entry to jump back to that guess. Too lazy to drag? Hit "Auto-enumerate" and the lesson walks through every guess for you.
Before you drag anything, answer three questions in your head. Stuck? That's fine — drag a couple of times and it starts to click.
All chickens gives 2 × 12 = 24 legs — 16 short of 40. Each rabbit adds 2, so it takes 16 ÷ 2 = 8 swaps: 8 rabbits and 4 chickens. You probably hit it on your 8th guess too.
With g rabbits there are 12 − g chickens, so the legs total 2×(12−g) + 4×g = 24 + 2g. Each swap adds exactly 2 legs — which is why "short by 16 legs" means exactly 8 swaps. The leg column in the attempt log is really a straight line.
Once you've enumerated a few times, compress it: assume all 12 are chickens. That predicts 24 legs — 16 short of the real 40. Each rabbit adds 2, so rabbits = (40 − 24) ÷ 2 = 8, chickens = 12 − 8 = 4. The formula lands exactly where your trial-and-error did.
In general: rabbits = (legs − 2 × heads) ÷ 2, chickens = heads − rabbits. Change the puzzle and the two methods always agree.
Tool: Heads and Legs explorer. Chinese version: 鸡兔同笼探究课件. Also try the phone plan comparison lesson.