Probability of a sum being less than 1 (convolution of pdf)
If we choose \(n\) numbers randomly and uniformly from \([0,1]\) and raise each number to \(k\) \((k>0)\), what is the probability that the sum will be less than 1?
i.e. what is
The answer can be derived by using convolution of probability density functions.
For two pdfs, \(f(x)\) and \(g(y)\), the convolution \(f*g\) is defined as
Let \(X_1\) and \(X_2\) be two random variables which represent \(x_1^{1/k}\) and \(x_2^{1/k}\).
The pdf is then given by:
and the pdf of the sum of two numbers \(f_2(z)\) (in the region \(0\le z \le 1\)) is:
After this, we can iteratively continue for more terms:
Continuing in that manner, for sum of \(n\) terms, we will end up with:
Since we require the probability of the sum to be less than one, we will evaluate that integral and write the beta functions in terms of gamma functions and simplify:
That's some formula!
In Sage, it can be written as
var('k y z') assume(k>0) assume(2*k-1>0) f1(z) = diff(z^k,z) f2(z) = f(z) for i in range(10): f2(z) = integrate(f2(z-y)*f1(y),y,0,z) print i+2, f2(z) f(n,k) = gamma(k+1)^n/gamma(n*k+1) |
To verify our answer, we can perform a simulation:
sim=: 3 : '1>+/(?6#0)^6' (+/%#)(sim"0)100000#0 NB. = 0.63926 |
If we want to perform a simulation in a more verbose language, R is a good candidate.
The code in R looks like:
n = 6 k = 6 b = array(runif(n*1e6,0,1),dim=c(n,1e6)) mean(apply(b^k,2,sum)<1) |
and if we want to perform using two dimensional arrays in J also, the equivalent code can be written as:
'n k'=: 6 6 a=:(n, 1e6) $ ?(n*1e6)#0 (+/%#)1>+/a^k NB. = 0.637572 |
The corresponding probability derived analytically is:
References: