Find the probability that two randomly selected points inside a sphere of radius $r,$ are at most $d$ apart, where $0\leq d \leq 2r$.
I've seen several answers on Math Stack Exchange about this, but I really haven't been able to understand how to come up with the probabilities. For instance, this post has two answers, none of which I can understand. Could someone direct me to some resources to better understand how to derive $3$-dimensional integrals such as the one in the answer? I understand that I can pick the first point and modify the coordinate system so that it has coordinates at $(0,0,z)$ and that makes things easier to visualize and compute. Also, since the probabilities are the same regardless of what $r$ is by symmetry, I can assume WLOG that $r=1.$ But how did @Empy2 derive the integral? The integral from $0$ to $1$ of $z^2$ wrt $z$ in the denominator I presume represents the probability of the sample space?


