# Calculating the Expected value of a function over a random vector

let $$(X_1, X_2, \dots, X_n)$$ be the order statistics of $$n$$ i.i.d. uniform random variables. that satisfies the following condition. $$0 < x_1 < x_2 < \dots < x_n < 1$$ now consider a continuous function $$f : [0,1] \rightarrow \mathbb{R}$$ we define the random variable $$R$$ to be: $$R = \sum_{i = 0}^{n - 1}f(X_{i+1}) \times (X_{i+1} - X_i) \hspace{0.5cm}X_0 = 0$$ I need to prove the expected value of R equals: $$E[R] = \int_{0}^{1}f(t)(1-(1-t)^n)dt$$ What I've tried so far is that I tried to find the pdf of each $$X_i$$ using the following formula: $$f_{X_k}(x_k) = \frac{n!}{(k-1)!(n-k)!}F_X^{k-1}(x)[1-F_X(x)]^{n-k}f_X(x)$$ where $$f_{X}$$ is the pdf of our Uniform random variable(not to be mistaken with the f function described above) and F is the CDF of the aforementioned random variable. Using the said pdf and CDF and the linearity of expected value seems to get me nowhere, and I'm stuck.

Note that for $$0\le i\le n-1$$, $$\mathsf{E}f(X_{i+1})(X_{i+1}-X_i)=\frac{1}{1+i}\mathsf{E}f(X_{i+1})X_{i+1}$$ Thus, \begin{align} \mathsf{E}R&= \sum_{i=0}^{n-1}\frac{1}{1+i}\mathsf{E}f(X_{i+1})X_{i+1} \\ &= \sum_{i=0}^{n-1}\frac{1}{1+i}\int_0^1 f(x)xf_{X_{i+1}}(x)\, dx \\ &=\int_0^1 f(x)\sum_{i=1}^n\binom{n}{i}x^{i}(1-x)^{n-i}\, dx \\ &=\int_0^1 f(x)(1-(1-x)^n)\, dx \end{align} because $$\sum_{i=0}^n\binom{n}{i}x^{i}(1-x)^{n-i}=1$$.
One can show the first equality by noticing that $$(X_i,X_{i+1})\overset{d}{=}\big(U_{i}^{1/i}\cdots U_n^{1/n},U_{i+1}^{1/(i+1)}\cdots U_n^{1/n}\big)$$, $$1\le i\le n-1$$, where $$U_1,\ldots,U_n$$ are i.i.d. $$U[0,1]$$ random variables and computing the expectation. That is, letting $$Z\equiv U_{i+1}^{1/(i+1)}\cdots U_n^{1/n}$$, \begin{align} \mathsf{E}f(X_{i+1})(X_{i+1}-X_i)&=\mathsf{E}f(Z)Z\big(1-U_i^{1/i}\big) \\ &=\mathsf{E}[f(Z)Z]\times \mathsf{E}\big[1-U_i^{1/i}\big] \\ &=\mathsf{E}[f(Z)Z]\times \frac{1}{1+i}. \end{align}