# Mathematical Diversions with Toothpicks

# BLOG: Heidelberg Laureate Forum

As well as the wonderful opportunities presented to visitors at the HLF – to network with and hear from leading mathematicians and computer scientists, and to meet young researchers from all over the world – there are plenty of other bonuses to attending. From the extravagant dinners and exciting trips, to the on-tap coffee and pastries – and of course, the exciting freebies.

This year, the conference bags (which are, incidentally, an ingenious use of old vinyl banners, repurposed into stylish satchels) contain the usual conference merchandise – an HLF pen, fancy notebook, sticky notes and keyring – and a pack of 10 HLF-branded toothpicks.

The versatility and utility of this gift might bypass many – you might even think that these are merely useful for getting bits of food out from between one’s teeth – but in fact mathematicians can find any number of ways to amuse themselves with simple household objects, so I present a selection of ways to use your toothpicks to explore mathematical ideas.

## Matchstick puzzles

There are plenty of classic puzzles, ranging in difficulty, which involve forming shapes and equations from matchsticks. I’ve put together some examples below, which you’re welcome to try (but don’t spoil the answers for anyone else in the comments!)

The coin is inside the ‘wine glass’. Move two toothpicks so that the coin is outside the wine glass. (The glass should not change shape or size.)

This figure has only 2 complete squares. Move 2 sticks to form 3 squares, all equal in size.

Starting with the configuration shown, move one of the two vertical matchsticks (not the horizontal one!) to create a figure with three right angles. Can you find all the possible configurations?

How many are there? One example is shown here.

Move two toothpicks, leaving no triangles. (This one is a bit tricky!)

Thanks to the Matchstick Puzzles blog for the ideas (where you’ll also find solutions for the puzzles, if you give up already). These types of problems are often employed by teachers at the school level to stimulate mathematical thinking, but they can also be a fun diversion while you’re waiting for the coach to take you up to Heidelberg Castle.

## Buffon’s Needle Experiment

Toothpicks, surprisingly, provide us with a way to approximate the value of π. Buffon’s Needle experiment requires a flat surface with parallel lines, exactly one toothpick (needle)’s length apart. Dropping a needle (toothpick) onto this surface randomly leads to the neat mathematical fact that the toothpick will cross one of your lines with probability 2/π (around 63%).

This curious coincidence is related to the fact that a falling toothpick could land with its centre in any position, but more importantly it can be pointing in any direction, and the space of possible directions can be represented by a circle. The proportion of toothpicks which land exactly between two lines and don’t cross one is related to the area of the circle, which is why a factor of π comes in.

This means if we have enough toothpicks – maybe the 10 in my bag won’t suffice, but if we ask all the young researchers and laureates to contribute, too – we could drop a whole pile of them onto a surface ruled with lines the right distance apart, and after some careful counting and calculation we could come up with an approximation to π. Surely this is a great way to occupy ourselves while we’re waiting patiently for the next laureate lecture to start?

## A game of Nim

Toothpicks can also be used to play the mathematical game of Nim, a version of which is playable in the I AM A.I. exhibition which HLF participants and the general public can find in the Senate Hall of the Old University during the HLF (on tour from its usual location at the MAINS in Heidelberg). The game there is three-pile Nim, but a simple single-pile game could be played with your toothpicks: choose an opponent, and challenge them to a quick game between courses at dinner.

The rules of Nim are simple: players take it in turns to remove one, two or three toothpicks from the pile, and the winner is the person who takes the last toothpick. Variations exist (with different numbers of toothpicks you’re allowed to remove, and with different starting numbers, or a variation where the person who takes the last one loses). But in all cases, as long as you’re clear on the rules, it’s possible to come up with a winning strategy.

If you’re looking at the pack of toothpicks we got in our bags and the standard rules above, there are 10 toothpicks in the pile, and you can remove one, two or three. If you get to go first, there’s a clear optimal move that puts you in a winning position (again, no spoilers in the comments) – a good way to discover it is to play a few games and see if any patterns emerge, in particular around situations where you realise one player can’t possibly win.

For a more complicated variation, why not try Fibonacci Nim – you need 21 toothpicks, so you might need to ask your friend to lend you the ones from their bag too, and borrow one from a nearby spectator. On each turn you may take **up to twice as many** toothpicks as the other player did on their last move (an obvious restriction being you’re not allowed to take all the picks on your first go). The optimal strategy for this game is more complicated, and there’s a clue in the name of the game as to which famous number sequence is involved.

Hopefully these options will provide plenty of distraction for laureates and young researchers who are standing outside the University waiting for their COVID test results – and if you’re not lucky enough to be attending the HLF, maybe you can find some toothpicks, matchsticks or twigs to use instead.

Excellent!