Two squares each measuring 17 cm x 17 cm are randomly drawn inside a larger square measuring 1m x 1m.
The sides of the two smaller squares are both parallel/perpendicular to the sides of the larger square.
Determine the probability that the two smaller squares overlap or touch each other.
In each of the two dimensions, each of the smaller squares has a range of 83 cm in which it can be located, with presumably a uniform distribution. The centers, in each dimension, must be within 17 cm of each other in order to overlap.
Call the squares A and B. If square A is at, say, the leftmost possible position, square B has a range of 17 cm left-right to allow an overlap (I say allow, rather than cause, as the other dimension must also allow it, which I'll get to later). The same is true if square A is in the rightmost possible position.
But if square A is more than 17 cm from either left or rightmost position, there's a range of 34 cm for square B that allows an overlap. Since the range varies linearly with A's position, the weighted average of the positions of B that allow for overlap is (34*(17+34)/2 + 49*34)/83 = 2533/83 ~= 30.5180722891566.
The probability B will be in this range for that dimension is that divided by 83, or 2533/6889 or about 0.367687617941646.
Since the overlap must be in both dimensions, the needed probability is the square of that: 6416089/47458321 ~= 0.135194184387602.
A hundred million trials had an overap 13516884 times or 0.13516884 of the trials, which agrees.
succ=0;
for trial=1:100000000
x1=rand*83;
y1=rand*83;
x2=rand*83;
y2=rand*83;
if abs(x1-x2)<17 && abs(y1-y2)<17
succ=succ+1;
end
end
disp(succ/trial)
|
Posted by Charlie
on 2022-09-24 11:53:27 |