A function $X:\Omega \rightarrow M$ is called a random variable.
If the codomain $M$ is a finite or countable set, then $X$ is called a discrete random variable.
Probability mass function
Let $\mathbb P$ be a probability defined on the sample space $\Omega$, and $X:\Omega \rightarrow M$ be a discrete random variable.
The function $f_X:\mathbb R \rightarrow[0,1]$ defined by
$$ f_X(x):= \left\{ \begin{array}{ll} \mathbb P(X=x) &, if\ x \in M, \\ 0 &, if\ x \notin M;\\ \end{array} \right. $$
is called the probability mass function (p.m.f) of the random variable $X$.
Properties of probability mass functions:
Let $X:\Omega \rightarrow M$ be a discrete random variable with p.m.f. $f_X$.
Then the following hold: