Introduction to Random Variables

Random Variable

A random variable is a mapping
X : Ω→R
that assigns a real number X(ω) to each outcome ω

Getting proper intuitions of X is very important to understand probability. Let us try understanding random variables with an example.

Let the experiment be flipping a coin twice and X be the number of heads.
Then P(X=0) = P({TT}) = 1/4, P(X=1) = P({HT, TH}) = 1/2 and P(X=2) = P({HH}) = 1/4.
We summarize the information as follows:

HH1/4 2
xP(X = x)

Note that X denotes random variable and x denotes a possible value of X.

Distribution Function and Probability function

Cumulative Distribution Function

The cumulative distribution function (or distribution function), CDF, is the function
FX : R→[0,1] defined by
FX(x) = P(X ≤ x)

The cumulative distribution function of x is the sum of probabilities of all those values of random variables that are less than or equal to x. Every CDF is non-decreasing and right continuous. If X is discrete and is defined for x1, x2, … then CDF of X will be discontinuous at points x1, x2, …

CDF for the experiment of flipping a coin twice.

cdf graph

Probability Function or Probability Mass Function

X is discrete if it takes countably many values {x1, x2, …}
We define the probability function or probability mass function for X by

fX(x) = P(X = x)

Here, fX(x) ≥ 0 for all x ∈ R and ifX(xi) = 1. The CDF of X is related to fX by

We will use fX and FX simply as f and F. Try writing and plotting probability function for flipping a coin experiment whose CDF is shown in previous section.

Probability density function

A random variable X is continuous if there exists a function fX such that fX(x) ≥ 0 for all x, and for every a ≤ b,


The function fX is called the probability density function (PDF). We have that


and fX(x) = F’X (x) at all points x at which FX is differentiable.

Suppose that X has a PDF
clearly fX(x) ≥ 0 and fX(x)dx = 1. A random variable with this density is said to have Uniform (0,1) distribution. The CDF is given by

cdf uniform
CDF for Uniform (0, 1)

Leave A Comment