# How long does it take to become Gaussian?

The central limit theorems all say that if you convolve stuff enough, and that stuff is sufficiently nice, the result will be a [Gaussian](https://en.wikipedia.org/wiki/Normal_distribution) distribution. How much is enough, and how nice is sufficient? 

Identically-distributed distributions converge quickly
------------------------------------------------------

For many distributions $d$, the repeated convolution $d * d * \dots * d$ looks Gaussian. The number of convolutions you need to look Gaussian depends on the shape of $d$. This is the easiest variant of the central limit theorem: identically-distributed distributions. 

The uniform distribution converges real quick:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/animations/d40842078c317e7af6639715759e67962fa8175e86be4d4d.gif)

The result of uniform(1, 2) * uniform(1, 2) * ... * uniform(1, 2), with 30 distributions total. This plot is an animated version of the plots in [the previous post](https://www.lesswrong.com/posts/qs8R7EZqG7QzTsFAZ/convolution-as-smoothing). The black curve is the Gaussian distribution with the same mean and variance as the red distribution. The more similar red is to black, the more Gaussian the result of the convolutions is.

The numbers on the x axis are increasing because the mean of $f * g$ [is the sum of the means](https://www.lesswrong.com/s/AaKNSG7caKMFmPWtn/p/6oPe3oqzdJtrWmduR) of $f$ and $g$, so if we start with positive means, repeated convolutions shoot off into higher numbers. Similar for the variance - notice how the width starts as the difference between 1 and 2, but ends with differences in the tens. You can keep the location stationary under convolution by starting with a distribution centered at 0, but you can't keep the variance from increasing, because you can't have a variance of 0 ([except in the limiting case](https://en.wikipedia.org/wiki/Dirac_delta_function)).

Here's a more skewed distribution: beta(50, 1). beta(50, 1) is the probability distribution that represents knowing that a lake has bass and carp, but not how many of each, and then catching 49 bass in a row. It's fairly skewed! This time, after 30 convolutions, we're not quite Gaussian - the skew is still hanging around. But for a lot of real applications, I'd call the result "Gaussian enough".

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/animations/dbd5f6780b72333cb4973df7095ae4f5a786cf1fe451d20f.gif)

beta(50, 1) convolved with itself 30 times.

A similar skew in the opposite direction, from the exponential distribution:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/animations/4f7411dbe07d48c114f96e0dfba6f6efd8c2a10d179e6610.gif)

exp(20)

I was surprised to see the exponential distribution go into a Gaussian, because [Wikipedia says](https://en.wikipedia.org/wiki/List_of_convolutions_of_probability_distributions#Continuous_distributions) that an exponential distribution with parameter $\theta$ goes into a gamma distribution with parameters gamma($n$, $\theta$) when you convolve it with itself $n$ times. But it turns out gamma($n, \theta$) looks more and more Gaussian as  $n$ goes up.

How about our ugly bimodal-uniform distribution?

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/animations/1efa8f5bb1fb3c603151340b602317ef38f235550ccf02e0.gif)

It starts out rough and jagged, but already by 30 convolutions it's Gaussian.

And here's what it looks like to start with a Gaussian:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/animations/e28750c4a31afd5aeac03a9f5ab5eb47255a980f4c648549.gif)

The red curve starts out the exact same as the black curve, then nothing happens because Gaussians stay Gaussian under self-convolution.

An easier way to measure Gaussianness (Gaussianity?)
----------------------------------------------------

We're going to want to look at many more distributions under $n$ convolutions and see how close they are to Gaussian, and these animations take a lot of space. We need a more compact way. So let's measure the kurtosis of the distributions, instead. The [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) is the fourth moment of a probability distribution; it describes the shape of the tails. All Gaussian distributions have kurtosis 3. There are [other distributions](https://stats.stackexchange.com/questions/378920/is-there-any-non-gaussian-distribution-has-skewness-0-and-kurtosis-3) with kurtosis 3, too, but they're not likely to be the result of a series of convolutions. So to check how close a distribution is to Gaussian, we can just check how far from 3 its kurtosis is. 

We can chart the kurtosis as a function of how many convolutions have been done so far, for each of the five distributions above:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/bfb43e88840ba0d8631d992569e6681ea1f7ab79b41b37bb.png)

We see our conclusions from the animations repeated: the exp(20), being very skewed, is the furthest from Gaussian after 30 convolutions. beta(50, 1), also skewed, is also relatively far (though close in absolute terms). The bimodal and uniform got to Gaussian much faster, in the animations, and we see that reflected here by how quickly the green and pink lines approach the kurtosis=3 horizontal line.

Notice: the distributions that have a harder time making it to Gaussian are the two skewed ones. It turns out the skew of a distribution goes a long way in determining how many convolutions $n$ you need to get Gaussian. Plotting the kurtosis at convolution 30 against the skew of the original distribution (before any convolutions) shows that skew matters a lot:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/3446fb3233e3dd95b971548ab451cd42a6934e5d693df8e9.png)

The further a distribution is from the gold horizontal, the more self-convolutions it takes for it to reach Gaussian. 

So the skew of the component distributions goes a long way in determining how quick their convolution gets Gaussian. The [Berry-Esseen theorem](http://www.contrib.andrew.cmu.edu/~ryanod/?p=2213) is a central limit theorem that says something similar (but see [this comment](https://www.lesswrong.com/posts/YM6Qgiz9RT7EmeFpp/how-long-does-it-take-to-become-gaussian?commentId=XK5X6gW7a8Cn8igtB)). So here's our first rule for eyeing things in the wild and trying to figure out whether the central limit theorem will apply well enough to get you a Gaussian distribution: how skewed are the input distributions? If they're viciously skewed, you should worry.

Non-identically-distributed distributions converge quickly too
--------------------------------------------------------------

In real problems, distributions won't be identically distributed. This is the interesting case. If instead of a single distribution $d$ convolved with itself, we take $d_1 * d_2 * \dots * d_n$, then a version of the central limit theorem still applies - the result can still be Gaussian. So let's take a look. 

Here are three different Beta distributions, on the left, and on the right, their convolution, with same setup from the animations: red is the convolution, and black is the true Gaussian with the same mean and variance.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/bee3e4a376d6784b60f06f30c4cb805d89e7f6fb24dca943.png)

They've almost converged! This is a surprise. I really didn't expect as few as three distributions to convolve into this much of a Gaussian. On the other hand, these are pretty nice distributions - the blue and green look pretty Gaussian already. That's cheating. Let's try less nice distributions. We saw above that distributions with higher skew are less Gaussian after convolution, so let's crank up the skew. It's hard to get a good skewed Beta distribution, so let's use Gamma distributions instead.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/ce7639b1d34c0bcbd17380d71a96c573c8c1558c9fa5d753.png)

While the three distributions on the left might look quite similar, it's only because of the extended range of the plot - I extended the x-axis up to four standard deviations away from the mean, for each distribution individually (That shows you how skewed these Gammas are!). The Gammas are not super similar: their means, in order, are (350, 128, 436), and their standard deviations are (26, 9, 29).

Not Gaussian yet - the red convolution result line still looks Gamma-ish. But if we go up to a convolution of 30 gamma distributions this skewed...

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/9015b4a510a5be0c9d074cfa6b0db68fff92bf99aed2c3e7.png)

... already, we're pretty much Gaussian.

I'm really surprised by this. I started researching this expecting the central limit theorem convergence to fall apart, and require a lot of distributions, when the input distributions got this skewed. I would have guessed you needed to convolve hundreds to approach Gaussian. But at 30, they're already there! This helps explain how carefree people can be in assuming the CLT applies, sometimes even when they haven't looked at the distributions: convergence really doesn't take much.