# Discrete vs Continuous vs Random Variables

Can someone provide me a clear explanation (Perhaps with examples) about the difference between the following mathematical three concepts in probability:

1. Discrete Variable.
2. Continuous Variable.
3. Random Variable.

Thank you in advance.

A random variable, formally, is a function $X: \Omega \to \mathbb{R}$ for some set $\Omega$. You can think of the set $\Omega$ as consisting of possible outcomes of a random experiment, and for any given input, $X$ tells you some measurement about the outcome. For example, if our random experiment is flipping a coin six times, $\Omega$ is the set $$\{(H,H,H,H,H,H), (H,H,H,H,H,T), (H,H,H,H,T,H), \dots, (T,T,T,T,T,T)\}.$$ A random variable $X$ might tell us the number of heads in the six coin flips, or it might tell us the number of runs of tails in the six coin clips. (If you want to be very precise, a random variable is a measurable function from measure space $(\Omega, \mathcal{F}, P)$ to some other set, but typically the range is $\mathbb{R}$, or perhaps $\mathbb{R}^n$ for a random vector.)

If $X$ is a random variable, its cumulative distribution function $F$ is \begin{align*} F: \mathbb{R} &\to [0,1]\\ F(x)&=P(X \leq x). \end{align*}

A discrete random variable is a random variable which takes on at most countably many values. In particular, any random variable that takes on finitely many values is discrete. An example is the sum of two die rolls. If $X$ denotes the sum of two die rolls, then $X$ is a function \begin{align*} X:\{1,\dots,6\} \times \{1,\dots,6\} &\to \{2,\dots, 12\}\\ (1,1) &\mapsto 2\\ (1,2) &\mapsto 3 \\ \vdots\\ (6,6) &\mapsto 12. \end{align*} $X$ takes on only finitely many values ($2,\dots,12$), so $X$ is discrete. Another example is the number of coin flips it takes to get the outcome heads. If this random variable is denoted $Y$, then $Y$ is a function from the set of all infinite sequences of heads and tails to the natural numbers. Since the natural numbers are countable, $Y$ takes on only countably many values ($1,2,3,\dots$), so $Y$ is discrete. $Y$ is an example of a geometric random variable. Other common discrete distributions include the Bernoulli distribution, binomial distribution, Poisson distribution, and discrete uniform distribution. For a discrete random variable, the cumulative distribution function $F$ will be discontinuous. For example, in the dice rolling example, $P(X \leq 2-\epsilon)=2$ for all $\epsilon>0$ yet $P(X \leq 2) = \frac{1}{36}$, so $F$ is not continuous.

A continuous random variable is a random variable with a continuous cumulative distribution function $F$. Typically the range of a continuous random variable is $\mathbb{R}$, $[0,\infty)$, or some interval $[a,b]$. Examples of continuous random distributions are the normal distribution, chi-squared distribution, exponential distribution, gamma distribution, and continuous uniform distribution. As noted in the other answer, it does not make sense to ask "what is the probability that $X$ equals $a$?" for a continuous random variable $X$, because the answer is always zero.

Note that there are also mixed random variables that are neither continuous nor discrete. That is, they take on uncountably many values, but do not have a continuous cumulative distribution function. These three types of random variables cover all possibilities though. This resource has some information on mixed type random variables if you're interested.

• Well explained. Thank you – Mike Dec 27 '15 at 19:41
• Random variables are such mappings whose preimages are events...right? I kind of take issue with the word 'formally' – BCLC Dec 28 '15 at 3:40
• The phrasing "whose preimages are events" is a little loose. Preimages of what? A random variable is a measurable function, so the preimage of a measurable set is a measurable set, i.e. an element of the sigma algebra $\mathcal{F}$ on the underlying set $\Omega$, i.e. an event. – kccu Dec 28 '15 at 3:43
• I used the word "formally" because random variables are often thought of, informally, as variables whose values are random in some way (see the first sentence of the other answer). Formally they are measurable functions, but it's not always necessary to think of them that way when doing probability. – kccu Dec 28 '15 at 3:48
• I got it. How about 'Part of the formal definition of a random variable is that...' ? – BCLC May 26 '18 at 19:06

According to Wikipedia, a random variable "is a variable whose value is subject to variations due to chance". There are two kinds of random variables: 1. Discrete random variables and 2. Continuous random variable.

1. Discrete random variables are random variables that have integers as possible values. They are described by their probability mass function (pmf). For example if $X$ denotes whether or not a fair coin lands on heads (success = 1) in one flip, or lands tails (fail = 0) then $P(\text{Heads}) = P(X = 1) = \frac{1}{2}$. Similarly, $P(\text{Tails}) = P(X = 0) = \frac{1}{2}.$ Notice that the possible values of $X$ are $0$ or $1$ (integers).

2. Continuous random variables have real numbers as possible values. They are described by their probability density function (pdf). For example, suppose the lifetime $X$ of a light bulb can be modeled by the exponential distrubtion with mean life time of 100 hours. Then you could ask what is the probability that it lasts at least 150 hours. Then $$P(X>150) = e^{-\frac{1}{100}\cdot 150} = e^{-1.5}.$$
You could not ask for $P(X = 150)$ since $P(X = a) = 0$ for all constants $a$.

• Thank you for your explanation. – Mike Dec 27 '15 at 19:41