The probability that the distance between two random points in a $3\times 3$ square is less than $\sqrt{3}$ I want to know how to solve this problem on probability. Here is the problem, 

What is the probability of choosing two points randomly in a 3 cm×3 cm square so that the distance between them is smaller than $\sqrt{3}$ cm.

Thank you!

Denote the two points by ${\bf Z}_i=(x_i,y_i)\in[0,1]^2$. We shall compute  the probability  that $|{\bf Z}_1-{\bf Z}_2|^2> a^2$ for a given $a\in[0,\sqrt{2}]$. In the  example at hand $a={1\over\sqrt{3}}$.
Consider the random variable $X:=|x_1-x_2|$, where $(x_1,x_2)$ is uniformly distributed in the square $Q:=[0,1]^2$. The points $(x_1,x_2)\in Q$ where $X>t$ for a given $t\geq0$ make up two triangles of total area $(1-t)^2$. It follows that
$$P[X>t]=(1-t)^2\qquad(0\leq t\leq1)\ ,$$
whence
$$P[X^2>u]=\bigl(1-\sqrt{u}\bigr)^2\qquad(0\leq u\leq 1)\ .$$
Therefore $X^2$ has probability density
$$f_{X^2}(u)=-{d\over du}P[X^2>u]={1\over\sqrt{u}}-1\ .$$
The same argument applies to $y_1$, $y_2$, and  $Y:=|y_1-y_2|$. It follows that
$$\eqalign{P[X^2+Y^2>a^2]&=P[X^2>a^2]+\int_0^{a^2} f_{X^2}(u)\ P[Y^2>a^2-u]\ du\cr
&=(1-a)^2+\int_0^{a^2}\left({1\over\sqrt{u}}-1\right)\left(1-\sqrt{a^2-u}\right)^2\ du\cr
&=1+{8a^3\over3}-{a^4\over2}-a^2\pi\ ,\cr}$$
according to Mathematica. When $a={1\over\sqrt{3}}$ the requested complementary probability $P':=P[X^2+Y^2\leq{1\over3}]$ therefore comes to
$$P'={1\over18}-{8\over9\sqrt{3}}+{\pi\over3}\doteq 0.589553\ .$$
A simulation with $10^7$ point pairs showed a success frequency of $0.589267$.
