The full academy launches January 2027. Join the waitlist for the $179 founding price.
Waldbauer Academy of Economics

Courses › Statistics and Econometrics

Second and third year · Module 2 of 15

Probability and random variables

Probability rules, discrete and continuous random variables, expected value and variance, joint and conditional distributions, and covariance.

By Maximus S. Waldbauer · About 3 hours, including the problem set and quiz.

Data are noisy. Two surveys of the same city give different average rents; two weeks at the same café give different sales. Probability is the language for that noise. It lets you say how likely an outcome is, what to expect on average, and how much results are likely to bounce around.

This module covers the rules of probability, conditional probability and Bayes’ rule, random variables and their expected values and variances, and the joint behaviour of two random variables: covariance, independence and conditional expectation. Conditional expectation in particular is the idea that regression is built on.

By the end of this module you will be able to

What this module covers

  1. The rules of probability
  2. Bayes’ rule and base rates
  3. Discrete random variables
  4. Continuous random variables
  5. Two random variables: joint distributions and conditional expectation
  6. Problem set with step-by-step solutions
  7. Module quiz

Lesson 2.1 Free lesson

The rules of probability

A random experiment is anything with an uncertain outcome: the next customer’s order, tomorrow’s exchange rate, whether a flight leaves on time. The sample space is the set of all possible outcomes, and an event is any collection of outcomes. A probability P(A) is a number between 0 and 1 that measures how likely event A is; the probabilities of all outcomes add to 1.

Three basic rules

Conditional probability

Conditioning means restricting attention to cases where something is known to be true:

P(B | A) = P(A and B) / P(A)

Events A and B are independent if knowing one tells you nothing about the other: P(B | A) = P(B), or equivalently P(A and B) = P(A) × P(B).

Worked example: Coffee and pastries

At a café, 60% of customers order coffee, 25% order a pastry, and 15% order both.

Probability a customer orders coffee or a pastry: 0.60 + 0.25 − 0.15 = 0.70. So 30% order neither.

Probability of a pastry given coffee: P(pastry | coffee) = 0.15/0.60 = 0.25.

That equals the overall pastry rate of 0.25, so coffee and pastry orders are independent here: knowing someone bought coffee doesn’t change the chance they buy a pastry. Check: 0.60 × 0.25 = 0.15, the probability of both.

Probabilities can be interpreted as long-run frequencies (a fair coin lands heads half the time in many tosses) or as degrees of belief. For this course the frequency view is enough: a probability of 0.3 means that, across many repetitions of the same situation, the event happens about 30% of the time.

Common mistake

Confusing P(A | B) with P(B | A). Most people who buy a sports car are men, but that doesn’t mean most men buy sports cars. The two conditional probabilities can be wildly different, which is the subject of the next lesson.

Key ideas

  • P(not A) = 1 − P(A); P(A or B) = P(A) + P(B) − P(A and B).
  • Conditional probability restricts attention to cases where the condition holds: P(B | A) = P(A and B)/P(A).
  • Independence means P(B | A) = P(B), so joint probabilities multiply.
  • A probability is a long-run frequency across many repetitions.

Practice questions: Probability and random variables

Try these, then open each answer to check your work.

  1. 1.P(A) = 0.5, P(B) = 0.4 and P(A and B) = 0.2. What is P(A or B)?
    1. 0.2
    2. 0.7
    3. 0.9
    4. 1.1
    Show answer

    Answer: B. 0.5 + 0.4 − 0.2 = 0.7.

  2. 2.Using the probabilities in Question 1, are A and B independent?
    1. No, because P(A or B) is less than 1
    2. No, because P(A and B) is not zero
    3. Yes, because 0.5 × 0.4 = 0.2
    4. Yes, because P(A) is larger than P(B)
    Show answer

    Answer: C. Independence requires P(A and B) = P(A)P(B), which holds: 0.5 × 0.4 = 0.2.

  3. 3.A test flags 99% of a rare condition and falsely flags 5% of others. If the condition affects 1% of people, P(condition | flagged) is closest to:
    1. 0.17
    2. 0.50
    3. 0.95
    4. 0.99
    Show answer

    Answer: A. 0.99(0.01)/(0.99(0.01) + 0.05(0.99)) = 0.0099/0.0594 = 0.167. The low base rate makes most flags false.

Problems with step-by-step solutions

  1. 4.40% of a gym’s members take yoga classes, 30% take spin classes, and 10% take both. What is the probability a member takes at least one of the two? Neither?
    Show step-by-step solution
    1. P(yoga or spin) = 0.40 + 0.30 − 0.10 = 0.60.
    2. P(neither) = 1 − 0.60 = 0.40.
  2. 5.In Problem 1, what is the probability a yoga member also takes spin? Are the two independent?
    Show step-by-step solution
    1. P(spin | yoga) = 0.10/0.40 = 0.25.
    2. The overall spin rate is 0.30. Since 0.25 ≠ 0.30, they are not independent: yoga members are slightly less likely to take spin. Check: 0.40 × 0.30 = 0.12 ≠ 0.10.

Get the full module

The complete module adds every lesson, interactive graphs, a full problem set with step-by-step solutions, and a quiz. The academy opens in January 2027: join the waitlist for the founding price (lifetime access for $179).

Join the waitlist Try a full module free

More practice: free practice questions for this course.