Suppose I generate $x_1,x_2,x_3,x_4$ through the following procedure:

  1. Sample $x_1,x_2,x_3 \sim \text{unif}(0, 1)$, iid
  2. While $x_1+x_2+x_3 > 1$, resample them all
  3. Let $x_4 = 1 - x_1 - x_2 - x_3$

What is the distribution of the $x_1,x_2,x_3,$ and $x_4$ we end up with afterwards? I empirically found that they all seem to follow the same distribution, but can't figure out how to derive this distribution analytically.

  • 2
    $\begingroup$ @Xi'an I don't think that's quite true: $x_4$ will be decidedly non-uniform. $\endgroup$
    – whuber
    Commented Nov 26, 2019 at 23:54
  • 2
    $\begingroup$ @Xi'an The question, though, concerns the distribution of $X_4$ and whether it's the same as the distribution of the other $X_i.$ $\endgroup$
    – whuber
    Commented Nov 27, 2019 at 17:07
  • $\begingroup$ could you explain "I empirically found that they all seem to follow the same distribution". I think it is not valid. $\endgroup$
    – Masoud
    Commented Feb 21, 2020 at 14:19

1 Answer 1


The answer is:that's not true. it is look like

  1. generate $(X_1,X_2,X_3)$ such that $S=X_1+X_2+X_3 \leq 1$
  2. $X_4=(1-S)$

or on the other hands $X_4= (1-S|S<1) $. now we want to find a conditional distribution $(1-S|S<1)$.

$S=X_1+X_2+X_3$ and according to https://en.wikipedia.org/wiki/Irwin%E2%80%93Hall_distribution

\begin{eqnarray} f_S(a)=\left\{ \begin{array}{cc} \frac{1}{2} a^2 & 0\leq a <1 \\ \frac{1}{2}(-2a^2+6a-3) & 1\leq a<2 \\ \frac{1}{2} (a-3)^2 & 2\leq a<3 \end{array} \right. \end{eqnarray}

so $P(S\leq 1)=\int_{0}^{1} \frac{1}{2} a^2 da=\frac{1}{6}$


$P( 1-x \leq S\leq 1)=\int_{1-x}^{1} \frac{1}{2} a^2 da$ $=\frac{1}{6} a^3|_{1-x}^{1}=\frac{1}{6}(1-(1-x)^3)$

so $F_{X_4}(x)=P(X_4\leq x)=P(1-S\leq x|S<1)=P(S\geq 1-x|S\leq 1)$

$=\frac{P( 1-x \leq S\leq 1)}{P(S\leq 1)}=1-(1-x)^3 $ $,x<1$

its not look like uniform distribution and $f_{X_4}(x)=3(1-x)^2$ .($beta(1,3)$ distribution)

a simple simulation confirms that the $X_4$ does not follow uniform distribution:

for(i in 1:simu){
              if(s<1) {x4[count]<-1-s;count<-count+1}
 > ks.test(x4,runif(length(x4)))

    Two-sample Kolmogorov-Smirnov test

data:  x4 and runif(length(x4))
D = 0.37026, p-value < 2.2e-16
alternative hypothesis: two-sided

enter image description here

it's simple to check $1-S|S>1$ does not have uniform distribution.

  • $\begingroup$ That's a nice proof that x4 doesn't follow the uniform distribution. Can you derive the distributions of x1, x2, and x3 though? $\endgroup$
    – zim333311
    Commented Dec 2, 2019 at 17:54
  • $\begingroup$ X_1,...,X_3 follow uniform distribution according to they are generated from U(0,1).(look at step 1) $\endgroup$
    – Masoud
    Commented Dec 3, 2019 at 20:34
  • $\begingroup$ It's simple that when $X_1$ generate from uniform distribution,so the distribution of $X_1$ obviously is uniform, because you just created it. but you created $X_4$ from $X_1,...,X_3$. so you just does not know the distribution of it, so based on $X_1,...,X_3$ you can extract the distribution of $X4$. $\endgroup$
    – Masoud
    Commented Dec 28, 2019 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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