Lesson 1 of 14 · All lessons in this module
  1. Random variables: PMF, PDF and CDF
  2. Expected value, variance and standard deviationVideo lesson
  3. Variance and covariance shortcuts, and the law of large numbers
  4. Discrete distributions: uniform, binomial and Poisson
  5. Continuous uniform and normal distributions, and simulating random draws
  6. Log-normal and logistic distributions, and the moments of key distributions
  7. Integrated cases: reading probabilities and moments from a return model
  8. Conditional probability and probability trees
  9. Conditional expected values and variancesVideo lesson
  10. Covariance from a joint probability function
  11. Joint, marginal and conditional distributions as information arrives
  12. Bayes' formula: updating a probability with new informationVideo lesson
  13. Bayes in practice: diffuse priors, missing inputs and screening tests
  14. Integrated cases: a tree with model forecasts and a Bayes update

This lesson is part of the 2027 curriculum. You are following the 2026 curriculum, where it is not taught in this form. Switch if you are sitting the exam under the 2027 curriculum.

Free lesson: the first lesson of every module is open to everyone.

Lesson 1 of 14 · 13 min

Random variables: PMF, PDF and CDF

A random variable is fully described by its distribution: a PMF or PDF shows where the probability sits, and the CDF adds it up from the left.

In short

  • A random variable attaches a number to every outcome of an uncertain event; finance also calls it a stochastic variable.
  • Discrete variables have countable outcomes (the number of defaults); continuous ones can take any value in a range (a return).
  • The PMF gives P(X=x)P(X = x) for a discrete variable. The PDF gives the density of a continuous variable, and probability is the area under it.
  • The CDF F(x)=P(X≤x)F(x) = P(X \le x) works for both kinds, never decreases, and runs from 0 on the far left to 1 on the far right.
  • For a continuous variable the PDF is the slope of the CDF, and P(a≤X≤b)=F(b)−F(a)P(a \le X \le b) = F(b) - F(a).

Discrete and continuous random variables

A random variable is a rule that attaches a number to every possible outcome of an uncertain event: the number of bonds in a portfolio that default this year, tomorrow's return on an index, the EPS a company will report. Finance often calls it a stochastic variable, stressing that its value cannot be known in advance.

A discrete random variable has a countable list of distinct outcomes. The number of up days in a four-day trading week can only be 0, 1, 2, 3 or 4, and each value has its own probability. Between those values there is nothing: 2.4 up days cannot happen.

A continuous random variable can take any value within a range, such as any return between −20% and +20%. There are infinitely many possible values, so the chance of hitting one exact value is zero. Only ranges of values have a positive probability.

Daily returns are recorded to a few decimals, but with so many possible values they behave like a continuous variable. Continuous distributions are smooth, mathematically convenient and have well-known properties, which is why finance prefers them for modelling prices and returns.

Discrete variables: the PMF and the CDF

The probability mass function (PMF), P(X=x)P(X = x), gives the probability that a discrete variable equals each specific value. Every PMF value lies between 0 and 1, and the values sum to exactly 1 across all outcomes.

To get the probability of a range, add the PMF values inside it: P(a≤X≤b)=∑x=abP(X=x)P(a \le X \le b) = \sum_{x=a}^{b} P(X = x). If each of four trading days is independently up or down with equal chance, the probability of 2 or 3 up days is 0.375 + 0.25 = 0.625.

The cumulative distribution function (CDF), F(x)=P(X≤x)F(x) = P(X \le x), adds up the PMF from the lowest value to x. For a discrete variable the CDF is a staircase: flat between outcomes and jumping at each outcome by that outcome's probability.

Every CDF has the same three properties. It never decreases, it tends to 0 far to the left and it tends to 1 far to the right. A CDF value is a probability, so it can never exceed 1.

00.250.50.751Probability0.06250.062500.250.312510.3750.687520.250.937530.062514PMF P(X = x)CDF P(X ≤ x)
Number of up days in a four-day week, each day up with probability 0.5. The PMF bars sum to 1; the CDF bar at each value is the running total of the PMF and ends at exactly 1.

Continuous variables: the PDF and the CDF

For a continuous variable, the probability density function (PDF), f(x)f(x), shows how probability is spread across values. Its height is not a probability. Probability is the area under the PDF over a range: P(a≤X≤b)=∫abf(x) dxP(a \le X \le b) = \int_a^b f(x)\,dx.

The total area under any PDF is 1, the continuous version of 'the probabilities sum to 1'. A single point has no width, so P(X=x)=0P(X = x) = 0 for any exact x. That is why P(a≤X≤b)P(a \le X \le b) and P(a<X<b)P(a < X < b) are the same for a continuous variable.

The CDF keeps its definition, F(x)=P(X≤x)F(x) = P(X \le x), and is now a smooth S-shaped curve. The two functions are tied together: the PDF is the slope (derivative) of the CDF, f(x)=dF(x)/dxf(x) = dF(x)/dx, and the CDF is the area accumulated under the PDF. Where the PDF is high, the CDF climbs steeply.

This gives the most useful shortcut of the lesson: the probability of a range is the difference between two CDF values, P(a≤X≤b)=F(b)−F(a)P(a \le X \le b) = F(b) - F(a). A discrete CDF jumps, so it has no slope in the usual sense; that is why discrete variables use a PMF rather than a density.

Three ways to describe a distribution
FunctionUsed forWhat its value means
PMF P(X=x)P(X = x)Discrete variablesThe probability of exactly x
PDF f(x)f(x)Continuous variablesA density: area under it is probability
CDF F(x)F(x)BothThe probability of x or less
00.20.40.60.81-202Standard deviations from the meanDensity / probabilityF(−1) = 0.1587F(1) = 0.8413PDF f(x)CDF F(x)
A bell-shaped return distribution. The CDF is steepest where the PDF peaks. The probability of landing between −1 and +1 is the area under the PDF there, and also F(1)−F(−1)=0.8413−0.1587=0.6827F(1) - F(-1) = 0.8413 - 0.1587 = 0.6827.

Building a distribution from counts

When every elementary outcome is equally likely, a PMF can be built by counting. Divide the number of ways each value can occur by the total number of outcomes, then add the results from the left to get the CDF.

Take two fair four-sided dice, a simple stand-in for two independent sources of risk. There are 4 × 4 = 16 equally likely pairs. A sum of 5 can occur four ways, (1, 4), (2, 3), (3, 2) and (4, 1), so P(X=5)=4/16=0.25P(X = 5) = 4/16 = 0.25. The probabilities add to 1, and the CDF reaches 1 at the largest sum, 8.

For a discrete variable, read range probabilities off the CDF with care: P(4≤X≤6)=F(6)−F(3)P(4 \le X \le 6) = F(6) - F(3), not F(6)−F(4)F(6) - F(4), because subtracting F(4)F(4) would also remove the probability of exactly 4.

Sum of two fair four-sided dice
Sum xWaysPMFCDF
210.06250.0625
320.12500.1875
430.18750.3750
540.25000.6250
630.18750.8125
720.12500.9375
810.06251.0000

Keep this CDF in mind: in the simulation lesson, a random number between 0 and 1 is turned into a draw from a distribution by finding where it falls in the CDF column.

Formulas

Cumulative distribution function
F(x)=P(X≤x)F(x) = P(X \le x)

Works for discrete and continuous variables. Never decreases; runs from 0 to 1.

Range probability, discrete variable
P(a≤X≤b)=∑x=abP(X=x),∑xP(X=x)=1P(a \le X \le b) = \sum_{x=a}^{b} P(X = x), \qquad \sum_{x} P(X = x) = 1

Add the PMF values inside the range. All PMF values together sum to 1.

Range probability, continuous variable
P(a≤X≤b)=∫abf(x) dx=F(b)−F(a),∫−∞∞f(x) dx=1P(a \le X \le b) = \int_a^b f(x)\,dx = F(b) - F(a), \qquad \int_{-\infty}^{\infty} f(x)\,dx = 1

Probability is the area under the PDF. The total area is 1.

PDF as the slope of the CDF
f(x)=dF(x)dxf(x) = \dfrac{dF(x)}{dx}

Holds only where the CDF is differentiable, so for continuous variables.

Worked examples

Example 1 Probabilities from a counted distribution

Using the distribution of the sum of two fair four-sided dice, what are P(X≤5)P(X \le 5), P(4≤X≤6)P(4 \le X \le 6) and P(X>6)P(X > 6)?

Example 2 Range probabilities from a continuous CDF

A model of daily returns on a Swiss equity index gives the CDF values F(−1%)=0.18F(-1\%) = 0.18, F(0%)=0.46F(0\%) = 0.46 and F(1.5%)=0.83F(1.5\%) = 0.83. What are the probabilities that the return lies between −1% and 1.5%, is positive, is above 1.5%, and is exactly 0%?

Example 3 Reading a density value

A risk model reports that the PDF of a daily return equals 2.4 at a return of 0.1%. A colleague says this means a 240% chance of that return. What is wrong, and what does 2.4 tell you?

On the exam

Expect questions on which function describes a continuous variable (PDF, not PMF), what a CDF value means, and range probabilities from a PMF table or CDF values. Distractors often confuse a PMF value with a CDF value.

  • Treating the height of a PDF as a probability; probabilities are areas under it.
  • Using a PMF for a continuous variable or a PDF for a discrete one.
  • For a discrete variable, computing P(a≤X≤b)P(a \le X \le b) as F(b)−F(a)F(b) - F(a), which wrongly drops the probability of exactly a.
  • Forgetting that the probability of one exact value of a continuous variable is zero.

Check yourself

  1. Q1Which of the following is most likely to be modelled as a continuous random variable?

  2. Q2A continuous random variable has CDF values F(2) = 0.35 and F(6) = 0.80. The probability that it lies between 2 and 6 is closest to:

  3. Q3For a continuous random variable, the probability that it takes one exact value is:

  4. Q4Which statement about a cumulative distribution function is least accurate?

  5. Q5A discrete variable takes the values 1, 2, 3 and 4 with probabilities 0.1, 0.3, 0.4 and 0.2. F(3) is:

0/5Check yourself

Answer the 5 questions: +10 XP for each one you get right first time.

Liked this lesson? Get the rest free for 7 days

Create a free account to open the other 13 lessons in this module, with videos, flashcards that come back before you forget them, the question bank and full mocks. No card needed.