TITLE: Order statistics finding the expectation and variance of the maximum
QUESTION [7 upvotes]: Let $X_1,X_2,\ldots,X_n$ be a collection of independent uniformly distributed random variables on the interval from $0$ to $\theta$.
The question has three parts. 

Find the CDF of $F_{x_n}$(x) of $X_n = \max{\{X_1,\ldots,X_n}\}$
I know that distribution for the uniform distribution is $\frac{1}{b-a}$.
In this case $b=\theta$ and $a=0$. So the pdf is $\frac{1}{\theta}$.
Then the pdf for $X_n$ should be $\left(\frac 1 \theta \right)^n$.
The PDF is then $n\left(\frac 1 \theta \right)^{n-1}$ .
Part c asks to calculate the mean and variance for $X_n$.
I'm confused on how to do this. Since it is a uniform distribution should I just use the uniform distribution pdf to calculate the expectation and variance?

REPLY [18 votes]: There is some improper notation being used. Presumably something like $X_{(n)}$ is intended for the maximum of the $X_i$. We get rid of the potential confusion, and use the unfairly neglected letter $W$ to denote the maximum of the $X_i$.
Then the maximum of the $X_i$ is $\le W$, that is, $W\le w$ if and only if $X_i\le w$ for all $i$. For $0\lt w \lt \theta$, the probability that  $X_i \le w$  is $\frac{w}{\theta}$. Thus by independence the probability that all the $X_i$ are $\le w$ is $\left(\frac{w}{\theta}\right)^n$. We conclude that 
$$F_W(w)=\Pr(W\le w)=\left(\frac{w}{\theta}\right)^n.$$
Differentiate. We find that the density function $f_W(w)$ is given by 
$$f_W(w)=\frac{1}{\theta^n} nw^{n-1}$$
(for $0\lt w\lt \theta$). 
Now the mean and variance of $w$ can be found. The mean is 
$$\int_0^\theta w\frac{1}{\theta^n} nw^{n-1}\,dw$$
The integration is straightforward. We get $\frac{n}{n+1}\theta$.
For the variance, note that $\text{Var}(W)=E(W^2)-(E(W))^2$. So we need $E(W^2)$. This is 
$$\int_0^\theta w^2\frac{1}{\theta^n} nw^{n-1}\,dw.$$