In this post, I derive the uniform, gaussian, exponential, and another funky probability distribution from the first principles of information theory. I originally did it for a class, but I enjoyed it and learned a lot so I am adding it here so I don’t forget about it.

I actually think it’s pretty magical that these common distributions just pop out when you are using the information framework. It feels so much more satisfying/intuitive than it did before.

Maximum Entropy Principle

Recall that information entropy is a mathematical framework for quantifying “uncertainty.” The formula for the information entropy of a random variable is . In statistics/information theory, the maximum entropy probability distribution is (you guessed it!) the distribution that, given any constraints, has maximum entropy. Given a choice of distributions, the “Principle of Maximum Entropy” tells us that the maximum entropy distribution is the best. Here’s a snippet of the idea from the wikipedia page:

The principle of maximum entropy states that, subject to precisely stated prior data (such as a proposition that expresses testable information), the probability distribution which best represents the current state of knowledge is the one with largest entropy.

Another way of stating this: Take precisely stated prior data or testable information about a probability distribution function. Consider the set of all trial probability distributions that would encode the prior data. According to this principle, the distribution with maximal information entropy is the proper one.

In ordinary language, the principle of maximum entropy can be said to express a claim of epistemic modesty, or of maximum ignorance. The selected distribution is the one that makes the least claim to being informed beyond the stated prior data, that is to say the one that admits the most ignorance beyond the stated prior data.

Lagrange Multipliers

Given the above, we can use the maximum entropy principle to derive the best probability distribution for a given use. A useful tool in doing so is the Lagrange Multiplier (Khan Acad article, wikipedia), which helps us maximize or minimize a function under a given set of constraints.

For a single variable function subject to the constraint , the lagrangian is of the form: , which is then differentiated and set to zero to find a solution.

The above can then be extended to additional variables and constraints as:

and solving

or, equivalently, solving

In this case, since we are deriving probability distributions, the integral of the pdf must sum to one, and as such, every derivation will include the constraint .

With all that, we can begin:

1. Derivation of maximum entropy probability distribution with no other constraints (uniform distribution)

First, we solve for the case where the only constraint is that the distribution is a pdf, which we will see is the uniform distribution. To maximize entropy, we want to minimize the following function:

. Taking the derivative with respect ot and setting to zero,

, which in turn must satisfy

Note: To check if this is a minimum (which would maximize entropy given the way the equation was set up), we also need to see if the second derivative with respect to is positive here or not, which it clearly always is:

Satisfy constraint

Putting Together

Plugging the constraint into the pdf , we have:

. Of course, this is only defined in the range between and , however, so the final function is:

2. Derivation of maximum entropy probability distribution for given fixed mean and variance (gaussian distribution)

Now, for the case when we have a specified mean and variance, which we will see is the gaussian distribution. To maximize entropy, we want to minimize the following function:

, where the first constraint is the definition of pdf and the second is the definition of the variance (which also gives us the mean for free). Taking the derivative with respect ot p(x) and setting to zero,

, which in turn must satisfy


Again, is always positive, so our solution will be minimum.

Satisfy first constraint

Satisfy second constraint

Putting together


. Plugging in for the other lambda,

Now, we plug back into the first equation

which we can note is, by definition, the pdf of the Gaussian!

3. Derivation of maximum entropy probability distribution of half-bounded random variable with fixed mean exponential distribution)

Now, constrain on a fixed mean, but no fixed variance, which we will see is the exponential distribution. To maximize entropy, we want to minimize the following function:

Now take derivative

To check if this is a minimum of the function, we need to see if the second derivative is positive with respect to p(x), which it is:

Setting the first derivative to zero, we have

, which must satisfy the constaints and .

Satisfying first constraint

Satisfying the second constraint

substituting in from above

Putting together

Rather than evaluating this last integral above, we can simply stop and note that in evaluating our constraints we have stumbled upon the formula for an exponential random variable with parameter !

More explicitly:

where , the pdf of the exponential function for , where .

In other words,

4. Maximum entropy of random variable over range with set of constraints with and is of polynomial order

must be even order for all enforced constraints.

Following the same approach as above:

all where .

We now consider the conditions in which the random variable can be defined in the entire domain . Looking at the normalization constraint,

we note that we need our exponential function to integrate to 1. In order for this equation to be defined in the entire real domain, we thus will need the exponential function to integrate to a finite value, so that we can provide a normalization constant that will result in integration to 1.

Looking at the function (which must remain finite for all x), we can thus conclude that must not converge to positive infinity, but may converge to negative infinity (because it would cause the exponential to converge to zero) or to any finite value as approaches positive or negative infinity. The only components of this function that depend on are the polynomail constraints of form . As such, these constraints are the only components at risk to force the function towards infinity, provided that Therefore, because the corresponding to can any can be positive or negative, the function will be able to be defined so long for all , or for all

Finally, we can consider the conditions for which these criteria for will be satisfied. In short, the only way to guarantee that remain either positive for negative will be if the dominant component of the polynomial is of an EVEN order for all s.t. . If the dominant component is odd, then will either move from negative infinity to positive infinity (or, if negated, from positive infinity to negative infinity) as x moves across the domain, which means that no finite and nonzero could be chosen to maintain the criteria outlined above.