Estimating pi with candy and a drawing

This is the perfect way to celebrate Pi Day, even without any pie

Spread the knowledge

A pie with the word "pie" written in a circle all around the crust.

Photo by Annie Spratt on Unsplash

Like many quantities in science, we can never determine the value of π exactly, but we can approximate it. You can even estimate π yourself with candy and a piece of paper.

Start by drawing a square. Let’s make it 8.5 inches long on each side so it fills up the width of a standard sheet of office paper. Now, draw a circle with a diameter of 8.5 inches within that square. 

Now we need something to drop onto the drawing, like grains of rice or M&Ms. Begin by covering the square and circle with the objects and then count the number that are within the circle and the total number of objects. From this information, we can estimate the value of π. We can calculate the area of a circle with π r2, where r is the radius (the distance from the center of the circle to the outside). Based on how we drew the circle and square, the square will have a side length of 2r, so the area will be (2r)2 or 4r2

Back to the M&Ms: to guess how many of the dropped candies will land inside the circle, we can calculate the ratio of the circle’s area to the square’s area: (π r2)/4r2 = π/4. When I tried this with 100 M&Ms, I found that 78 of them were inside the circle and 22 of them were outside the circle but inside the square. This means 78% of the total M&Ms landed in the circle. From our ratio calculations, we estimated that π/4 candies would land within the circle. Now, we can compare the fraction of the M&Ms that landed in the circle to the theoretical number to estimate π. Doing so, we find π/4 = 0.78 so π is about 3.12. The actual value of π is 3.14159265…. so our result isn’t a bad approximation. If we wanted to get a better estimate, we could use a lot more M&Ms and a much bigger drawing.

Of course, counting all the M&Ms takes a long time, so using more than a few hundred M&Ms isn’t practical. Instead of actually dropping M&Ms onto a square and circle, we could write a computer program to simulate dropping thousands or even millions of candies onto a circle and square and counting them up. The computer can “drop” and count a million M&Ms in a matter of seconds. When I tried this, I found that 785,389 of the 1 million simulated M&Ms landed within the circle, leading to an estimated value of 3.141556, which is even closer to the true value of pi than our estimate using only 100 M&Ms. 

This is only one of many ways to approximate π. Nevertheless, this is a simple way to estimate π with just regular household materials.