Given the cartesian coordinates of three vertices of a triangle $P_1$, $P_2$, $P_3$ I know (have simulated) that I get randomly distributed points by using this protocol:

$s=\text{rand}(0,1)\quad t=\sqrt{\text{rand}(0,1)}$

$P = (1-t)\cdot P_1 + t\cdot\left( (1-s)\cdot P_2 + s\cdot P_3\right )$

where $\text{rand}()$ is the uniform random number generator.

Can someone explain why this works?

Intuitively, this seems like applying the lever rule on the edge between one pair of points, say, $P_2$ & $P_3$ to get a intermediate point $P'$ & then a second lever rule between $P'$ and $P_1$.

What I don't get is why the second lever is drawn from a square root of the first uniform distribution.


$$ Q_s=(1-s) P_2 + s P_3 $$ is a convex combination of $P_2$ and $P_3$ and $$ P_{s,t} = (1-t) P_1 + t Q_s $$ is a convex combination of $P_1$ and $Q_s$, hence a point of the convex envelope of $P_1,P_2,P_3$, i.e. the original triangle. If we draw a random point $P$ in the triangle from a uniform distribution, $P=P_{s,t}$ for some $(s,t)\in[0,1]^2$, and the marginal distributions of $s$ and $t$ can be recovered in a straightforward way. For any $\lambda\in[0,1]$, both $$ \mathbb{P}[s\leq \lambda]\qquad \mathbb{P}[t\leq \lambda] $$ can be computed in terms of triangle areas, but while $\mathbb{P}[s\leq \lambda]=\lambda$, $\mathbb{P}[t\leq \lambda]=\lambda^\color{red}{2}$.

So $s$ has a uniform distribution, but the distribution of $t$ is the square root of a uniform distribution.

  • $\begingroup$ Thanks. Can you explain why the latter probability P(t<\lambda) is lambda^2? I haven't understood that bit. $\endgroup$ – curious_cat May 15 '16 at 3:21
  • 2
    $\begingroup$ @curious_cat: Draw the entire triangle and the one for $t\le\lambda$ -- you'll see that the latter is the former scaled by $\lambda$ in both dimensions. $\endgroup$ – joriki May 16 '16 at 10:23

That is a tecnique well known in chemistry, for representing mixtures of 3 substances, it is called "Trilinear" coordinates, re for e.g. to https://en.wikipedia.org/wiki/Trilinear_coordinates

  • $\begingroup$ Thanks! But I don't see the square root emerging out of that description? Perhaps I missed it..... $\endgroup$ – curious_cat May 14 '16 at 16:31
  • $\begingroup$ @curious_cat sure you do not see it, because it would lead to a non-linear combination, as Jack already pointed out. $\endgroup$ – G Cab May 14 '16 at 16:37
  • $\begingroup$ @curious_cat I meant to say: sure you do not see it there.To keep uniformity, you have to combine the three components linearly (Tri-linearly). Your combination involves instead the product $t s$ of the parameters, since you made a double combination. Then Jack already answered about. $\endgroup$ – G Cab May 14 '16 at 16:51

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.