Calculating Pi with Skittles!
49sThe visual and tactile method of dropping Skittles to estimate Pi is surprising and engaging, sparking curiosity.
▶ Play Clip"Delivers exactly what the title promises: a fun demonstration of pi estimation using Skittles and real census data."
This Numberphile video demonstrates how to estimate the value of pi using a simple Monte Carlo method. It starts with a hands-on experiment using Skittles dropped into a circle inscribed in a square, then scales up using real UK census population data from various locations.
A circle is drawn inside a square. Skittles are dropped randomly to simulate a uniform distribution.
Skittles inside the circle (562) and on the line (159) are counted, giving a total of 721. The ratio of inside to total is computed.
The ratio (circle/total) multiplied by 4 gives an approximation of pi: 3.1.
With unit radius, the circle area is pi, square area is 4, so the ratio of circle to square is pi/4. Hence ratio*4 = pi.
Population data from UK census is used instead of Skittles. A circle and square are defined, and the population inside each is counted to estimate pi.
Nottingham (16.2M in circle, 20.389M in square) gave a modest estimate; Anfield (11.02M/13.46M) gave 3.27; Buckingham Palace (1.4M/1.7M) gave 3.28; Center of England (13.7M/18M) gave 3.049.
The Skittles experiment (3.1) provided a better approximation than most census-based estimates due to non-uniform population distribution.
The Skittles experiment gave a surprisingly good pi estimate (3.1) compared to census-based attempts, highlighting the importance of uniform random sampling in Monte Carlo methods.
What is the formula for the area of a circle?
A = πr²
02:51
How do you estimate pi using a circle inscribed in a square?
Compute (area of circle / area of square) × 4.
02:51
Why does the ratio of circle area to square area equal π/4?
With radius 1, circle area = π, square area = 4, so ratio = π/4.
03:06
What was the pi estimate from the Skittles experiment?
3.1
02:39
Which location gave the worst pi estimate using census data?
Buckingham Palace (3.28) or Anfield (3.27).
06:59
Why were Skittles better than census data for estimating pi?
Skittles are more uniformly distributed than population, which clusters in cities.
04:14
Monte Carlo method for pi
Explains the geometric rationale behind using random sampling to estimate pi.
02:51Scaling with real data
Demonstrates a creative application of census data to a classic mathematical problem.
03:33Uniform distribution assumption
Highlights the critical assumption of uniformity in Monte Carlo methods and its failure with clustered data.
04:14[00:01] to play around with, well, pie and some uh Skittles. I need a circle. circle, so Oh, I've just knocked it. That's not Now, we have to draw a square
[00:15] just fits perfectly inside. So, we're going to need some books for that. Uh Who's Who's that? >> Oh, I don't know. It's just a Yeah, this Yeah, fantastic numbers. So, we're going to use that. And [snorts] we're also
[00:29] Emma, um new book out, Radio Universe. Go and buy it. Out today? [snorts] It Is it Is it Yeah, also we got an advanced copy there, Brady. Very good. It's my thesis,
[00:41] Brady. My thesis. Show my age there. All right, strings there. No strings here. to do is you've got to go a bit wild with a with a bunch of Skittles that I bought yesterday with my kids. So, we're just going to drop them in.
[00:54] Oh, that's a That's a rubbish dive. [laughter] little bit more. That's quite good. The room now smells of Skittles. Okay, so How are we going to do that? So, we're going to count um let's use this.
[01:07] Right, we'll just So, we're going to count the ones in the circle first. 5 6 count the ones in the circle first. 5 6 7 8 9 10. I'm going to do 10. You keep 9 10 10 1 2
[01:21] 10 60 8 are online or not cuz technically that's are online or not cuz technically that's That space shouldn't exist.
[01:43] Let's Yeah, let's let's call that. 562 from the interior. from the interior. >> Yeah, okay.
[01:59] Right, good. I'm reading Skittles. I I read Skittles. [laughter] So, 562 + 159. Yep. Quite isn't it, Brady? 721, that's the total. Okay, we're going to do
[02:13] circle, divided by the total number, which is divided by the total number, which is 721. Okay, that's our first step. Equals Okay, and now the next step, if I multiply that is this by four,
[02:25] I should get pi. Very close to pi. Should we try it? Yeah. Oh god. 3.1, still got 3.1. I I think it's all right. I
[02:39] It's all right. It could have been better, couldn't it? Yeah, but it's all ones. Yeah, the ones that were on the line. No. >> [laughter]
[02:51] >> Yeah, yeah, yeah, yeah. Why does it work? It's pretty simple, actually. So, if I imagine that this is this is got unit radius, okay? So, distance between these area of the circle is pi r squared, so it's so it's the area of the
[03:06] circle would be pi, right? If that distance is one, okay, then the edge of the square is two. The square has got area four.
[03:20] the circle and the area of the square is pi by Okay? So, that's So, that's So, I So, I assume that the Skittles are distributed Yeah, yeah, yeah. >> [laughter]
[03:33] then what you should be doing off, you should find that the the ratio should be the answer by four at the end. So, it's pretty simple, right? It's pretty simple enough Skittles, man. So, but you're going to scale it up. I'm
[03:47] see if we get a better answer. So, I thought we could do this with people, right? So, I I downloaded a load of data about where people live in the UK from the last census. And I thought what we could do is we
[04:01] could just sort of pin a location, pin a center point, and then we put a radius uh of distance outside. And what we've done is I built the square and I built people live in each and get an estimate for pi in exactly the same way, but with
[04:14] don't know if people will behave better than skittles. It it remains to be seen, live, don't they, in cities and >> Yeah, so we So, I suspect we'll see that. So, if we if we last this in the middle of a city, I suspect we're not
[04:28] Whereas if we do it in a big area over a countryside, we'll probably get a much in a university where we are now. We can put in a a radius. I'll suggest a radius coordinates in. Let's do it. Let's do it. Let's see what It's creating a
[04:42] the data, is it? >> Exactly. It's It's It's It's It's basically It's figured out where we were. It's It's then identified the the circle of of radius In this case, 100 km from where we are,
[04:55] exactly like this, and it's got population data for those locations, actually split up into quite precise polygons, actually. So, it should be fairly accurate. So, population numbers for this for inside the circle of 100 km
[05:09] from from Nottingham from where we are now, about 16 million 16.2 million. The population in the corresponding square is about 20.389 million. Okay? Giving us an estimate of pi, which is
[05:25] Ooh. You thought it'd be better, right? I did. Go on. Anfield. The home of Liverpool. The home of Liverpool. Okay, let's do Anfield. All right, so we're going to run Anfield now.
[05:38] coordinates here. Obviously, this is Now, Anfield's not far from the coast, Yeah, yeah, cuz a lot of it's going to be sea. Yeah. But what matters I suppose the proportion in the circle the same as in as is in the C. That's all that
[05:54] really matters. If it's not if that is true then we should be roughly fine. It's still creating the images but it's got we've got the population numbers. So population inside the circle 11. Remember we've done 100 km again. 11.02
[06:08] Remember we've done 100 km again. 11.02 million. Inside the square 13.4 million. Inside the square 13.4 6 6 million giving an estimate of pi better or worse than than here? I think it's going to be
[06:20] worse. >> It's quite a lot worse. It's bad. 3 3.27 funny shape of the coast. Did you say you had Buckingham Palace? I have got >> I mean that's going to be nearest the coast too, isn't it? Cuz London's not
[06:35] happens when we when we mess about with the radius. What radius do you want to do? Should we do So we're in the we're right in the heart of London. So do we want to make it bigger and take
[06:47] interesting? >> It's very densely populated. Let's do 10 Let's do 10 km. Let's go Let's go lower. I think this is going to be bad. 1.4 million people living in 10 km of Buckingham Palace.
[06:59] We got a population in the square of 1.7 million. We've got an answer. These it worse as well. But I think it's the spikiness of the data is what's not good. 3.28 for pi. Yeah, as you can see it's quite it's not very uniform, is it?
[07:15] Should we do the exact center of England? Like Yeah, let's do it. Uh so I a farm. The center of England is somewhere in Leicestershire. I've been there. Have you? Yeah. Is it good? It's a farm.
[07:28] couple called Mr. and Mrs. Farmer. Oh, there you go. That's So you know all than I care to admit. >> Okay. It's not great but it's better than some of the other ones. Okay, we got population inside the circle 13.7
[07:41] million population in the square, 18 million. Estimate for pi, 3.049. We're doing better with the skills, man. We did do better with the skills.
[07:54] Let's Let's get back to this. >> Yeah. Yeah. Yeah. these approximations of pi, right? Okay, 3.15 is not such a good approximation.
[08:06] 3.14 is a little better. It turns out that the next one is something like 31414, which is even better, and so on.
⚡ Saved you 0h 08m reading this? Transcribe any YouTube video for free — no signup needed.