St · Statistics & Probability

What Is the Entropy of the Sum of Two Uniform Random Variables?

Updated 13 October 2026

At a glance

  1. 1. Set the assumptions

    Assume the variables are independent and uniform on the same interval, usually [0,1].

  2. 2. Find the density

    Convolve the two uniform densities to get a triangular density on [0,2].

  3. 3. Integrate the entropy

    Use differential entropy, minus the integral of the density times its natural logarithm.

  4. 4. Adjust for scale

    For a common interval of width L, add the natural logarithm of L to the [0,1] result.

The usual interpretation is that the two variables are independent and each is uniform on [0,1]. Their sum is not uniform: its density rises linearly, then falls linearly. Its differential entropy is 1/2 nat, or about 0.721 bits.

The interval and independence assumptions matter. The derivation below gives the standard result, then shows how it changes for other interval widths and what fails without independence.

Find the density of the sum

Let XX and YY be independent, each with density 1 on [0,1][0,1], and let S=X+YS=X+Y. The density of a sum of independent continuous random variables is the convolution of their densities. Here, the density at ss is the length of the overlap between [0,1][0,1] and [s−1,s][s-1,s]:

fS(s)={s,0≤s≤1,2−s,1<s≤2,0,otherwise.f_S(s)= \begin{cases} s, & 0\le s\le 1,\\ 2-s, & 1< s\le 2,\\ 0, & \text{otherwise}. \end{cases}

For example, sums near 0 can be made in very few ways: both variables must be small. Sums near 1 have many possible pairs, so the density reaches its maximum there. The same reasoning makes the density decrease from 1 to 2.

Calculate differential entropy

For a continuous random variable with density ff, differential entropy in nats is

h(S)=−∫−∞∞fS(s)ln⁡fS(s) ds.h(S)=-\int_{-\infty}^{\infty} f_S(s)\ln f_S(s)\,ds.

The two halves of this triangular density contribute equally. Therefore,

h(S)=−2∫01sln⁡s ds=−2[−14]=12 nat.\begin{aligned} h(S) &=-2\int_0^1 s\ln s\,ds\\ &=-2\left[-\frac14\right]\\ &=\frac12\text{ nat}. \end{aligned}

In the second line, integration by parts gives ∫01sln⁡s ds=−1/4\int_0^1 s\ln s\,ds=-1/4. To express the answer in bits, divide by ln⁡2\ln 2:

h(S)=12ln⁡2≈0.7213 bits.h(S)=\frac{1}{2\ln 2}\approx 0.7213\text{ bits}.

If the uniforms use another interval

If both variables are uniform on [a,b][a,b], let L=b−aL=b-a be the interval width. Adding a constant to a random variable does not change its differential entropy, while multiplying it by LL adds ln⁡L\ln L. Thus, for the sum of these two variables,

h(X+Y)=12+ln⁡L nats.h(X+Y)=\frac12+\ln L\text{ nats}.

For instance, if both are uniform on [0,2][0,2], then L=2L=2 and the sum has entropy 1/2+ln⁡2≈1.1931/2+\ln 2\approx1.193 nats. Differential entropy depends on scale and units, so the numerical value can be negative for sufficiently small intervals; that is allowed.

If the variables are independent but their interval widths differ, the density is trapezoidal rather than symmetric triangular. Let WW be the larger width and VV the smaller width. For uniform variables on intervals of those widths, the entropy is

h(X+Y)=ln⁡W+V2W nats,0<V≤W.h(X+Y)=\ln W+\frac{V}{2W}\text{ nats},\qquad 0<V\le W.

Translations of either interval do not affect this result. The formula uses widths measured in the same units; changing units shifts differential entropy by the logarithm of the scale factor.

What if the variables are dependent?

Knowing that each variable is uniform does not determine the entropy of their sum unless their joint dependence is specified. For example, if XX is uniform on [0,1][0,1] and Y=XY=X, then X+Y=2XX+Y=2X is uniform on [0,2][0,2], with entropy ln⁡2\ln 2 nats—not 1/21/2 nat. The convolution calculation applies when the variables are independent.

Common mistakes

  • Adding the two entropies: Entropy of a sum is generally not h(X)+h(Y)h(X)+h(Y). In the standard case, each input has entropy 0, but the sum has entropy 1/21/2 nat.
  • Using discrete entropy: The sum is continuous, so use the density integral for differential entropy, not a sum over possible outcomes.
  • Assuming a uniform sum: Even though both inputs are uniform, their sum has a triangular density when the intervals match.
  • Ignoring the interval width: Differential entropy changes under rescaling; the value 1/21/2 nat applies specifically to two independent uniforms on an interval of width 1.

References

  1. Elements of Information Theory, 2nd ed., Thomas M. Cover and Joy A. Thomas

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.