probability density of the maximum of samples from a uniform distribution

Suppose

$$X_1, X_2, \dots, X_n\sim Unif(0, \theta), iid$$

and suppose

$$\hat\theta = \max\{X_1, X_2, \dots, X_n\}$$

How would I find the probability density of $\hat\theta$?

Thank you!


\begin{align} P(Y\leq x) &= P(\max(X_1,X_2 ,\cdots,X_n)\leq x)\\ &= P(X_1\leq x,X_2\leq x,\cdots,X_n\leq x)\\ &\stackrel{ind}{=} \prod_{i=1}^nP(X_i\leq x )\\ &= \prod_{i=1}^n\dfrac{x}{\theta}\\&=\left(\dfrac{x}{\theta}\right)^n \end{align}


Let random variable $W$ denote the maximum of the $X_i$. We will assume that the $X_i$ are independent, else we can say very little about the distribution of $W$.

Note that the maximum of the $X_i$ is $\le w$ if and only if all the $X_i$ are $\le w$. For $w$ in the interval $[0,\theta]$, the probability that $X_i\le w$ is $\frac{w}{\theta}$. It follows by independence that the probability that $W\le w$ is $\left(\frac{w}{\theta}\right)^n$.

Thus, in our interval, the cumulative distribution function $F_W(w)$ of $W$ is given by $$F_W(w)= \left(\frac{w}{\theta}\right)^n.$$ Differentiate to get the density function of $W$.


The general formula for the probability density of the maximum of any $iid$ sample set of the random variable $x$, $M = max\{x_1,x_2,…,x_n\}$ is: $$f_M(M = x) = n * F_x(x)^{n-1} * f_x(x)$$ where $f_x(x)$ is the probability density of $x$, and $F_x(x)$ is the cumulative distribution function of same.

In this case we have: $f_x(x) = \frac{1}{\theta}$ , $F_x(x) = \frac{x}{\theta}$, so we get: $$f_M(M = x) = n * (\frac{x}{\theta})^{n-1} * \frac{1}{\theta}$$ $$= \frac{n * x^{n-1}}{\theta^n}$$