2

There are many posts (e.g. here) on this forum showing that if you want to sample uniformly from the triangle $(1,0,0), (0,1,0), (0,0,1)$, you can sample $s,t \sim U[0,1]$, and compute

$$(1-\sqrt{s}, \sqrt{s} (1-t), \sqrt{s}t)$$

However, I wanted to verify that this approach is valid by computing the CDF of the resulting points. I tried

$$ Pr(1-\sqrt{s} \leq x, \sqrt{s} (1-t) \leq y, \sqrt{s}t \leq z) = \int_{(1-x)^2}^1 \int_{1-y/\sqrt{s}}^{z/\sqrt{s}} 1 \quad dtds$$

by working out the bounds of $s$ and $t$.

Next, the integral evaluates to

$$ \int_{(1-x)^2}^1 \int_{1-y/\sqrt{s}}^{z/\sqrt{s}} 1 \quad dtds = (z+y)2 - 1 - ( (z+y)(1-x)2 - (1-x)^2)$$

Differentiating the right-hand side gives me $2$, but the area of the triangle is $\sqrt{3}/2$. Shouldn't I be expecting $2 / \sqrt{3}$?

I don't think I messed up the algebra. Am I getting the limits of the integration wrong?

user1691278
  • 1,445
  • 14
  • 27

1 Answers1

1

The issue is that you don't take into account in your calculation the fact that point $(x,y,z)$ must verify $x+y+z=1$.

Let us work on a planar similar case in order to understand it.

Consider the line segment joining point $A(1,0)$ and $B(0,1)$. It is clearly uniformly sampled by taking $$(x=t,y=1-t),$$ $t$ being a realization of r. v. $T \approx U(0,1)$.

Let us consider the associated cdf :

$$p := P(x<t \ \& \ y<1-t) = P(x<t<1-y)=(1-y-x)_+$$

where $(A)_+ := max(A,0)$

(the second equality is due to the uniform distribution of variable $T$).

But (1) means that $p$ is a constant (equal to $\tfrac16$ which is unimportant). Therefore differentiating it in the hope to get the pdf gives $0$ which is meaningless.

What is wrong in this process ? We haven't taken into account the fact that $x+y=1$...

Jean Marie
  • 88,997