# Probability of 2 points uniformly distributed over unit square

If either point is above or on the y=1/4 line, or below or on the y=-1/4 line, then the two points are definitely on the same side of the x-axis. For the other possible points I know I need to calculate portions of the areas of circles with radius=1/4; I'm just not sure how to go about that.

-
Doesn't the unit square have sides of length 1? You appear to be defining it over (-1,1) in each dimension??? – wolfies Dec 6 '13 at 5:25

Let $(X_1, Y_1)$ and $(X_2, Y_2)$ be the Cartesian coordinates of the two random points with $D$. Then $X_1$, $X_2$, $Y_1$ and $Y_2$ and independent and uniformly distributed over $(-1,1)$ interval.

The event of interest is $A = \{Y_1 Y_2 > 0\}$, conditioned on another event $$B = \{(X_1-X_2)^2 + (Y_1-Y_2)^2 < \tfrac{1}{4}$$

You are to compute $$\begin{eqnarray} \Pr(A \mid B) &=& \frac{\Pr(A, B)}{\Pr(B)} \\ &=& \frac{ \int_{-1}^1 \int_{-1}^1 \int_{-1}^1 \int_{-1}^1 \left[y_1 y_2 > 0\right] \cdot \left[ (x_1-x_2)^2 + (y_1-y_2)^2 < \frac{1}{4^2} \right] \mathrm{d}x_1 \mathrm{d}x_2 \mathrm{d}y_1 \mathrm{d}y_2}{ \int_{-1}^1 \int_{-1}^1 \int_{-1}^1 \int_{-1}^1 \left[ (x_1-x_2)^2 + (y_1-y_2)^2 < \frac{1}{4^2} \right] \mathrm{d}x_1 \mathrm{d}x_2 \mathrm{d}y_1 \mathrm{d}y_2 } \end{eqnarray}$$

Asking Mathematica to evaluate this gives:

The answer agrees with Monte-Carlo simulation:

In[55]:= bset =
Cases[RandomVariate[
UniformDistribution[{-1, 1}], {2 10^6, 2,
2}], {{x1_, y1_}, {x2_, y2_}} /; (x1 - x2)^2 + (y1 - y2)^2 <
1/4^2];

In[56]:= Length[Cases[bset, {{x1_, y1_}, {x2_, y2_}} /; y1 y2 > 0]]/
Length[bset] // N

Out[56]= 0.942381

-

This is an odd definition of a "unit square" since it has an area of $4\text{units}^2$! Notwithstanding:

You are on the right track:

1. By symmetry, you only need to consider one side of the axis, lets make it the positive side.
2. As you say, if $y_1\ge \frac{1}{4}$ then they are on the same side. The probability of this is $0.75$.
3. As you say, if $y_1\lt \frac{1}{4}$ the probability that $y_2$ is on the same side of the x-axis is the ratio of the upper segment of the circle formed by the x-axis to the circle as a whole. How's your circle geometry?
-