Definition
A discrete random variable is a function that gives a numerical value for each outcome in a sample space and whose possible values are either finite or countably infinite.
In many applications, it is possible to use a simpler definition that retains the essential features of discrete random variables.
Simpler (but less general) description
An experiment whose outcomes are numerical and whose sample space is either finite or countably infinite can be treated as a discrete random variable.
For most discrete random variables, the outcomes are whole numbers — counts of something, but the definition also includes situations where the values are not integers. For example, the proportion of successes in 10 repetitions of a simple experiment is also a discrete random variable — its possible values are {0.0, 0.1, 0.2, ..., 0.9, 1.0}.
Probability function
A discrete random variable's distribution is fully described by its probability function,
\[ P(\text{outcome } x) \;\;=\;\; P(X=x) \;\;=\;\; p(x) \]This may be described by a table of probabilities (if there is a finite number of possible outcomes) but is more often described by a mathematical formula.
From the probability function, we can find the probability of any other event relating to the random variable. For any event, \(A\),
\[ P(A) = \sum_{x \in A} p(x) \]Question: Girls in a family
A couple want at least two children and no more than four. However, subject to this constraint on their total number of children, they will stop when they get a boy.
Assuming that there are no multiple births and the probability of any child being male is \(\frac 1 2\), independent of the genders of previous children, what is the probability function for the number of girls in the family?
(Solved in full version)
In order to be a probability function, a function \(p(x)\) must satisfy a few properties:
Properties of probability functions
\[ \begin{align} &p(x) \ge 0 \text{ for all } x\\[0.4em] &\sum_{\text{all } x} p(x) = 1 \end{align} \](Proved in full version)