# constant approximation based on "sorted uniform distribution" and beta distribution [closed]

Let $$X_1, X_2 \stackrel{\text{iid}}{\sim}\mathrm{Uniform}(0,1)$$ and then sort $$X_1,X_2$$ to get $$X_{(1)} < X_{(2)}$$.

Based on the pdfs of $$X_{(i)}$$, we know $$X_{(1)} \sim \mathrm{Beta}(1,2)$$ and $$X_{(2)} \sim \mathrm{Beta}(2,1)$$, with $$\mathbb{E}(X_{(1)}) = \frac{1}{3}$$ and $$\mathbb{E}(X_{(2)}) = \frac{2}{3}$$.

Consider the constant approximation for the function $$f(x) = x$$.

1. Sample two points $$x_1, x_2$$ uniformly on $$(0, 1)$$ and then sort them to get $$x_{(1)}$$ and $$x_{(2)}$$, $$x_{(1)} < x_{(2)}$$. Denote the expectation as $$\mathbb{E}_1(\|f - c\|_2^2) = \mathbb{E}_1(\displaystyle\int_{x_{(1)}}^{x_{(2)}} (f(t)-c)^2 \; dt)$$, where $$c = \frac{1}{x_{(2)}-x_{(1)}}\displaystyle\int_{x_{(1)}}^{x_{(2)}} f(t)\; dt$$ is a constant.

2. Sample $$y_{(1)}$$ from $$\mathrm{Beta}(1,2)$$ and $$y_{(2)}$$ from $$\mathrm{Beta}(2,1)$$. Denote the Expectation as $$\mathbb{E}_2(\|f - c\|_2^2) = \mathbb{E}_2(\displaystyle\int_{y_{(1)}}^{y_{(2)}} (f(t)-c)^2 \; dt)$$, where $$c = \frac{1}{y_{(2)}-y_{(1)}}\displaystyle\int_{y_{(1)}}^{y_{(2)}} f(t)\; dt$$ is a constant.

(Note: the definitions of $$\mathbb{E}_1$$ and $$\mathbb{E}_2$$ are identical; the only difference is the method of obtaining the points $$x_{(i)}, y_{(i)}$$.)

Compare $$\mathbb{E}_1(\|f - c\|_2^2)$$ and $$\mathbb{E}_2(\|f - c\|_2^2)$$. It's observed from the numerical experiments that $$\mathbb{E}_1(\|f - c\|_2^2) < \mathbb{E}_2(\|f - c\|_2^2)$$. This result confuses me.

I expect them to be equal because both $$x_{(i)}$$ and $$y_{(i)}$$ from the same Beta distribution as discussed above.

Is this because $$x_{(1)} \;\mathrm{and}\; x_{(2)}$$ are not independent? If so, what is the joint probability density of $$x_{(1)}$$ and $$x_{(2)}$$?

Is the following the correct joint density?

$$f_{x_{(1)}, x_{(2)}}(u, v) = n! f_{x_{(1)}}(u) f_{x_{(2)}}(v) \mathbf{1}_{u, where $$f_{x_{(1)}}$$ and $$f_{x_{(2)}}$$ are pdfs of $$\mathrm{Beta}(1,2)$$ and $$\mathrm{Beta}(2,1)$$?

New contributor
learner is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• I don't see any "piecewise constant approximation" to the identity function $f.$ Perhaps you omitted something?
– whuber
2 days ago
• Even though the marginals are the same, $X_{(1)}$ and $X_{(2)}$ are indeed negatively correlated, while there is a positive probability that $Y_{(2)}<Y_{(1)}$. 2 days ago
• @whuber Yes, I forgot to change the description. In fact, it's just a constant approximation to the function $f$ on an interval. 2 days ago
• Because both those expectations are easily computed in closed form and have simple formulas, I wonder whether you are asking the question you intend to ask. Regardless, the procedure differ because the $y_{(i)}$ are independent whereas the $x_{(i)}$ are not. Finally, you have already concluded the $x_{(i)}$ have Beta distributions, so why is your ultimate question about their "pdfs or cdfs"? Just look them up!
– whuber
2 days ago
• @whuber Thank you for your comments. I am not asking for the pdfs or cdfs of the Beta distribution, which are "trivial". My question was if $x_(1)$ and $x_(2)$ are not independent, what is the joint density? Through my search today, I think the joint density should be $f_{x_{(1)}, x_{(2)}}(u, v) = n! f_{x_{(1)}}(u) f_{x_{(2)}}(v) \mathbf{1}_{u<v}$, where $f_{x_{(1)}}$ and $f_{x_{(2)}}$ are pdfs of $\mathrm{Beta}(1,2)$ and $\mathrm{Beta}(2,1)$, respectively. But I am not sure do I need the indicator function $\mathbf{1}_{u<v}$. yesterday