Two Different Formulas for Calculating the Expectation of a Discrete Random Variable and How to Read them

A simple guide for keeping the symbology straight

Tech Notes
2 min readMay 9, 2024

There are two common formulas used to calculate the expectation (or expected value) of a random variable, depending on whether the random variable is discrete or continuous.

Discrete Random Variable

For a discrete random variable 𝑋 with a probability mass function (PMF) 𝑝(𝑥), the expected value 𝐸[𝑋] is given by the sum of the product of each possible value of the random variable and its probability:

where 𝑝(𝑥) represents the probability of X being equal to a specific value 𝑥.

Alternative Formula with Explicit Random Variable Notation

In this formula, 𝑟r represents the possible values of 𝑋. The notation 𝑝(𝑋=𝑟)p(X=r) explicitly states the probability that X equals r. This form is more verbose and emphasizes that the probabilities are associated with the random variable X taking specific values r.

Both of these formulas compute the same quantity — the expected value of the random variable 𝑋 — using the sum of the products of values and their associated probabilities.

So what is the difference between x in the first formula and r in the second formula? They seem…

--

--