CS109 Course Feedback Process
- 22Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is a random variable and how is it different from a regular variable?
22 questions
- 1
What is a random variable and how is it different from a regular variable?
Model answer
A random variable is a numerical outcome of a random process; it takes on different values with certain probabilities, unlike a deterministic variable.
Explanation
Random variables are functions from sample space to real numbers, and their behavior is described by a probability distribution.
- 2
What is a probability mass function (PMF)?
Model answer
A PMF assigns to each possible value of a discrete random variable the probability that the variable equals that value.
Explanation
The PMF is a complete description of a discrete random variable; it can be given as an equation, graph, or table.
- 3
How do you compute the probability of an event like X≤3 from the PMF?
Model answer
Sum the PMF values for all x≤3: P(X≤3)=∑x≤3P(X=x).
Explanation
Since events like {X=x} are mutually exclusive, the probability of a union is the sum of individual probabilities.
- 4
What is the definition of expectation of a discrete random variable?
Model answer
The expectation is E[X]=∑xx⋅P(X=x), the weighted average of possible values.
Explanation
It represents the long-run average value of the random variable over many repetitions.
- 5
How can you estimate the expectation from a dataset of observed values?
Model answer
Take the arithmetic mean of the data: n1∑i=1nxi.
Explanation
This works because the empirical distribution assigns probability 1/n to each observation, matching the definition of expectation.
- 6
State the linearity of expectation property.
Model answer
For any random variables X and Y, E[X+Y]=E[X]+E[Y], regardless of dependence.
Explanation
Linearity holds for any finite sum and even for constants: E[aX+b]=aE[X]+b.
- 7
What is the binomial random variable and what story does it model?
Model answer
The binomial random variable X∼Bin(n,p) counts the number of successes in n independent trials, each with success probability p.
Explanation
Common examples include number of heads in coin flips, number of ad clicks, or number of crashes in independent runs.
- 8
Write the probability mass function of a binomial random variable.
Model answer
P(X=k)=(kn)pk(1−p)n−k for k=0,1,…,n.
Explanation
The binomial coefficient (kn) counts the number of ways to choose k successes, and pk(1−p)n−k is the probability of any specific sequence with k successes.
- 9
How do you compute probabilities for a binomial distribution using Python?
Model answer
Use
scipy.stats.binom.pmf(k, n, p)for exact probabilities, orbinom.cdffor cumulative probabilities.Explanation
For example,
stats.binom.pmf(5, 1000, 0.01)gives P(X=5) for 1000 ads with click probability 0.01. - 10
What is the expectation of a binomial random variable?
Model answer
E[X]=np.
Explanation
This can be derived by writing X as a sum of n i.i.d. Bernoulli(p) variables and using linearity of expectation.
- 11
Why can you add binomial probabilities for different k values (e.g., P(X=4 or X=5))?
Model answer
Because events {X=k} are mutually exclusive (a random variable cannot equal two different numbers simultaneously), so P(X=4∪X=5)=P(X=4)+P(X=5).
Explanation
Mutual exclusivity holds for all distinct values of a discrete random variable.
- 12
In a best-of-seven basketball series, why can we treat it as n=7 binomial trials even if the series stops early?
Model answer
The probability of winning the series is the same whether we imagine playing all 7 games or stopping at 4 wins, because the imaginary extra games do not change the event of winning at least 4 of the first 7.
Explanation
By considering all 7 games as independent Bernoulli trials, we correctly compute the probability of winning 4 or more; the early stop does not affect the probability distribution of the number of wins in the first 7 games.
- 13
What is a Bernoulli random variable?
Model answer
A Bernoulli random variable Y∼Ber(p) takes value 1 with probability p and 0 with probability 1−p; it models a single trial.
Explanation
It is a special case of the binomial with n=1.
- 14
What is the expectation of a Bernoulli random variable?
Model answer
E[Y]=p.
Explanation
From the definition: E[Y]=1⋅p+0⋅(1−p)=p.
- 15
How can a binomial random variable be expressed in terms of Bernoulli random variables?
Model answer
If X∼Bin(n,p), then X=∑i=1nYi where each Yi∼Ber(p) independently.
Explanation
This representation is useful for deriving properties like expectation and variance.
- 16
What is variance and what does it measure?
Model answer
Variance measures the spread of a random variable around its mean; it is the average squared distance from the mean: Var(X)=E[(X−μ)2] where μ=E[X].
Explanation
A larger variance indicates more dispersion.
- 17
What is the relationship between variance and standard deviation?
Model answer
Standard deviation is the square root of variance: SD(X)=Var(X).
Explanation
Standard deviation has the same units as X, making it more interpretable.
- 18
State the computational formula for variance.
Model answer
Var(X)=E[X2]−(E[X])2.
Explanation
This formula follows from expanding E[(X−μ)2]=E[X2]−2μE[X]+μ2=E[X2]−μ2.
- 19
What is the Law of the Unconscious Statistician (LOTUS)?
Model answer
For any function g, E[g(X)]=∑xg(x)P(X=x).
Explanation
LOTUS allows us to compute expectations of functions without finding the distribution of g(X) directly.
- 20
How can you compute E[X2] using LOTUS?
Model answer
Square each possible value and weight by its probability: E[X2]=∑xx2P(X=x).
Explanation
This is a direct application of LOTUS with g(x)=x2.
- 21
In the peer grading example, why is variance important?
Model answer
Two graders can have the same expected grade but different spread; variance quantifies how much the grades deviate from the true grade, helping choose a more consistent grader.
Explanation
A smaller variance implies more consistent grading, even if the expectation matches the true grade.
- 22
What are moments of a distribution?
Model answer
Moments are summary statistics; the first moment is expectation, the second central moment is variance. Higher moments (skewness, kurtosis) describe shape.
Explanation
Variance is the second central moment, measuring spread around the mean.

Ask anything
We've read this whole study set, so questions about it get the best answers.