Let $U=(X_U, Y_U)$ and $V=(X_V, Y_V)$ be two independent random points in $[0,1] \times [0,1]$, where each possible position is equally likely.
Now I am interested in the probability that these two random chosen points have distance $\leq r$ on the torus.
The distance on the torus is defined as $$d(U,V)=\sqrt{\min(|X_U-X_V|, 1-|X_U- X_V|)^2 + \min(|Y_U-Y_V|, 1-|Y_U- Y_V|)^2}.$$
I tried to do the following, using $A:=\min(|X_U-X_V|, 1-|X_U- X_V|), B:=\min(|Y_U-Y_V|, 1-|Y_U- Y_V|)$,
$$P[d(U,V)\leq r]=P[A^2+B^2 \leq r^2]=\int_{0}^{r^2} P[A^2=t]P[B^2\leq r^2-t]\text{d}t$$ $$=\int_{0}^{r^2} \int_{0}^{r^2-t} P[A^2=t]P[B^2=s] \text{d}s \text{d}t.$$
But I have no idea how to calculate $A^2$ and $B^2$.
Intuitively, I would say that the probability is the area of a circle of radius $r$, which is $r^2 \pi$.
So would really appreciate any hint of you! Thank you very much.
Note that because the metric is translation-invariant, you can assume WLOG that $U = (1/2,1/2)$, say. If $0 \le x \le 1$ and $0 \le y \le 1$, the distance from $(x,y)$ to $(1/2,1/2)$ on the torus is the same as the Euclidean distance. So the probability that $d(U,V) \le r$ is just the area of the intersection of the circle of radius $r$ centred at $(1/2,1/2)$ with the square $[0,1] \times [0,1]$.