Generating points on a unit hypersphere with one (or more) fixed components

62 Views Asked by At

For a research project, I am interested in generating some directional data (each point must be on a unit hypersphere) with the property that the $k$th component is equal for all data points. For example:

$$x_{1,1}, x_{1,2}, \ldots, y,\ldots,x_{1,p}$$ $$x_{2,1}, x_{2,2}, \ldots, y,\ldots,x_{2,p}$$ $$\vdots$$ $$x_{n,1}, x_{n,2}, \ldots, y,\ldots,x_{n,p}$$

The best idea I have come up with so far is to create an initial point by generating $p$ random numbers and normalizing the vector. Using this initial point, we can randomly swap signs and positions of the components (other than the one we want to keep fixed) to get new points which are still on the unit hypersphere. For example:

$$x_{1,1}, x_{1,2}, \ldots, y,\ldots,x_{1,p}$$ $$-x_{1,1}, x_{1,2}, \ldots, y,\ldots,x_{1,p}$$ $$\vdots$$ $$x_{1,2}, -x_{1,1}, \ldots, y,\ldots, -x_{1,p}$$

However, this severely limits the number of points that can be generated and hardly seems "random." Any ideas?

1

There are 1 best solutions below

0
On BEST ANSWER

If the $k^{\text{th}}$ component is $y$ then we have an $n-1$ dimensional hypersphere of radius $\sqrt{1-y^2}$. So take $n-1$ independent random numbers uniformly distributed over $[-1,1]$. Then normalize them the following way:

$$x'_i=\begin{cases}x_i\sqrt{\frac{1-y^2}{\sum_{i\not=k}x_i^2}}&\text{ if }\ i\not=k\\ y&\text{ if }\ i=k\end{cases}.$$

Then the point $(x'_1,x_2',\dots,y,\dots,x_n')$ is on the unit sphere. Indeed

$$\sum_{i=1}^{k-1}x_i^2\frac{1-y^2}{\sum_{i\not=k}x_i^2}+y^2+\sum_{i=k+1}^{n}x_i^2\frac{1-y^2}{\sum_{i\not=k}x_i^2}=$$ $$=\frac{\sum_{i\not =k}x_i^2}{\sum_{i\not =k}x_i^2}(1-y^2)+y^2=1.$$