# Demonstrating the Law of Large Numbers

**URL:** <https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720>\
**Category:** Factual Questions\
**Created:** [October 17, 2023, 8:41pm UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720 "2023-10-17T20:41:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saint\_Cad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saint_cad/32/18907_2.png) [@Saint\_Cad](https://boards.straightdope.com/u/Saint_Cad)\
**Post date:** [October 17, 2023, 8:41pm UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/1 "2023-10-17T20:41:05Z")

</div>

My students are doing an experiment showing the LLN and I want to make sure I have it set up correctly. Let’s say the students are rolling a die and counting the number of times a 6 comes up. p(6) = 1/6 and if I have them record the results then [(# of 6s) ÷ (Total rolls)] - 1/6 should tend to 0 as the number of rolls increases? Am I correct in that that activity would show the LLN?

If this does show the LLN, then I presume that an equivalent would be [(# of 6s) - E(6)] ÷ rolls =\> 0 as the rolls increase.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [October 17, 2023, 8:55pm UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/2 "2023-10-17T20:55:38Z")

</div>

Both of your statements are exactly mathematically equivalent, and both follow from the Law of Large Numbers.

---

<div class="post-metadata">

**Author:** ![Saint\_Cad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saint_cad/32/18907_2.png) [@Saint\_Cad](https://boards.straightdope.com/u/Saint_Cad)\
**Post date:** [October 17, 2023, 9:09pm UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/3 "2023-10-17T21:09:07Z")

</div>

Thanks.

---

<div class="post-metadata">

**Author:** ![Measure\_for\_Measure](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/measure_for_measure/32/557_2.png) [@Measure\_for\_Measure](https://boards.straightdope.com/u/Measure_for_Measure)\
**Post date:** [October 18, 2023, 11:49pm UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/4 "2023-10-18T23:49:27Z")

</div>

I’m wondering whether this exercise would work better with a 50-50 probability. Large numbers can be, well, large. I simulated 1 million dice rolls on my computer and counted the number of sixes (p=.1667). Here are the first 20 rolls:

```auto
. list runningAve in 1/20, clean

       running~e  
  1. 0  
  2. 0  
  3. 0  
  4. 0  
  5. .2  
  6. .16666667  
  7. .14285714  
  8. .25  
  9. .22222222  
 10. .2  
 11. .18181818  
 12. .16666667  
 13. .15384615  
 14. .21428571  
 15. .2  
 16. .1875  
 17. .17647059  
 18. .22222222  
 19. .21052632  
 20. .2  
```

We get a 1/6th share twice, but the numbers at 9 don’t seem too different than the numbers at 20. What after 100 or 200 rolls?

```auto
100. .2  
...
200. .215  
```

Not too different. Let’s jump to 1000 and 10,000

```auto
1000. .185  
...
10000. .1663  
```

Ok, now we’re getting somewhere. But that’s a lot of dice rolls. 100,000 and 1,000,000:

```auto
100000. .16779  
...
1000000. .166953  
```

More convincing.

I charted the first 200 rolls and while I can see the law at work, it doesn’t really converge until later. Around roll 100 it seems to center on .20, then awkwardly jumps higher to .22. This run didn’t drop back below .17 until after roll 2400.

> <https://twitter.com/MeasureMeasure/status/1714788933526282398?s=20>

Anyway, if you have a few groups, many of them will get odd results, so they shouldn’t get discouraged.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [October 19, 2023, 12:03am UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/5 "2023-10-19T00:03:49Z")

</div>

Roughly speaking, you can expect the error in your result to be within \frac{1}{\sqrt{N}} of the expected value. So after 100 rolls, you’ll be about 10% off; 10,000 rolls will have about 1% error, and 1,000,000 rolls will have 0.1% error. And within a small integer factor, that’s consistent with your results.

---

<div class="post-metadata">

**Author:** ![Pleonast](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pleonast/32/1183_2.png) [@Pleonast](https://boards.straightdope.com/u/Pleonast)\
**Post date:** [October 19, 2023, 12:19am UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/6 "2023-10-19T00:19:43Z")

</div>

> [@Dr.Strangelove](#):
>
> Roughly speaking, you can expect the error in your result to be within \frac{1}{\sqrt{N}} of the expected value.

Reiterating for emphasis. While it’s nice to show results converging, it’s even better to show we understand _how_ they converge.

---

<div class="post-metadata">

**Author:** ![Measure\_for\_Measure](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/measure_for_measure/32/557_2.png) [@Measure\_for\_Measure](https://boards.straightdope.com/u/Measure_for_Measure)\
**Post date:** [October 20, 2023, 12:11am UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/7 "2023-10-20T00:11:38Z")

</div>

Nice point Dr. Strangelove. I’m going to walk through a formula, but I think your rough approximation is solid.

Estimate of the standard error of a proportion:

```auto
sqrt( p * (1-p))
----------------
  sqrt(N)  
```

The 95% confidence interval covers +/- roughly 2 standard errors.

So: for 1/2 and a sample size of 100, the 95% confidence interval is indeed +/- .10. For a 1/6 probability, as in a dice roll, the confidence interval is .0745, which is… smaller. Looks like my intuition failed me upthread. The denominator is indeed sqrt(N).

(The above formula works for N\>5 and p\*N\>5: smaller samples use a different formula.)

---

<div class="post-metadata">

**Author:** ![Dr\_Paprika](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr_paprika/32/3042_2.png) [@Dr\_Paprika](https://boards.straightdope.com/u/Dr_Paprika)\
**Post date:** [October 20, 2023, 1:31am UTC](https://boards.straightdope.com/t/demonstrating-the-law-of-large-numbers/991720/8 "2023-10-20T01:31:17Z")

</div>

You could also teach them the frivolous law of numbers: any random number is likely to be very, very, very large. 😉
