1
$\begingroup$

How can one generate $k$ uniform random variates centered at zero, $X_1, X_2, ..., X_k$, given a constant Euclidean norm, $c =\sqrt{X_1^2+X_2^2+...X_k^2}$?

$\endgroup$
5
  • $\begingroup$ See stats.stackexchange.com/questions/7977/… $\endgroup$ Sep 14, 2020 at 22:48
  • 4
    $\begingroup$ There is no solution --- if they obey the constraint then they are not independent. Perhaps also related to this question. $\endgroup$
    – Ben
    Sep 15, 2020 at 1:46
  • 1
    $\begingroup$ @QuestionAsker did you mean that the X's are marginally uniform, or uniform on the hypersurface? $\endgroup$
    – Glen_b
    Sep 15, 2020 at 22:37
  • 1
    $\begingroup$ @Glen_b Uniform on the hypersurface. I was under the impression that if they were marginally uniform, they would be be uniform on the surface, but I see now this is not the case. $\endgroup$
    – Joby D
    Sep 16, 2020 at 1:54
  • $\begingroup$ For a sphere, i.e. $k=3$, uniform on the surface does imply marginally uniform (though not independent) - think Archimedes On the Sphere and Cylinder. This is not true in other dimensions. You can then easily construct $X_1,X_2,X_3$ from two independent uniform random variables. $\endgroup$
    – Henry
    Sep 16, 2020 at 7:02

1 Answer 1

3
$\begingroup$

Generate $k$ independent standard normal random variates $Y_1, Y_2, \ldots, Y_k$

and then scale to give the desired $c$ with $$X_i= \frac{c}{\sqrt{Y_1^2+Y_2^2+\cdots+Y_k^2}}Y_i$$

$\endgroup$
7
  • 1
    $\begingroup$ probably a duplicate but faster to type an answer than find it - stats.stackexchange.com/questions/7977/… deals with the 3D case and lots of questions are linked to it $\endgroup$
    – Henry
    Sep 14, 2020 at 22:44
  • $\begingroup$ Per Ben's comment, this fails to meet the condition that the X's are independent. If the OP removes that condition so that your answer applies, then the question is definitely a duplicate as indicated. $\endgroup$
    – Glen_b
    Sep 15, 2020 at 3:09
  • $\begingroup$ @Glen_b Whether it's a duplicate depends on how we interpret the "uniform" of the question: does it mean marginally uniform or uniform on the sphere's surface? The question, as currently phrased, strongly implies the former meaning is intended, whereas the duplicate addresses the latter meaning only. The answer is in the negative as one can see by drawing a picture of the case $k=2.$ $\endgroup$
    – whuber
    Sep 15, 2020 at 15:10
  • $\begingroup$ @Glen_b it has been changed to remove "independent" $\endgroup$
    – Henry
    Sep 15, 2020 at 15:28
  • 1
    $\begingroup$ @whuber given that the OP has now clarified in comments, it should instead close as a duplicate though I doubt we'd gather the votes to both reopen and close again for a new reason. $\endgroup$
    – Glen_b
    Sep 16, 2020 at 2:20

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