Let $X_i$ $ (1\leq i\leq n)$ be identically distributed uniformly on $(0,1)$. Let $U = \min_i(X_i)$, $V = \max_i(X_i)$. Find the pdf of $V-U$
This is what I did. I found the cdf and differentiated.
$$F_{V-U}(x)= \mathbb{P}(V-U \leq x)$$
We fix two of the random variables as the minimum and maximum and we of course have $2\binom{n}{2}$ choices and for each choice we fix the minimum, find the probability for the maximum and integrate.
$$\int_0^1 x-u \quad du = x - \frac{1}{2}$$
So
$$F_{V-U}(x) = 2(x-0.5)\binom{n}{2} \quad x\in(0,1)$$
and cdf equals $0$ elsewhere.
So $f_{V-U}(x) = 2\binom{n}{2} \quad x\in(0,1)$
but this doesn't make much sense since it doesn't integrate to $1$ over the $(0,1)$ interval. How can I fix it? Where did I go wrong?
Your argument for constructing the order statistic's density function is almost correct. You want the count of ways to select two of the samples to be required values, times the density functions for each of those values, times the probability that the remaining $n-2$ samples lie between these values.
Next, it will be easier to integrate the probability of the complement.
$$\begin{align}F_{V-U}(x) =&~ 1- \mathsf P(V-U>x) \\=&~ 1-\int_x^1\int_0^{v-x} f_{U,V}(u,v)\operatorname d u\operatorname d v \\=&~ 1- n(n-1)\int_x^1\int_{0}^{v-x} f_X(u)(F_X(v)-F_X(u))^{n-2}f_X(v) \operatorname d u\operatorname d v\\ =&~ 1-n(n-1)\int_x^1\int_0^{v-x} (v-u)^{n-2}\operatorname d u\operatorname d v \end{align}$$