Puzzle
A camel is loaded with straws until its back breaks. Each straw gas a weight uniformly distributed and , independent of the other straws. The camelβs back breaks as soon as the total weight of all the straws exceeds .
Problem 1
Find the expected number of straws that break the camelβs back.
Solution (using integral equation)
Let be the random variable representing the weight of each straw and let be the expected number of straws that need to be drawn such that for .
We have the following integral equation:
Differentiating on both sides, we get the differential equation with the boundary condition .
The solution to the above differential equation is and the expected number of straws is .
Solution (using Irwin-Hall Distribution)
Let be the random variable representing the sum of uniform random variables (i.e. sum of the weights of straws in this case). follows the Irwin-Hall distribution. For , the PDF of is given by .
Let be the random variable for the number of straws required such that . We see that
The expected number of straws satisfying the condition is given by
Computational verification
From the simulation below, we see that the expected weight of the last straw is .
from random import random
runs, sum_num_straws = 1000000, 0
for _ in range(runs):
num_straws, weight = 0,0
while (weight < 1):
weight += random()
sum_num_straws += num_straws
print(sum_num_straws/runs)
Problem 2
Find the probability that the weight of the last straw is less than or equal to .
Solution (using Irwin-Hall distribution)
Let be the random variable representing the weight of the last straw. We have the conditional distribution
Therefore the required probability distribution for is
Problem 3
Find the expected weight of the last straw that breaks the camelβs back.
Solution (using Irwin-Hall distribution)
From the probability distribution calculated above, we get the probability density function of which is .
Therefore, the expected weight of the last straw is given by
Solution (using integral equation)
Let be the random variable representing the weight of each straw and let be the expected weight of the last straw that needs to be drawn such that for . We have the following integral equation:
Differentiating both sides, we get the differential equation with the boundary condition .
The solution to the above differential equation is and the expected weight of the last straw is .
Computational verification
From the simulation below, we see that the expected weight of the last straw is .
from random import random
runs, sum_last_straw_weight = 1000000, 0
for _ in range(runs):
weight = 0
while (weight < 1):
straw = random()
weight += straw
sum_last_straw_weight += straw
print(sum_last_straw_weight/runs)