You are currently browsing the tag archive for the ‘random number generators’ tag.

Normal Numbers – and random number generators

Numberphile have a nice new video where Matt Parker discusses all different types of numbers – including “normal numbers”.  Normal numbers are defined as irrational numbers for which the probability of choosing any given 1 digit number is the same, the probability of choosing any given 2 digit number is the same etc.  For example in the normal number 0.12345678910111213141516… , if I choose any digit in the entire number at random P(1) = P(2) = P(3) = … P(9) = 1/10.  Equally if I choose any 2 digit number at random I have P(10) = P(11) = P(12) = P(99) = 1/100.

It is incredibly hard to find normal numbers, but there is a formula to find some of them.

Screen Shot 2019-03-13 at 8.24.28 PM

In base 10, we are restricted to choosing a value of c such that 10 and c are relatively prime (i.e share no common factors apart from 1).  So if we choose c = 3 this gives:

Screen Shot 2019-03-13 at 8.24.33 PM

Screen Shot 2019-03-13 at 8.24.38 PM

We can now put this into Wolfram Alpha and see what number this gives us:

Screen Shot 2019-03-13 at 8.29.29 PM.png

So we can put the first few digits into an online calculator to find the distributions

0.000333333444444444444448148148148148148148148148148148148148148149382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049827160493827160493827160479423863312 7572016460905349794238683127572016460905349794238683127572016460 9053497942386831275720164609053497942386831275720164609053497942

4: 61
1: 41
8: 40
3: 38
0: 36
2: 33
7: 33
9: 33
6: 32
5: 10

We can see that we are already seeing a reasonably similar distribution of single digits, though with 4 and 5 outliers.  As the number progressed we would expect these distributions to even up (otherwise it would not be a normal number).

One of the potential uses of normal numbers is in random number generators – if you can use a normal number and specify a digit (or number of digits) at random then this should give an equal chance of returning each number.

To finish off this,  let’s prove that the infinite series:

Screen Shot 2019-03-13 at 8.24.33 PM

does indeed converge to a number (if it diverged then it could not be used to represent a real number).  To do that we can use the ratio test (only worry about this bit if you have already studied the Calculus Option for HL!):

Screen Shot 2019-03-13 at 8.24.43 PM

Screen Shot 2019-03-13 at 8.24.46 PM

Screen Shot 2019-03-13 at 8.24.50 PM

We can see that in the last limit 3 to the power n+1 will grow faster than 3 to the power n, therefore as n increases the limit will approach 0.  Therefore by the ratio test the series converges to a real number.

Is pi normal?

Interestingly we don’t know if numbers like e, pi and ln(2) are normal or not.  We can analyse large numbers of digits of pi – and it looks like it will be normal, but as yet there is no proof.  Here are the distribution of the first 100,000 digits of pi:

1: 10137
6: 10028
3: 10026
5: 10026
7: 10025
0: 9999
8: 9978
4: 9971
2: 9908
9: 9902

Which we can see are all very close to the expected value of 10,000 (+/- around 1%).

So, next I copied the first 1 million digits of pi into a character frequency counter which gives the following:

5: 100359
3: 100230
4: 100230
9: 100106
2: 100026
8: 99985
0: 99959
7: 99800
1: 99758
6: 99548

This is even closer to the expected values of 100,000 with most with +/- 0.25 %.

Proving that pi is normal would be an important result in number theory – perhaps you could be the one to do it!

 

Website Stats

  • 6,205,963 views

Recent Posts

Follow IB Maths Resources from British International School Phuket on WordPress.com