[Math] Finding a probability mass function of a discrete random variable

probability

Four distinct integers are chosen randomly and without replacement
from the first twelve positive integers. Let X be the random variable
representing the second largest of the four selected integers, and let
p(x) be the probability mass function of X. Determine p(x), for
integer values of x, where p(x) > 0.

Attempt:

Let's try evaluate $P(X=1)$, that is the probability that the second largest of the four selected is $1$. well this is not possible since $1$ must be smallest number of the four selected. By same reason we cant have $2$ or $12$, but $3$ is possible. Thus, $11 \geq X \geq 3$. Now, I am stuck in trying to find the mass function. This is my thought process but I still unable to undersand how to compute the mass function. I see that the sample space looks like

$$ S = \{ (i_1,i_2,i_3,i_4) : i_k \in \{1,2,…,12\}, i_k \neq i_j \} $$

if we want $P(X=x)$, then $x$ can any of the $i's$, so we multiply by $4$ the result. Suppose $x=i_1$, then we are trying to count the the strings $(i_1,i_2,i_3,i_4)$ such that $i_1 < i_2$ or $i_1 < i_3$ or $i_1 < i_4$. But now here we have 3 subcases and it keeps getting more complicated. What is the way to think about this problems?

Best Answer

There are $\binom{12}4$ sets of four integers that you could choose. How many have a given $a$ as second largest? Such a set is $\{x_1,x_2,a,x_4\}$ where $\{x_1,x_2\}$ is a $2$-element subset of $\{1,\ldots,a-1\}$ (how many of them are there?) and $x_4\in\{a+1,\ldots,12\}$. If there are $N_1$ possible $\{x_1,x_2\}$ and $N_2$ possible $x_4$ then $P(X=a)=N_1N_2\binom{12}4^{-1}$.

Related Question