• I have a $n$ dimensional $\vec{a}$.
  • All elements of $\vec{a}$ are between 0 and a positive number $K$.
  • $n$ is about 15 to 20.


I want to randomly and unbiasedly choose a vector $\vec{b}$ such that:

  • Elements of $\vec{b}$ are between 0 and 1.
  • $\vec{a} \cdot \vec{b} = 1$

How to do that?


I thought about the following:

  • Choose $\vec{c}$, a random direction perpendicular to $\vec{b}$.
  • Find range of $\theta$ such that $\vec{b} = \frac{\vec{a}}{\lVert \vec{a} \rVert} + \theta\vec{c}$ is within bounds.
  • Randoly choose a $\theta$

The problem is that this is not unbiased. Some directions have a larger range of legal $\theta$, and those directions should be chosen more often.

  • $\begingroup$ Is that equivalent to choosing a random point on a simplex with $\vec{a}$ as the normal vector? $\endgroup$ – R zu Nov 7 '18 at 18:16
  • $\begingroup$ Before going to $n$-dimensional, have you made a detailed analysis on 2-dimensional? How do you define unbiased? Are you able to formalize your requirement, "Some directions have a larger range of legal θ, and those directions should be chosen more often" into probability terms? $\endgroup$ – John L. Nov 7 '18 at 18:31
  • $\begingroup$ Unbiased: Every $\vec{c}$ that satisfies the conditions in the problem has equal chance to be chosen. "Some directions..." is not a requirement in the problem. $\endgroup$ – R zu Nov 7 '18 at 19:17

Uniformly sampling from a simplex with equation $\vec{a} \cdot \vec{b} = 1$, and reject samples out of bounds.

Several answers are posted here for uniform sampling over a simplex: Uniform sampling from a simplex

  • $\begingroup$ found another method that doesn't need rejection. $\endgroup$ – R zu Nov 7 '18 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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