Pi appears again – a probability problem!

Pi appears again – a probability problem

This is a nice maths problem which has a surprising result:

If you take 2 randomly generated numbers between 0 and 1 (lets call them x and y), then divide y by x, what is the probability that the resultant number will round to an even number?

The obvious answer would be 50% – i.e if the 2 numbers are randomly generated then surely there will be an equal distribution of numbers which round to odd and even numbers. However this is not the case!

Python code

First off I wrote some simple Python code to see what a Monte Carlo simulation returns:

This code generates 2 (pseudo) random numbers, records if their quotient is even and then repeats this experiment 100,000,000 times. This returns the probability:

This is close to 50% – but not quite! With 100,000,000 trials this suggests that the real probability is not 50% – so what is happening?

Geometrical reasoning

We can think of our 2 numbers, x,y as existing in a 2 dimensional plane – in a unit square. First lets look at all the values of x,y which round to give 0. What we want is to find

This therefore means we need:

So we can draw the line y = 0.5x on our diagram and shade the region where this inequality is true:

This has an area of 1/4. Next we do the same for find the region where y/x rounds to 2:

This gives the following diagram:

By considering the base and height of a triangle this gives an area of:

This area simplifies to 2/15 but it will be helpful to keep it in the above form later. We can see the areas will start to follow a pattern:

So we will have the total area given by:

This will simplify to give:

Next we can use a famous result for the sum of the following infinite series:

And we can rearrange this to find A:

This then gives the final result:

So, as if by magic pi appears in a probability problem – with no circles it sight! We can see that the exact answer agrees with the Monte Carlo simulation rounded to 4 dp.

IB teacher? Please visit my new site http://www.intermathematics.com ! Hundreds of IB worksheets, unit tests, mock exams, treasure hunt activities, paper 3 activities, coursework support and more. Take some time to explore!

Andrew Chambers: (Resources for IB teachers)

Please visit the site shop:  http://www.ibmathsresources.com/shop to find lots of great resources to support IB students and teachers – including the brand new May 2025 prediction papers.

Andrew Chambers (Resources for Students)

Comments are closed.

Powered by WordPress.com.

Up ↑