finding probability density function Suppose $X_1,\ldots,X_n$ are random samples of a $U(0,\theta)$ distribution. If $Y_n$ are the largest order statistics of the sample, and $V=\displaystyle\frac{n\bar{X}}{Y_n}$,  how can I calculate the probability density function of $V$?
 A: Let the order statistics be $X_{[1]}\le X_{[2]}\le\cdots\le X_{[n]}$ and assume the $\{X_i\}$ are independent.  The following are well known:


*

*The joint distribution of the order statistics $(X_{[i]})$ is uniform on the set $0\le X_{[1]}\le X_{[2]}\le\cdots\le X_{[n]}\le \theta.$  This is a consequence of (a) the uniformity of $(X_1,X_2,\ldots, X_n)$ and (b) the map that takes $(X_1, X_2, \ldots, X_n)$ into its sorted version (the order statistics) is an $n!$ to $1$ probability-preserving map.  Thus the joint pdf of the order statistics is
$$f_\theta(y_1,y_2, \ldots, y_n) = \frac{n!}{\theta^n}I(0\le y_1\le y_2\le \cdots \le y_n \le \theta)$$
($I$ is the indicator function).

*The marginal CDF of the maximum, $X_{[n]}$, is
$$F_n(y_n) = {\Pr}_\theta(X_{[n]}\le y_n) =  {\Pr}_\theta(X_1\le y_n)\cdots{\Pr}_\theta(X_n\le y_n) = \left(\frac{y_n}{\theta}\right)^n$$
whence its PDF is
$$f_n(y_n) = \frac{d F_n(y_n)}{d y_n} = \frac{n y_n^{n-1}}{\theta^n}.$$
Dividing $f_\theta$ by $f_n$ shows the conditional distribution of the sum 
$$Y = X_{[1]}+\cdots X_{[n-1]} = X_1+X_2+\cdots+X_n - X_{[n]} = n\bar{X}-X_{[n]}$$  
is
$$f_Y(y\ |\ X_{[n]}=y_n) = \frac{(n-1)!}{y_n^{n-1}}I(0\le y_1\le y_2\le \cdots \le y_{n-1} \le y_{n}).$$
This is recognizable (by comparing to result (1) above) as the distribution of the order statistics of $n-1$ iid uniform$(0, y_n)$ variates.  Dividing by $y_n$ rescales them to iid uniform$(0,1)$ variates, whence the distribution of $\frac{Y}{X_{[n]}} = V-1$ is that of the sum of $n-1$ iid uniform$(0,1)$ variables.  That distribution is described at elsewhere on our site at https://stats.stackexchange.com/a/43075, which gives four ways to derive its PDF.

An R simulation bears out this result.  The output plots compare histograms of $V$ to its PDF (overdrawn in red); the match is excellent:

#
# Compute the PDF of a sum of `n` iid uniform(0,1) variables.
#
unif.sum <- function(x, n) {
  theta <- function(y) ifelse(y >= 0, y^(n-1), 0)
  s <- outer(0:n, x, function(i, y) choose(n, i)*theta(y-i)*(-1)^i)
  apply(s, 2, sum) / factorial(n-1)
}
#
# Simulate V for various values of `n` and visually compare to the 
# theoretically derived PDF.
#
n.iter <- 10^5             # Number of samples per simulation
ns <- c(2, 3, 5, 12)       # Sample sizes to investigate
par(mfrow=c(1,length(ns))) # Display all plots in a row
for(n in ns) {
    V <- t(apply(matrix(runif(n*n.iter), ncol=n), 1, function(y) sum(y)/max(y)))
    hist(V, main=paste("n =", n), freq=FALSE)
    curve(unif.sum(x-1, n-1), col="Red", lwd=2, add=TRUE)
}

