## 2.2 Probability functions for discrete random variables

For discrete random variables, the probability function is called a probability mass function (PMF).

Example 2.4 (Discrete uniform distribution) A rv $$X$$ has the uniform discrete distribution defined from $$a$$ to $$b$$ if the PMF is $f_X(x) = \left\{ \begin{array}{ll} \displaystyle \frac{1}{b-a+1} & \text{if x = a, a+1, \dots, b};\\[6pt] 0 & \text{otherwise}. \end{array} \right.$ This is usually written, for convenience, as $f_X(x) = \displaystyle \frac{1}{b-a+1}\quad \text{for x=a, a+1, \dots, b}.$

A , say $$f(x)$$, has two properties:

1. $$\displaystyle \sum_{-\infty}^{\infty} f_X(x) = 1$$; that is, the total probability is one (in other words, $$x$$ certainly takes some value).
2. $$f_X(x) \ge 0$$ for all $$x$$; that is, probabilities are non-negative.

Probabilities are found by summing over appropriate values.

Example 2.5 (Discrete uniform distribution) A rv $$X$$ has the uniform discrete distribution defined from $$3$$ to $$7$$ inclusive if the PMF is $f_X(x) = \displaystyle \frac{1}{7-3+1} = \frac{1}{5} \quad\text{for x=3, 4, 5, 6, 7}.$ The probability that the rv $$X$$ takes a value between $$5$$ and $$7$$ inclusive is $\Pr(5\le X\le 7) = \sum_{5}^{7} \frac{1}{5} = 0.6.$
Example 2.6 (Discrete PMF) Consider a rv $$Z$$ with PMF $f_Z(z) = \frac{|z - 3|}{4} \quad\text{for z=1, 2, 3, 4}.$ The probability that $$Z>2$$ is $\Pr(Z>2) = \Pr(Z=3) + \Pr(Z=4) = \frac{|3-3|}{4} + \frac{|4-3|}{4} = 0.25;$ see Fig. 2.3.