Skip to content
Nemenman Lab
Menu ☰

Archive · Physics 434, 2016

Law of large numbers

Archived from the old lab wiki. Some external links may no longer work.

One of the important results in probability theory is the law of large numbers, which is what we consider in this lecture.

Let’s ask the following question. Suppose we have a biased coin, with an unknown probability pp for coming heads up (in other words, the coin is a Bernoulli random number, with probability pp). The coin is thrown NN times, and comes up nn times heads up. Clearly, in general, n/Nn/N is not going to be exactly pp (for starters, n/Nn/N is always rational, and pp can be arbitrary). But how close will they be? This is a very important question. Indeed, we previously defined the probability as a limit of frequencies for large NN. Is our definition self-consistent? Do the frequencies actually converge to probabilities?

To answer this, let’s suppose we have a variable with an expectation value ⟨x⟩\langle x\rangle and the variance σx2\sigma^2_x. We take samples xn, n=1,…,Nx_n,\, n=1,\dots,N of this variable. We then define the empirical mean, or the sample mean xˉ=1N∑n=1Nxn\bar{x}=\frac{1}{N}\sum_{n=1}^N x_n. Note here that we use the notation ⟨⋯ ⟩\langle\cdots\rangle to denote expectation values, and ⋯ˉ\bar{\cdots} to denote empirical means. Our questions of whether frequencies converge to probabilities is then a special case of a more general question: how close is an expectation value of a variable xx, namely ⟨x⟩\langle x\rangle, to its empirical mean xˉ\bar{x}?

This question is easy to answer for a special case of frequencies of Bernoulli variables. Here we can use the fact that the distribution of heads is given by the binomial distribution, B(p,N)B(p,N). As we showed previously, for the binomial distribution, μ=pN\mu = pN, so that the frequency becomes f=pN/N=pf=pN/N=p. Thus, indeed, the frequency converges to the probability. Further, for the binomial distribution, σ=Np(1−p)\sigma = \sqrt{Np(1-p)}, and thus the standard deviation of the frequency becomes σf=p(1−p)/N\sigma_f=\sqrt{p(1-p)/N}. Thus the ratio of the standard deviation of the frequency to its mean is σf/f=(1−p)/(Np)\sigma_f/f=\sqrt{(1-p)/(Np)}. So not only does the frequency of a Bernoulli variable converges to the probability, but the error decreases as about ∝1/N\propto 1/\sqrt{N}.

Does this result hold more generally, beyond Bernoulli variables? We previously showed that, for independent variables, means and variances ad. Let’s use this fact to answer the question. What is the expected value and the standard deviation of the empirical mean? We can write these as ⟨xˉ⟩=1N⟨∑n=1Nxn⟩\langle \bar{x}\rangle = \frac{1}{N}\langle \sum_{n=1}^N x_n\rangle. Using the law of summation of the means, this becomes ⟨xˉ⟩=1N∑n=1N⟨xn⟩=⟨x⟩\langle \bar{x}\rangle = \frac{1}{N} \sum_{n=1}^N \langle x_n\rangle = \langle x\rangle. Thus the empirical mean converges to the true mean, as long as the true mean exist (for some long-tailed distributions, means don’t exist, as we will see in the homework problem). How quickly does this convergence happen? We now calculate σxˉ2=∑n=1Nσ2(xn/N)=1N2∑n=1Nσ2(xn)=σx2N\sigma^2_{\bar{x}} = \sum_{n=1}^N\sigma^2(x_n/N) = \frac{1}{N^2}\sum_{n=1}^N\sigma^2(x_n)= \frac{\sigma^2_x}{N}. Thus the spread of an expectation value around its empirical mean decreases with the number of samples as ∝1/N\propto 1/\sqrt{N}, provided, of course, that the variance of a single sample is finite.