Probability that the sum of 'n' positive numbers less than 2 is less than 2

This of course depends on how you choose the numbers.

We could assume $X_1$, $X_2$, $X_3$ are independent random variables each uniformly distributed on the interval $[0,2]$.

I'd rather consider $Y_1=X_1/2$ etc., and ask for the probability that $Y_1+Y_2+Y_3<1$. Then $(Y_1,Y_2,Y_3)$ is a point uniformly distributed in the unit cube $C$ (with vertices $(0,0,0)$, $(1,0,0)$, $(0,1,0)$ etc.) Of course $C$ has volume $1$, and the probability you seek is the volume of the tetrahedron $T$ with vertices $(0,0,0)$, $(1,0,0)$, $(0,1,0)$ and $(0,0,1)$.

Using the formula that the volume of a tetrahedron is a third of the area of the base times the height, then this is $1/6$.

In $n$ dimensions the probability is the $n$-volume of an $n$-simplex with vertices $(0,0,\ldots,0)$ and the $n$ standard unit vectors. You can compute its volume when you know that the volume of an $n$-simplex is $1/n$ times the $(n-1)$-volume of a face times the corresponding height.


I'm not a math guy or a statistician, but I'm an engineer. In engineering, often we don't care about the exact result achieved by integrating 4 times, but rather a way to just get close enough. Here is what I did to get close enough using python.

import random
# You can try changing this number.
n = 5

#a large number of trials. i.e. how many times we are going to 'roll the dice'?
trials = 500000 

successes = 0 # number of times the sum of n random numbers between 0 and 2 are less than 2
failures = 0 # number of times the sum of n random numbers between 0 and 2 are NOT less than 2

for i in range(0, trials): 
    #sum up n random numbers
    total = sum([random.uniform(0,2) for j in range(0,n)]) 

    # if the sum of our numbers is less than or equal to two, let's call it a success, otherwise a failure
    if total <= 2: successes += 1 
    else: failures += 1

# Finally, divide our number of successes by the total
probability = successes / (successes + failures) 
print("Approx. probability that {} random numbers between 0 and 2 sum up to be less than 2:".format(n), probability)

Output:

n = 2: 0.501466
n = 3: 0.167362
n = 4: 0.042046
n = 5: 0.008338
n = 6: 0.001262
n = 7: 0.000192
n = 8: 2.8e-05

Basically, the code above simulates 500,000 trials of the experiment and keeps track of how many successes and failures there are then divides the number of successes by the number of trials to estimate a probability.