Let $X_1,...,X_{25}$ be independent Unif $[0,1]$ random variables. Let $Y$ be the $13$th largest of the $25$ random variables. Find the probability density function of $Y$.
I already know the answer for this one, but the answer that was provided just told me to use a formula to get the answer without much explanation as to why I should use that formula. This was the answer I was given:
Formula: $g(x_\gamma)=\frac{n!}{(\gamma-1)!(n-\gamma)!}[F(x)]^{\gamma-1}\cdot f(x)\cdot[1-F(x)]^{n-\gamma}$
Then since $X_1,X_2,\ldots,X_{25}\sim Unif[0,1]$, we have
$$ f(x)= \begin{cases} 1 & \text{if } 0\leq x\leq 1 \\ 0 & \text{otherwise} \end{cases} $$ and $$ F(x)=\int^x_01~dx= \begin{cases} 0 & \text{if } x<0\\ x & \text{if } 0\leq x\leq 1\\ 1 &\text{if } x>1 \end{cases} $$
Then $Y=X_{(13)}$ so $$f(y)=\frac{25!}{(13-1)!(25-13)!}(x)^{13-1}\cdot1\cdot(1-x)^{25-13}$$ $$={^{25}C_{13}}13(x)^{12}(1-x)^{12}$$
Thus, the p.d.f. is
$$ g(Y)= \begin{cases} {^{25}C_{13}}13(x)^{12}(1-x)^{12} & \text{if } 0\leq x\leq 1\\ 0 & \text{otherwise} \end{cases} $$
Could I get an explanation of why I should use this formula or if there is another way to get the answer that is more clear? Thank you.
$g(x)$, or $g_{\gamma}(x)$, is the probability density of the null event that one among the sample values is exactly $x$, $\gamma-1$ among them are somewhat less than $x$, and $n-\gamma$ are somewhat above $x$. It is the probability density function of the $\gamma$-th order statistic of a collection of $n$ iid samples.
The factor of ${^{n}\mathrm C_{\gamma}}\,\gamma$ counts how many arrangements of the samples may be used to fit this pattern: count ways to choose $\gamma-1$, $1$, and $n-\gamma$ among $n$.$${^{n}\mathrm C_{\gamma}}\,\gamma = \dfrac{n!}{(\gamma-1)!\,1!\,(n-\gamma)!}$$
The factors $f(x)$, $F(x)^{\gamma-1}$ and $(1-F(x))^{n-\gamma}$ respectively account for: the probability density that a particular sample is exactly $x$, the probability that $\gamma-1$ samples are at most $x$, and the probability that $n-\gamma$ samples exceed $x$.
Multiplying these factors will thus give the probability density function we seek:
$$g_{\gamma}(x) = {^{n}\mathrm C_{\gamma}}\,\gamma\, f(x)\, F(x)^{\gamma-1}\,(1-F(x))^{n-\gamma} $$
$$g_{13}(x) = {^{25}\mathrm C_{13}}\,13\, f(x)\, F(x)^{12}\,(1-F(x))^{12} $$
This can also be obtained by taking the derivative of the probability that $\gamma$ among the $n$ samples do not exceed $x$ . (See also Binomial Distribution - which is derived by similar argument as above...so...)
$$g_{\gamma}(x) = \dfrac{\mathrm d ~~}{\mathrm dx} \left({^{n}\mathrm C_{\gamma}} F(x)^{\gamma}(1-F(x))^{n-\gamma}\right)$$
Often we shall use subscripts to indicate which random variable the functions belong to. The usual convention is to use uppercase for random variables and lowercase for the function's arguments, and such. So be aware of case sensitivity.
$$f_Y(x) = {^{25}\mathrm C_{13}}\,13\, f_X(x)\, F_X(x)^{12}\,(1-F_X(x))^{12} $$