Flipping out

Matt Parker, employing the enviably pithy prose typical of a content creator forged on the unforgiving fires of social media, asked the simple question back in 2018:

How thick is a three-sided coin?

Translated into mathematician-ese, this means

What aspect ratio of a flipped coin leads to the chance of landing on either edge being the same as landing on a particular face?

Such is Matt’s reach that this question has been answered thoroughly manytimesbefore, but that’s never discouraged us. Let’s take a look.

Web app

Graphic design isn’t one of my strengths

First things first – if you want to get an empirical feeling for yourself for an idealised 2D coin, take a look at the little coin-flipping experiment I wrote here:

Flip some coins!

(bad) source here

The toy above uses the Matter.js library – definitely worth playing with if you’re into this kind of thing! My machine gets pretty slow above a few thousand coins, but feel free to crank it if you’re feeling adventurous.


Look, I said I wasn’t good at design. This is a coin, alright?

Above, you can see an excellently rendered depiction of a coin, as seen from the side. The radius of the coin is r, and the half-height is h. The angle subtended by half of the thin side is \alpha.

Note – here and below (and above, actually), we’ll treat the coin as a simple 2D rectangle.

Say that the chance of landing on an edge is P(h) – that is, some probability which changes as a function of h (assuming that r remains fixed). We already know a few things about P(h):

  • P(0) = 0 – i.e. as the coin becomes infinitely thin, there’s no chance of it landing on an edge
  • P(r) = 0.5 – i.e. as the coin becomes ‘square’, the chance of it landing on an edge approaches 50-50.
  • dP/dh > 0 – i.e. as the coin becomes thicker, the chances of it landing on an edge must become higher.

The answer to Matt’s question can then be stated as

Find the h^* such that h^* = P^{-1}(1/3)

(I’ll admit that this doesn’t fit into a tweet as neatly, but doesn’t it look grown up – all those serifs!)

The issue is then to calculate the form of P(h). We’ve bounded the end points, but the challenge is joining those up – e.g. see the possibilities below.

The simplest model

This is the point the physics comes in – using physically-motivated arguments to derive the form of P(h). Thinking about the process of a flipping coin, we might proceed along the lines:

  • A coin performs many rotations while it’s in the air
  • Therefore it probably doesn’t matter how it was initially orientated
  • Therefore the final landing edge is random
  • Therefore all that matters is a single ‘landing’
  • Therefore all that matters is the angle subtended by the edge

This is an appealingly simple argument. Referring to the drawing above, this argument would lead to

P(h) = \displaystyle{\frac{2}{\pi}\arctan\left(\frac{h}{r}\right)}

Plotted below, as you’d hope this gives the expected behaviour – starting at 0 and approaching 0.5:

The ‘data’

If you were a theorist you’d stop here – write the paper, job done, let’s get a coffee and chat about LaTeX citation styling for the next couple of weeks.

However, keen readers of this blog will understand my experimental background, and thus appreciate the need for some actual data to test a model against.

Unfortunately for them, for the last 5 years I’ve been writing software rather than working in a physics lab, so my data here will have to be strictly computational – at this point I’m essentially no better than a theorist.

Sweeping that detail away, here I actually used the Python pymunk library to run some 2D simulations of coin flips for various thicknesses – here’s the data alongside the simple model:

If I were just doing a PhD and not something important like a blog post, I’d probably stop here and join the theorists for a coffee (let’s not kid ourselves – they’ve definitely moved onto the beers by now).

This model has the right overall features to satisfy our requirements above, but it’s obviously not right. As your friendly neighbourhood spider man statistician David Spiegelhalter was fond of saying in his talks – even if the error bars overlap, sometimes you don’t need a p-value: it’s just wrong.

A better model

I’ve a confession to make here, reader. In search of a better model I found a great paper which covers everything you need to get a handle on the coin flip situation and then some, and it’s not even the main focus of the paper! I also note that it mentions the ‘three sided coin’ a full 11 years before Dr Parker, so perhaps I held his social media savvy in too high esteem.

To skip to the punchline, let’s add the model from this paper to the plot above. The model looks a little more complicated, and involves an adjustable constant \gamma:

\displaystyle{P(h) = \left(1 - \frac{2}{\pi}\arctan\left(\frac{r}{h}\right)\right)^{1 + \frac{\ln\left(\frac{\sqrt{1 + (h/r)^2} - 1}{\sqrt{1 + (h/r)^2} - h/r}\right)}{\ln\gamma}}}

What a beauty! In common with the best models you’ll come across in physics, it isn’t completely qualitatively different to the best ‘simple’ model, but it’s so much better that the comparison is in no doubt. I’m sure my buddy David will agree that we don’t need no stinkin’ p-values here.

The other feature of great physical models is that they grant you the opportunity to learn more about the physics in question, so I think it’s worth discussing it a bit here. The idea behind this model (model 5 in the paper) is that when the coin hits the surface, a number of different events can follow:

  • The coin bounces back up, and has enough energy to bounce high enough that it can rotate such that any side is facing the surface.
  • The coin lands nearly on a face, and doesn’t have enough energy to bounce high enough to rotate to another face – it is stuck on this one.
  • The coin lands nearly on an edge, and doesn’t have enough energy to bounce high enough to rotate to another face – it is stuck on an edge.

The factor \gamma is the fraction of kinetic energy that the coin loses on every bounce. Clearly if \gamma = 0 then the coin will never actually land, and if \gamma = 1 then the coin never bounces at all.

The difficulty of landing a coin on its edge then comes from two places:

  • The range of rotation angles that allows a coin to rest on an edge is small
  • The energy well preventing a coin from leaving an edge orientation is shallow

The second point is well illustrated by figure 2 from the paper – here the authors plot the ‘energy landscape’ of the coin orientation. On a face (angle = 0, \pi, 2\pi) the coin is in a deep energy well that it’s difficult to escape from. On an edge (angle = \pi/2, 3\pi/2), the coin is in a shallow energy well that it’s easy to escape from.

You may worry that the additional parameter makes this a worse model than the simple one, as surely one is simply free to adjust the parameter until the model fits the data? That’s a reasonable concern, to which I would say:

  • Physics dictates in this case that the extra parameter is helpful, perhaps mandatory – it incorporates real physical processes after all.
  • The fit is, like, really good when you get that parameter right. (David nods his head.)
  • If you want to get all technical about it, actually the real point of this paper is comparing different models of varying complexity using Bayesian methods (David really perks up at this) – definitely have a read if that interests you. In short, if additional parameters really help improve the model fit, they may well be warranted – check out the Akaike information criterion for example.

Blimey, that’s enough maths for today. While the theorists are almost certainly onto the hard stuff by now, I reckon it’s worth dusting off our jokes about differential equations and joining them in the pub. If they won’t buy you a pint, perhaps suggest flipping a coin for it.

7 thoughts on “Flipping out

      1. A well known dictionary defines a journey as “the act of travelling from one place to another” -> as it looks like we are not going to reach “another” can we really say we are on a journey…?
        Have been waiting a long time for Matt (and Hugh’s) follow up but this more than suffices thank you and loving your work as always


    1. Meic, it depends on the extra parameter, \gamma, which can probably be thought of as the inelasticity of the coin with the surface. With the author’s given simulation, it looks like the answer would be about 0.85.

      But practically, the answer depends not only on the material of the coin, but the surface you wish to toss it on. That makes this sort of three sided coin an impractical device for generating (fair) randomness.

      You’d be better off with the prism shaped dice, or simply a six or twelve sided dice that has duplicate faces. All three choices employ symmetry so the result won’t be easily biased by the material and environment choices.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s