# Probability of a small square existing in a larger square without intersecting the larger squares diagonals

Extra data:

1. The length of the larger squares side is 2 units and the smaller one is 0.5 units

2. The smaller square can have any orientation

3. The smaller square fully lies in the larger one.

4. The smaller square is to be chosen by selecting a random point in the larger square as it's center, rotating it by a random angle and checking if it lies in the larger square

My attempts at a solution:

I first treated this as a generic probability question and tried solving it graphically with diagrams for the extreme cases, and then using the fractions of areas to get the answer but then I realized that there were infinite cases where the squares were in the correct position and a larger(?) infinity where the smaller square intersected the diagonals.

If this were true, then the required probability tends to zero but this implies that the probability that the smaller square intersects the diagonals tends to one which is intuitively wrong.

I then tried solving parametrically, taking one random point in the large square, finding the corresponding possible points for the smaller square with respect to the first point and theta(Angle with the horizontal) then with the inequalities we get comparing these points with the line equations of the diagonals, we can get the probability by dividing the possible theta values by 360.

However, in this case, when the first point is selected close to the squares edge, we get some cases that don't even fit in the sample space with the necessary conditions.

New contributor
Davis is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• Please write coherent text (from a computer). Sentences like this are a mess! "My attempts at a solution I first treated this as a generic probab question and tried solving it graphically with diagrams for the extreme cases and then using the fractions of areas to get the answer but then I realized that there were infinite cases where the squares were in the correct position and a larger(?) infinity where the smaller square intersected the diagonals." – David G. Stork Aug 14 at 6:11
• How would you describe the distribution of the small squares? – A.G. Aug 14 at 9:44
• @DavidG.Stork I'm really sorry about that wall of text. I've edited it to make it more readable – Davis Aug 14 at 14:07
• "They are totally random" is not descriptive enough. The answer will depend on the distribution of the squares. This similar question had a lengthy discussion on this very topic which got moved to a chatroom here by a moderator. – JMoravitz Aug 14 at 14:27
• @JMoravitz Thank you for clarifying. I never considered those possibilities. The case I had in mind was where you would select the center of the smaller square at random in the larger square, rotate by a random angle and check if it lies in the larger square. I actually knew about Bertrand's paradox but didn't realize how it fit in this question. – Davis 2 days ago

I am assuming sides of length $$4$$ and $$1$$ for the large and small square, respectively. Furthermore, I am assuming that the rotation angle $$\alpha$$ between both squares is uniformly distributed within $$[0, \frac{\pi}{2}]$$ and that the top (left) corner of the small square is uniformly distributed within the valid region of the larger square.

If the rotation angle of the smallest square equals $$\alpha$$, then the area of possible points for the top (left) point of this square equals:

$$(4 - \sin \alpha - \cos \alpha)^2$$

We now need to find the area of the possible points for the top (left) point of this square, for which the square lies completely within one of four regions delimited by the diagonals. Applying basic formulas, and multiplying by $$4$$, we find:

$$\frac{(4 - \sin \alpha - 3 \cos \alpha)^2}{4} \cdot 4 = (4 - \sin \alpha - 3 \cos \alpha)^2$$

To arrive at the requested probability, we simply have to consider the ratio of the integrals of the two:

$$\frac{\int_{0}^{\frac{\pi}{4}} (4 - \sin \alpha - 3 \cos \alpha)^2 d \alpha}{\int_{0}^{\frac{\pi}{4}} (4 - \sin \alpha - \cos \alpha)^2 d \alpha} \approx \frac{0.680}{5.852} \approx 0.1161$$

This corresponds to the probability found by simulation in the answer given by Jean Marie.

• [+1] Very astute and moreover with didactic illustrations ! – Jean Marie Aug 14 at 12:01
• I hadn't at all this approach in mind. – Jean Marie Aug 14 at 12:04
• Thank you so much! Ingenious answer! – Davis Aug 14 at 13:55
• This needs to clarify what assumptions were made as to the distribution of the squares. See my above comments about Bertrand's paradox. – JMoravitz Aug 14 at 14:31

I have attempted a simulation approach. Here is a result :

The diagonals of the big square define 4 isosceles rectangular triangles. I single out one of them, the western one $$W$$ (squares that fall into it are colored green). It suffices to consider the probability $$p$$ of small squares to fall into $$W$$, then the final probability will be $$4p$$.

Experimental results show that $$p \approx 0.029$$.

Slightly related : this question.

The Matlab program that has created the figure :

clear all;close all;hold on;axis equal
set(gcf,'color','w');
plot([2,0,2,0,2,2,0,0],[2,0,0,2,0,2,2,0],'b');%square+diagonals
r=0;g=0;
for k=1:500;% 500=number of attempts ; less small squares are generated
z=2*(rand+i*rand);% centre of small square
a=2*pi*rand;% orientation angle
v=z+0.25*sqrt(2)*exp(i*a)*[1,i,-1,-i];%square's vertices
xv=real(v);yv=imag(v);
if all([xv>0,yv>0,xv<2,yv<2])
plot([v,v(1)],'r')
r=r+1;% accounts here for all squares, either red or green.
end;
if all([xv>0,yv>0,(xv+yv)<2,xv<yv])
plot([v,v(1)],'g')
g=g+1;
end;
end
p=g/r

• I have confirmed your simulation results. Could you check if this corresponds to what you had in mind? – jvdhooft Aug 14 at 11:34
• This was one of the questions that popped up in my math class to which none of us could find the answer to. We tried to make a simulation but that didn't go too well. Thank you for your help! Beautiful program, by the way – Davis Aug 14 at 14:00
• This needs to clarify what assumptions were made as to the distribution of the squares. See my above comments about Bertrand's paradox. – JMoravitz Aug 14 at 14:31
• @JMoravitz I agree with you. This is a reason why I supplied my code ; nevertheless, I should have said it explicitly : the centers of the small squares are uniformly distributed within the big square (with an elimination/thinning process for small squares having at least one of their vertices outside the big square ; inclination angle of the small squares is as well uniformly distributed on $[0,2\pi]$. – Jean Marie Aug 14 at 15:16