A random variable is a real valued function of the elements of sample space S which maps each possible outcome to a real number specified by some rule. Random variables are denoted by capital Alphabet like X.

If the random variable takes on finite or countably an infinite number of values then the random variable is a discrete random variable and if it takes uncountably infinite values then it is a continuous random variable.

As we said earlier that the mapping is done by some rule; Probability mass function \(P_X(x)\) defines that rule.

\(P_X(x)\) of a random variable is a function that assigns the probability to X when it takes a specific value x. i.e. \(P_X(x) = P(X=x)\)

Rules of PMF:

- \(0 \leq P_X(x) \leq 1\)
- \(\sum_{x} P_X(x) = 1\)

**Types of Random Variables:**

**Bernoulli random variable: **This simple random variable can take on only two possible outcomes. As an example of flipping of a coin can be represented by Bernoulli random variable. The experiments are called Bernoulli trials and it is common to associate {0,1} with Bernoulli random variable. PMF of Bernoulli random variable is defined by:

\(P_X(0) = 1-p \; \; , \;\; P_X(1) = p\)

If the experiment is unbiased then \(p\) will be equal to 0.5 . It is most used in representing binary digits from the source in digital communication.

**Binomial Random variable: ** If we repeat Bernoulli trials n times and the outcome of each trial is independent from other trials then lets say we want to find how many times 1 occurred then this can be found by using Binomial Random variable which represent the number of times the outcome 1 has occurred in the sequence of n trials. Bernoulli random variable can take on values from 0 to n and its PMF is given by:

\(P_X(k) = \left( ^n_k \right) p^k(1-p)^{n-k} \;,\;\;\; k=0,1,2,\ldots,n\)

where \(k\) is the number of times 1 has occurred and \(P_X(k)\) represents the probability of the set of all outcomes which have exactly \(k\) \(1’s\) and \(n-k\) \(0’s\)

**Poisson Random Variable: **If in Binomial random variable the number of repeated trials n is very large and the probability of success in each individual trial p is very small then binomial can be approximated by Poisson random variable. PMF of Poisson random variable is given as:

\(P_X(m) = \frac{\alpha ^m}{m!} e^{- \alpha} \;,\;\;\; m=0,1,2,\ldots\)

where \(\alpha = \lim_{n\to \infty} np\)

The three types of random variable explained above are discrete random variables and all of them are classified by their PMF (Probability Mass Function) there are also other types of discrete random variable as well including Geometric Radom variable.

Continuous random variables are described by their CDF (Cumulative Density function) and their PDF (Probability density function) including famous gaussian distribution, exponential distribution, uniform distribution etc.

PDF is for continuous random variable and PMF is for discrete random variables.

Before jumping onto continuous random variables we would like you to solve a couple of problems related to discrete random variable, baye’s rule, independence, joint, conditional probability etc. Please see some practice problems here.