Discrete probability distribution (source code)

= Discrete probability distribution
{wiki}

A <discrete probability distribution> is a <probability distribution> concentrated on a finite or <countable set> of possible values $S$: a <random variable> $X$ with this law satisfies $\mathbb P(X\in S)=1$. Its <probability mass function> assigns a <probability> to each value:
$$
p_X(x)=\mathbb P(X=x),\qquad p_X(x)\geq0,\qquad \sum_{x\in S}p_X(x)=1.
$$
Thus the <probability> of an event is obtained by adding masses, rather than integrating a <probability density function>. The possible values need not be equally spaced, or even integers. When the relevant moments are finite, its <expected value> and <variance> are
$$
\mu=\mathbb E X=\sum_{x\in S}xp_X(x),\qquad
\operatorname{Var}(X)=\sum_{x\in S}(x-\mu)^2p_X(x)=\mathbb E[X^2]-\mu^2.
$$

For a constructed example, assign values $0,2,5$ masses $0.5,0.3,0.2$. They sum to one; $\mathbb P(X\geq2)=0.3+0.2=0.5$, $\mathbb E X=0(0.5)+2(0.3)+5(0.2)=1.6$, and $\mathbb E[X^2]=4(0.3)+25(0.2)=6.2$. Hence the <variance> is $6.2-1.6^2=3.64$. A <mean> can lie between possible values: no outcome here equals $1.6$.

The useful organizing question is what an experiment records. One yes/no <indicator random variable> gives a <Bernoulli distribution>; a success count in a fixed number of <independent> attempts gives a <binomial distribution>; the attempt number of the first success gives a <geometric distribution>. A <Poisson distribution> describes an event count under different assumptions. Naming the quantity first helps prevent selecting a familiar formula for the wrong experiment.