Random Variables
Random Variables Study Guide
1. What is a Random Variable?
A random variable is a variable that takes on different values based on some probability distribution.
The set of all possible values is called the domain of the random variable.
If a random variable takes on a particular value, that event has an associated probability.
The distribution of a random variable is the collection of probabilities over all possible values.
Example: Rolling a Fair Die
Let D be a random variable representing the outcome of rolling a fair six-sided die.
The domain is {1,2,3,4,5,6}.
Each outcome has a probability of 1/6.
2. Functions of Random Variables
If we define a function f(V) over a random variable V, then f(V) itself is a random variable.
Example: If V is the outcome of a die roll and we define f(V) = 2V, then f(V) has the domain {2,4,6,8,10,12} with probabilities inherited from V.
3. Independent and Conditionally Independent Random Variables
Independence
Two random variables U and V are independent if:
P(U = x, V = y) = P(U = x) * P(V = y) for all x, y
Example: Rolling two dice where D1 and D2 are the outcomes of the first and second roll, respectively.
Conditional Independence
Two random variables U and V are conditionally independent given Z if:
P(U = x | Z = z, V = y) = P(U = x | Z = z) for all x, y, z
Example: Suppose a student's exam performance depends on study time S and sleep T, but given study time, sleep no longer affects the score. Then T and P (performance) are conditionally independent given S.
4. Stochastic Models
A stochastic model represents uncertainty in a system using probability.
Three Steps in Building a Stochastic Model:
Choosing random variables – Identify which factors have randomness.
Specifying independence/conditional independence assumptions – Define how variables interact.
Determining probabilities – Assign values based on:
Empirical data (statistics from experiments)
Domain knowledge (e.g., a fair die has equal probabilities)
Guesstimates (informed assumptions)
Principle of Insufficient Reason (if no info, assume equal probabilities)
5. Joint Distributions
If two random variables U and V are considered together, their probabilities are represented by a joint distribution.
The joint probability distribution assigns probabilities to pairs of outcomes.
P(U = x, V = y)
Example: Rolling a die (D) and flipping a coin (F), the outcomes are:
(1H, 1T, 2H, 2T, ..., 6H, 6T)
6. Marginal Probability
Marginalizing over a random variable means summing over its possible values to get probabilities for another variable.
Formula:
P(U = x) = sum over all y of P(U = x, V = y)
Example: Given a joint probability table for two variables, summing across rows or columns gives the marginal probability of each variable.
7. Expected Value
The expected value E[V] of a random variable V is:
E[V] = sum over all x in domain(V) of x * P(V = x)
Example: Rolling a fair die
E[D] = (1 1/6) + (2 1/6) + ... + (6 * 1/6) = 3.5
8. Expected Value Theorem
For any two random variables U and V:
E[U + V] = E[U] + E[V]
Key property: Holds even if U and V are dependent.
Example: Counting Red Balls in an Urn
An urn has R red balls and B blue balls. We draw K balls at random.
Define N as the number of red balls drawn.
Using the expected value theorem:
E[N] = K * (R / (R + B))
9. Practice Questions
Multiple Choice
What is the expected value of rolling a fair die?
a) 3
b) 3.5
c) 4
d) 2.5
If X and Y are independent, which of the following is true?
a) P(X | Y) = P(X)
b) P(X, Y) = P(X) + P(Y)
c) P(X) = P(Y)
d) P(X, Y) = 1
Short Answer
Define marginal probability and provide an example.
Show how to compute the expected value of rolling a biased die.
Case Study
A factory machine produces parts with a 5% defect rate. If we sample 10 parts, what is the expected number of defective parts?