1

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.

Jack D'Aurizio
  • 361,689

2 Answers2

2

$$ 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.

Jack D'Aurizio
  • 361,689
  • Thanks. Can you explain why the latter probability P(t<\lambda) is lambda^2? I haven't understood that bit. – curious_cat May 15 '16 at 03:21
  • 2
    @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. – joriki May 16 '16 at 10:23
1

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

G Cab
  • 35,964
  • Thanks! But I don't see the square root emerging out of that description? Perhaps I missed it..... – curious_cat May 14 '16 at 16:31
  • @curious_cat sure you do not see it, because it would lead to a non-linear combination, as Jack already pointed out. – G Cab May 14 '16 at 16:37
  • @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. – G Cab May 14 '16 at 16:51