• Free
  • Grade 6–8
  • Challenge · boxes with edges up to 6, 8 or 10

A diagonal through a box worksheets

Push a straight rod from one corner of a box of unit cubes to the opposite corner. It clips some cubes and misses others — and counting them one by one is hopeless for a big box, so the trick is to count the walls it crosses instead.

  • Answer key included
  • Reopen this exact sheet
  • Letter & A4 ready
Ready to printA diagonal through a box
A diagonal through a box worksheet — Challenge · boxes with edges up to 6, 8 or 10, free printable with answer key

The answer key prints on a separate page.

What's on this sheet

The rod enters a new little cube every time it crosses an inside wall, so a first guess is just how many walls there are: a + b + c. But that over-counts, because sometimes the rod crosses two walls at the very same point — it slips through the shared edge of two cubes and only enters ONE new cube, not two. How often that happens for each pair of directions is exactly the greatest common divisor of those two edge lengths, so the three pairwise GCDs come off the total.

Why this sheet works

Take one off too many, though: where all three walls meet at a single lattice point, the correction was applied twice, so the GCD of all three edges is added back. The whole count is a + b + c − gcd(a,b) − gcd(b,c) − gcd(c,a) + gcd(a,b,c) — inclusion and exclusion made physical, and a first glimpse of why the humble GCD is really about geometry.