2
$\begingroup$

Suppose $x$ is uniformly sampled from an n-sphere of radius $1$ restricted to points with $\langle a, x\rangle=b$ for a given unit vector $a$ and a constant $b$

Given a unit vector $c$, what is the distribution of $\langle c, x\rangle$? Does it have a name?


Example for $a=(1,0,0), b=1/2, c=\frac{1}{\sqrt{3}}(1,1,1)$, empirical histogram of $\langle c, x\rangle$ can be seen below, what is the underlying form?

enter image description here notebook

$\endgroup$

1 Answer 1

2
$\begingroup$

Without loss of generality you can take $a$ to be a vector along the coordinate $x_{n+1}$ such that the intersection is effectively a $(n-1)$-sphere in the remaining coordinates $x_1$ to $x_{n}$.

We can see the dot product $c \cdot x$ as composed of two parts

$$c \cdot x = \sum_{i=1}^{n+1} c_i x_i = \underbrace{\sum_{i=1}^{n} c_i x_i}_{\substack{\text{distribution of the coordinate}\\\text{of the (n-1)-sphere}\\\text{along the direction of $c$}}} + \underbrace{\vphantom{\sum_{i=1}^{n}} c_{n+1}x_{n+1}}_{\text{a constant term}}$$

This is a scaled and shifted power semi-circle distribution or scaled and shifted beta distribution.

For more about that distribution see: Does the distribution $f(x) \propto (1-x^2)^{n/2}$ have a name?


The R-code below illustrates the scaling and shifting based on the 2-sphere example in the question

set.seed(1)
a = c(1,0,0)
b = 0.5
c = c(1,1,1)/sqrt(3)

### sample a uniform sphere
### reject cases where x*a is not close to b
rx = function(a,b,err = 0.02) {
    d = 1
    while (d>err) {
        x = rnorm(3)
        x = x/sum(x^2)^0.5
        d = abs(sum(x*a)-b)      
    }
    return(x)
}

### create a sample
xs = replicate(3*10^4,rx(a,b))

### statistics/images describing the sample
hist(xs[1,])
hist(xs[2,])
hist(xs[3,])
plot(xs[2,],xs[3,])

### draw the arrow on which
### the coordinate is projected
shape::Arrows(0,0,c[2],c[3],col = 2)


y = c %*% xs
dh = 0.05
hist(y, breaks = seq(min(y)-dh,max(y)+dh,dh), freq = 0, main = "")

### the constant term is x_1*c_1
### x1 satisfies x_1*a_1 = b
### then the constant is 

constant_term = b/a[1]*c[1]

### the remaining n-1 sphere has radius 
### sqrt(1 - x[1]^2)

r_sphere = sqrt(1-(b/a[1])^2)

### the vector 'c' in the space R^2 has length 

vec_c = sqrt(c[2]^2+c[3]^2) 

### the scaled beta distribution will range
### from -vec_c*r_sphere to +vec_c*r_sphere

scaling = vec_c*r_sphere*2

## adding this together, we can model it 
## as a scaled and shifted beta distribution

### a vector for the coordinates where we compute the density
ys = constant_term + seq(-scaling/2,scaling/2,scaling/10^3)

fs = dbeta((ys-constant_term)/scaling+0.5,0.5,0.5)/scaling

### adding the density to the plot
lines(ys, fs, lwd = 2)

title("histogram of simulations \n with added curve for scaled and shifted beta distribution density")
  • upper image: The distribution of the coordinates $x_2 \dots x_{n+1}$ is a $(n-1)$-sphere with radius $\sqrt{1-(a_1/b)^2}$. The range of the beta distribution relates to this radius multiplied with the length of the vector $\lbrace c_2, \dots , c_{n+1}\rbrace$.
  • lower image: a comparison of the histogram with the computed density. The shift of the beta distribution has 0.5 to get from the beta distribution to the semi-circle distribution and $c_1 a_1/b$ for the constant term in the product $c \cdot x$

example

$\endgroup$
2
  • $\begingroup$ Hm, Is it obvious how to figure out the specific form? Added a specific example for a 2-sphere in the post $\endgroup$ Commented Oct 15, 2023 at 4:00
  • 1
    $\begingroup$ @YaroslavBulatov I have added some code to illustrate it. $\endgroup$ Commented Oct 15, 2023 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.