Calculating Pi with Skittles (and census data!?) - Numberphile

Calculating Pi with Skittles (and census data!?) - Numberphile

Numberphile

0:00 We're gonna do a bit of bit.

0:01 We're gonna play around with well pie and some uh Skittles.

0:05 I need a circle.

0:06 This was Freddy's clever idea for a circle.

0:08 So Oh, I've just knocked it.

0:11 That's not ideal, but I think it'll be all right.

0:12 Now, we have to draw a square h around this circle.

0:16 So, the circle just fits perfectly inside.

0:18 So, we're going to need some books for that.

0:19 Uh what better book to use than than this one.

0:21 A Ry Who's Who's that?

0:23 Oh, I don't know.

0:24 It's just Yeah, this this guy.

0:26 I don't know who he is.

0:26 Yeah.

0:27 Yeah.

0:27 Fantastic numbers.

0:28 So, we're going to use that.

0:29 And [snorts] we're also gonna use this book by our colleague Emma.

0:32 Um, new book out, Radio Universe.

0:34 Can't buy it.

0:35 Out today.

0:36 [snorts]

0:36 It is actually today.

0:37 It's come out.

0:38 Yeah.

0:38 Yeah.

0:38 So, we got an advanced copy there, Brady.

0:40 Very good.

0:41 It's my thesis, Brady.

0:42 My thesis.

0:42 Show my age there.

0:44 String theory.

0:44 Another string theory.

0:46 I think that'll do.

0:47 Now, what we got to do is we got to go a bit wild

0:48 with a with a bunch of Skittles that I bought yesterday with my kids.

0:52 So, we're just going to drop them in.

0:54 Oh, that's that's a rubbish.

0:55 [laughter] Yeah.

0:58 I'm just going to do maybe a little bit more.

1:00 This room now smells of Skittles.

1:01 Okay, so now we got to count.

1:03 How are we going to do that?

1:04 So, we're going to count.

1:05 Um, let's use this.

1:08 Right.

1:08 We'll just So, we're going to count the ones in the circle first.

1:10 Five, six, seven, eight, nine, 10.

1:14 I'm going to do 10.

1:15 You keep you keep the number of tens in your head.

1:16 Okay.

1:18 Eight 10

1:21 14.

1:20 One, two, eight, nine, 10,

1:25 60, eight.

1:26 So, he's saying there's online.

1:27 See, I'm so jealous about whether these online

1:29 or not because technically that space shouldn't exist.

1:40 562.

1:41 Okay.

1:42 Call that.

1:43 Let's just Yeah, let's let's call that 562 from the interior.

1:47 Yeah.

1:48 Okay.

1:56 So, what do we got?

1:57 159 outside of dirt.

2:00 Okay.

2:01 Reading Skittles.

2:02 [laughter]

2:04 Skittles.

2:03 So, 562 plus 159.

2:07 Yeah.

2:07 Quite in your head, Brady.

2:08 721.

2:09 That's the total.

2:11 Okay.

2:12 We're going to do 562, which is the number inside the circle,

2:16 divided by the total number, which was 721.

2:18 Okay, that's our first step.

2:20 Equals.

2:21 Okay.

2:21 Okay.

2:21 Now the next step, if I multiply this this by four, I should get pi.

2:26 Very close to pi.

2:27 Should we try it?

2:30 Yeah.

2:29 Oh god.

2:32 Not bad.

2:34 3.1.

2:35 Still got 3.1.

2:37 I think that's all right.

2:39 I What do you reckon?

2:41 It's all right.

2:41 It could have been better, couldn't it?

2:42 Yeah, but it's all right.

2:44 I think it was those dodgy edge ones.

2:46 Yeah, the ones that were on the line.

2:49 Yeah.

2:48 Do it again.

2:49 No.

2:50 [laughter] So, so I should probably explain how it works.

2:52 Explain how it works first.

2:53 Yeah.

2:53 Yeah.

2:54 Yeah.

2:54 Why does it work?

2:55 It's pretty simple actually.

2:56 So, if I imagine that this is this has got unit radius.

3:00 Okay.

3:00 So, distance between the earth and there is one.

3:02 Then the area of the circle is well it's pi r squ.

3:05 So it's so the area of the circle would be pi.

3:07 Right?

3:08 If that distance is one okay then the edge of the square is two.

3:17 The square has got area four.

3:20 Okay.

3:20 So the ratio between the area of the circle

3:23 and the area of the square is pi by4.

3:26 Okay.

3:26 So that's so that's so so I

3:28 assume that the skittles are distributed pretty randomly.

3:31 Okay.

3:31 Maybe.

3:32 Yeah.

3:32 Yeah.

3:32 Yeah.

3:32 [laughter] And so so if that's the case then the then what you should

3:36 be doing enough you should find that the the ratio should be pi by4.

3:39 So that's why I multiply the answer by four at the end.

3:41 So it's pretty simple right?

3:42 It's pretty simple experiment that everyone can try with enough skills man.

3:45 So, but you're gonna scale it up.

3:47 I'm gonna scale it up.

3:48 Doesn't we'll see whether we get a better answer.

3:49 So, I thought we could do this with people, right?

3:52 So I I downloaded a load of data about where people

3:55 live in the UK from the office of national statistics from last

3:59 centers and I thought what we could do is we could just

4:01 sort of pin a location pin a center point and then we

4:04 put a radius uh of distance outside and what I've done is

4:07 I've built the square and I've built the circle and we can

4:10 ask how many people live in each and get an estimate

4:12 for pi in exactly the same way but with people rather than skittles.

4:15 Right?

4:16 I don't know if people will behave better than skittles.

4:18 It it remains to be seen

4:19 because people tend to clump where they live, don't they?

4:21 In cities and

4:23 Yeah.

4:23 So we So I suspect we'll see that.

4:24 So if we if we lash this in the middle of a city,

4:27 I suspect we're not going to get a very good estimate of pi.

4:29 Whereas if we do it in a bigger area over a countryside,

4:31 we'll probably get much better.

4:32 So this should now this is not in a university where we are now.

4:35 We can put in a a radius.

4:36 I'll suggest a radius of 100 km.

4:38 Put that we put our GPS coordinates in.

4:40 Let's do it.

4:40 Let's do it.

4:41 Let's see what

4:42 it's creating a square and a circle and then pulling all the data.

4:44 Is it exactly?

4:45 It's it's it's it's create it's it's basically

4:47 it's fig it's figured out where we were.

4:49 It's it's then identified the the circle of of radius in this case

4:53 100 kmters from where we are and the square that just fits

4:56 around exactly like this and it's got population data for those locations which

5:01 obviously split up into it's actually

5:02 split up into quite precise polygons actually.

5:04 So it should be fairly accurate.

5:06 So population numbers for this for inside this circle of 100 kilometers

5:09 from from Nottingham from where we are now about 16 million 16.2 2 million.

5:14 The population in the corresponding square is about 20.389 million.

5:20 Okay.

5:21 Giving us an estimate of pi which is 3.18.

5:28 You thought it'd be better, right?

5:29 Didn't you?

5:30 I did.

5:31 Go on.

5:31 Anfield of Liverpool, the home of Liverpool.

5:34 Okay, let's do Anfield.

5:36 All right.

5:36 So, we're going to run Anfield now.

5:38 Uh, so Anfield, we got a GPS coordinates here.

5:40 Obviously this is now Anfield's not far from the coast is it?

5:44 Yeah.

5:44 So it should be bad.

5:46 Yeah.

5:46 Yeah.

5:46 Cuz a lot of it is going to be sea.

5:48 Yeah.

5:48 But what's matters I suppose is is the proportion in the square

5:50 and proportion in the circle the same as as is in the sea.

5:53 That's all that really matters.

5:54 If it's not if that is true then we should be roughly fine.

5:58 Okay.

5:58 We have the population numbers.

6:00 It's still creating the images but it's got we got the population numbers.

6:02 So population inside the circle 11.

6:05 Remember we've done 100 km again.

6:07 Uh 11.02 02 million inside the square 13.466 million giving

6:14 an estimate of pi better or worse than than here.

6:18 I think it's going to be worse.

6:21 It's quite a lot worse.

6:22 It's bad.

6:24 Three 3.27.

6:26 Yeah, it's this.

6:27 It's that sea and the funny shape of the coast.

6:29 Did you say you had Buckingham Palace?

6:31 I have got Buckingham Palace.

6:32 Yeah.

6:32 I mean, that's going to be nearish the coast, too, isn't it?

6:34 cuz London's not far from

6:35 Do you want to change the radius so we can see a little

6:37 bit what happens when we when we mess about with the radius?

6:39 What radius do you want to do?

6:41 Should we do So, we're in the we're right in the heart of London.

6:45 So, do we want to make it bigger and take in what's

6:48 outside London or we want to make it smaller and keep it?

6:50 It's very densely.

6:51 Let's do 10.

6:51 Let's do 10 km.

6:52 Let's go.

6:53 Let's go.

6:53 I think this is going to be bad.

6:55 1.4 million people living in 10 km of Bookingham Palace.

6:59 Uh we got a population of square of 1.7 million.

7:02 We've got an So, these numbers are low, which is going to make it worse as well.

7:06 But I think it's the spikiness of the data is what's not good.

7:09 3.28 for pi.

7:11 Yeah.

7:11 So, you can see it's quite It's not very uniform, is it?

7:15 Should we do the exact center of England?

7:17 Like, yeah, let's do it.

7:18 Uh, so I can give you it latitude.

7:20 I think it's a farm.

7:21 The center of England is somewhere in Leicester.

7:24 I've been there.

7:25 Have you?

7:26 Yeah.

7:26 Is it good?

7:27 It's a farm.

7:28 I think it's a farm.

7:28 And it was owned by a couple called Mr.

7:30 and Mrs.

7:30 Farmer.

7:31 Well, there you go then.

7:32 So, you know all about this.

7:33 I know a lot about it.

7:34 I know more about this than I care to admit.

7:36 Okay.

7:36 It's not great, but it's better than some of the other ones.

7:38 Okay.

7:38 We got population inside the circle 13.7 million.

7:42 Population in the square 18 million.

7:46 Estimate for pi 3.049.

7:51 We're doing better with skills, man.

7:52 We did do better with the skills.

7:54 Let's get back to this.

7:55 Yeah.

7:55 Yeah.

8:00 That's cool.

8:01 Yeah.

8:01 Yeah.

8:01 So, you get these approximations of pi, right?

8:04 Okay.

8:04 3.15 is not such a good approximation.

8:06 3.14 is a little better.

8:08 It turns out that the next one is something like 31414, which is even better.

8:15 and so on.

Study with Looplines Download Captions Watch on YouTube