# What is the maximum entropy probability density function for a positive continuous variable of given mean and standard deviation?

What is the maximum entropy distribution for a positive continuous variable, given its first and second moments?

For example, a Gaussian distribution is the maximum entropy distribution for an unbounded variable, given its mean and standard deviation, and a Gamma distribution is the maximum entropy distribution for a positive variable, given its mean value and the mean value of its logarithm.

One may simply use the theorem of Boltzmann’s that is in the very Wikipedia article you point to.

Note that specifying the mean and variance is equivalent to specifying the first two raw moments – each determines the other (it’s not actually necessary to invoke this, since we may apply the theorem directly to the mean and variance, it’s just a little simpler this way).

The theorem then establishes that the density must be of the form:

Integrability over the positive real line will restrict $\lambda_2$ to be $\leq 0$, and I think places some restrictions on the relationships between the $\lambda$s (which will presumably be satisfied automatically when starting from the specified mean and variance rather than the raw moments).

To my surprise (since I wouldn’t have expected it when I started this answer), this appears to leave us with a truncated normal distribution.

As it happens, I don’t think I’ve used this theorem before, so criticisms or helpful suggestions on anything I haven’t considered or have left out would be welcome.