Abstract
Suppose and are two arbitrary fixed points in -dimensional space and is a random vector with a known probability density. It is desired in some applications to find the joint probability distribution function for the distance between and and the distance between and . This calculation has applications in signal processing, goodness-of-fit testing and two-sample testing. In this article, the efficient numerical calculation of the probability distribution is illustrated. The calculation reduces to the sum of two separate integrals where each integral is over a spherical cap. This is achieved by a transformation of the complex spherical intersection region into a sum of integrals over hypercubes via a carefully constructed variable change. The general approach applies to any application where integrals over a region defined by a spherical cap need to be evaluated.