If are independent random variables, each with the uniform distribution on for , then has the symmetric triangular distribution
The convolution of probability densities gives . The overlap of these two intervals has length for and is empty otherwise, proving the formula. By linearity of expectation and the variance of a sum,
For , its upper-tail probability is .
A useful model for elapsed time measured from two independently truncated clock readings uses as the display resolution and as the endpoint-offset difference. Independence is essential: uniform marginal probability distributions alone do not imply this triangular distribution. For example gives with certainty. In general, with the same uniform marginals, .
Use the uniform proposal on , with density . The triangular distribution peaks at with height , so the optimal constant for this proposal is . At each attempt take two fresh pseudo-random uniforms , and propose . The rejection method accepts according to
Indeed these bounds are . Part (a) proves that the accepted value has the required density. Acceptance probability is , so the method needs two proposal attempts on average, and hence four uniforms on average if each attempt uses two. The validity of the ideal algorithm presumes independent uniform draws; merely belonging to does not by itself make a pseudo-random sequence uniform or independent.
The graph is a rectangle of height one over , with zero height elsewhere. Its unit area is the required normalization of the probability density function.
Figure 1.
Uniform endpoint uncertainty and triangular elapsed-time uncertainty
. Left: the uniform distribution of one endpoint offset. Right: the triangular distribution of the difference of two independent endpoint offsets. Shading marks the event . Details.
Let be the finish-time offset from the start of its displayed minute. The elapsed time is , so . To obtain the stated density, use the intended model that and are independent random variables, both with the uniform distribution on .
Their joint probability density function is one on the unit square. Equivalently, the convolution of probability densities gives
The integrand is one exactly where and . The overlap has length for , length for , and zero otherwise. Therefore
This is a symmetric triangular distribution. The independence and finish-time uniformity are additional modelling assumptions: the two truncated clock readings alone do not imply them. For example, if then the elapsed time is exactly twenty-five minutes and , even though each endpoint offset is individually uniform.