三棒
Three Sticks
题目详情
假设给你一根 1 米长的棍子。随机选择棍子上的 2 个点,并在这 2 个点处折断它,得到 3 块。最小的一块最多 0.2 米的概率是多少?
Assume you are given a stick that is 1 meter in length. Randomly select 2 points on the stick and break it at these 2 points to get 3 pieces. What's the probability that the smallest piece is at most 0.2 meter?
解析
我们可以先用一张图来说明木棍被分成三块的地方。我们将第一点表示为 ,将第二点表示为 。那么,这3个片段的给定长度为、和。我们正在计算 。这对应于3个片段中最小的一个或的长度至多为0.2或小于或等于0.2的事件。

解决此问题的第一个关键观察结果是认识到 等于 。这是根据补码规则。最小值事件上限的补集是所有事件都高于最小值的事件。这具有逻辑意义:最小值小于 0.2 的“相反”是所有值都高于 0.2。
我们现在可以这样直观地划分上述样本空间。我们从 网格开始,随机变量 和 在各自的轴上。然后,我们沿着线 将这个空间分成两半,并将我们的结果空间限制在正方形的上半部分三角形。这是因为,通过指示 y 是两个点中的第二个点或 ,我们将结果空间限制为仅具有 的点。


一旦我们定义了结果空间,我们就可以计算与事件 对应的三角形的子区域。第一个条件是。我们可以对活动空间进行相应的分区和缩小。第二个条件是或。我们可以再次相应地缩小活动空间。最后一个条件是。然而,我们注意到剩余空间(白色的中心三角形)已经满足这个条件。所以我们需要计算这个三角形的面积:。现在,我们将事件空间的面积除以结果空间的面积,我们在上面将结果空间定义为上半三角形,即 0.5:。

现在请记住,需要该区域来计算所需事件的补码,因此从 1: 中减去它,即可得到 。
这是演示此解决方案的程序:
import random
def simulate_trial():
x, y = random.uniform(0, 1), random.uniform(0, 1)
x, y = min(x, y), max(x, y)
sides = [x, y-x, 1-y]
return min(sides)
res = []
for _ in range(1_000_000):
val = simulate_trail()
res.append(val)
print(len([i for i in res if i <= 0.2] / len(res)))Original Explanation
We can start by illustrating a diagram indicating where the stick is broken into 3 pieces. We denote the first point as and the second as . Then, the given length of the 3 pieces is , , and . We are looking to calculate the . This corresponds to the event that the length of the smallest of the 3 pieces, or , is at most 0.2, or less than or equal to 0.2.

The first key observation to solving this problem is to recognize that is equal to . This is by the complement rule. The complement to the event upper bounding the minimum, is the event that all are above the minimum. This makes logical sense: the ‘opposite’ of the minimum being less than 0.2 is for all to be above 0.2.
We can now partition the above sample space visually as such. We start with a grid, random variables and on their respective axes. We then partition this space in half along the line , and restrict our outcome space to the upper half triangle of the square. This is because, by indicating that y is the second or of the two points, we are restricting our outcome space to only points with .


Once we’ve defined the outcome space, let’s compute the sub area of this triangle that corresponds to the event . The first condition is that . We can partition and reduce the event space accordingly. The second condition is that , or . We can reduce the event space accordingly again. The last condition is that . However, we notice that the remaining space (the white, center triangle), already satisfies this condition. So we’re left to compute the area of this triangle: . We now divide the area of the event space, by the area of the outcome space, which we defined above to just be the upper half triangle, or 0.5: .

Now remember that this area was needed to calculate the complement of the desired event, so subtract it from 1: , to get .
Here is a program demonstrating this solution:
import random
def simulate_trial():
x, y = random.uniform(0, 1), random.uniform(0, 1)
x, y = min(x, y), max(x, y)
sides = [x, y-x, 1-y]
return min(sides)
res = []
for _ in range(1_000_000):
val = simulate_trail()
res.append(val)
print(len([i for i in res if i <= 0.2] / len(res)))