🎲
fundamentalsbeginner25 min

Expected Value and Variance of Discrete Random Variables: Formulas and Worked Examples

A complete guide to calculating expected value E(X) and variance Var(X) for discrete random variables — covering the formulas, step-by-step worked examples, the shortcut formula for variance, and applications in probability and statistics courses.

What You'll Learn

  • Calculate the expected value E(X) of a discrete random variable using the probability-weighted sum formula
  • Calculate the variance Var(X) using both the definition and the shortcut formula
  • Apply expected value and variance to worked examples from probability courses
  • Understand how expected value and variance are used in more advanced statistics topics

1. The Direct Answer: E(X) = Σ xP(x) and Var(X) = Σ (x - μ)²P(x)

The expected value of a discrete random variable X is the probability-weighted average of all possible outcomes. It represents what you would expect to get on average if you repeated the random experiment many times. The formula: E(X) = Σ x × P(x) Where the sum is taken over all possible values x of the random variable, and P(x) is the probability of each value. The expected value is denoted μ (mu) or E(X) interchangeably. The variance of a discrete random variable X measures how spread out the values are around the expected value. Values clustered tightly around E(X) give small variance; values spread widely give large variance. The formula: Var(X) = E[(X - μ)²] = Σ (x - μ)² × P(x) The variance is the expected value of the squared deviation from the mean. Taking the square root of the variance gives the standard deviation, denoted σ (sigma). There is also a SHORTCUT formula for variance that is often easier to compute: Var(X) = E(X²) - [E(X)]² Which says: variance equals the expected value of X squared, minus the square of the expected value. You compute E(X²) by applying E(X) to the values x², rather than x — so E(X²) = Σ x² × P(x). **Worked example**: a fair six-sided die is rolled. Let X be the outcome (1, 2, 3, 4, 5, or 6). Calculate E(X) and Var(X). Each outcome has probability 1/6. E(X) = 1(1/6) + 2(1/6) + 3(1/6) + 4(1/6) + 5(1/6) + 6(1/6) = 21/6 = 3.5 The expected value is 3.5. Note that 3.5 is not actually achievable — you cannot roll a 3.5 — but this is the probability-weighted average of all possible outcomes. It represents the long-run average if you rolled the die many times. For variance using the definition: Var(X) = Σ (x - 3.5)² × (1/6) = (1/6)[(1-3.5)² + (2-3.5)² + (3-3.5)² + (4-3.5)² + (5-3.5)² + (6-3.5)²] = (1/6)[6.25 + 2.25 + 0.25 + 0.25 + 2.25 + 6.25] = (1/6)(17.5) = 2.917 For variance using the shortcut: E(X²) = 1²(1/6) + 2²(1/6) + 3²(1/6) + 4²(1/6) + 5²(1/6) + 6²(1/6) = (1/6)(1 + 4 + 9 + 16 + 25 + 36) = 91/6 = 15.167 Var(X) = E(X²) - [E(X)]² = 15.167 - 3.5² = 15.167 - 12.25 = 2.917 Both methods give Var(X) = 2.917. The standard deviation is σ = √2.917 ≈ 1.708. Snap a photo of any expected value or variance problem and StatsIQ calculates both using the direct and shortcut methods, showing every step.

Key Points

  • Expected value: E(X) = Σ x × P(x). The probability-weighted sum of all possible values.
  • Variance definition: Var(X) = Σ (x - μ)² × P(x). The expected squared deviation from the mean.
  • Shortcut formula: Var(X) = E(X²) - [E(X)]². Often easier to compute.
  • Standard deviation σ = √Var(X). Has the same units as X, unlike variance (which has units squared).

2. Worked Example: Expected Winnings From a Lottery

Expected value problems often involve decisions about whether a gamble or investment is worth taking. Here is a classic example. **Problem**: a lottery ticket costs $2. The prize structure is: - 1 in 10,000,000 chance of winning $10,000,000 - 1 in 100,000 chance of winning $10,000 - 1 in 1,000 chance of winning $100 - 1 in 10 chance of winning $2 (break even) - Otherwise, nothing (lose the $2) Is this lottery ticket worth buying from an expected value perspective? **Step 1: Calculate the probabilities of each outcome.** P($10M) = 1/10,000,000 = 0.0000001 P($10K) = 1/100,000 = 0.00001 P($100) = 1/1,000 = 0.001 P($2) = 1/10 = 0.1 P($0) = 1 - 0.0000001 - 0.00001 - 0.001 - 0.1 = 0.898989 (approximately 0.899) Note: the probabilities must sum to 1. Let me verify: 0.0000001 + 0.00001 + 0.001 + 0.1 + 0.898989 = 0.9999991 + 0.0000009 = 1.0. Good (small rounding). **Step 2: Calculate expected winnings** (not yet subtracting the cost of the ticket). Let W = winnings. E(W) = 10,000,000(0.0000001) + 10,000(0.00001) + 100(0.001) + 2(0.1) + 0(0.899) = 1.00 + 0.10 + 0.10 + 0.20 + 0 = $1.40 The expected winnings (before subtracting the ticket cost) are $1.40. **Step 3: Calculate expected profit.** Expected profit = E(W) - cost = $1.40 - $2.00 = -$0.60 The expected profit is NEGATIVE $0.60 per ticket. On average, you lose 60 cents for every $2 ticket you buy. This lottery has a negative expected value from the buyer's perspective — you can expect to lose money in the long run. **Interpretation**: if you bought 1,000 of these tickets, you would expect to lose about $600 overall. Some tickets would win small prizes, extremely rarely one would win a big prize, but in aggregate, you lose. This is the nature of lotteries — they are designed with negative expected value for buyers because the difference is how the lottery company profits. **The gambler's trap**: people often think 'but what if I win the big prize?' The expected value calculation accounts for this possibility — the 1/10M chance of $10M contributes $1.00 to the expected winnings. The low probability of a huge outcome is equivalent to a small guaranteed amount in expected value terms. People dramatically overweight the huge unlikely outcome psychologically, which is why lotteries remain profitable — individuals focus on the dream rather than the math. **When expected value is positive**: positive expected value investments (like index funds with expected returns above the risk-free rate) are rational to participate in for people who can handle the variance. Negative expected value activities (lotteries, casino games, most sports betting) are rational to AVOID unless the entertainment value justifies the expected loss. StatsIQ handles expected value problems with any probability distribution and highlights whether the expected value is positive, negative, or zero for decision-making context.

Key Points

  • Expected value = Σ (outcome) × (probability of outcome). Calculate for each possible outcome and sum.
  • Probabilities must sum to exactly 1 (or 100%). Verify this as a sanity check.
  • Expected profit = expected winnings - cost. Negative expected value means you lose money on average.
  • Lotteries and casino games are designed with negative expected value for participants. This is the house edge.

3. Properties of Expected Value and Variance

Expected value and variance have useful properties that simplify calculations in more complex problems. These properties are essential for understanding more advanced statistical topics like the central limit theorem and linear regression. **Properties of Expected Value**: 1. **Linearity**: E(aX + b) = aE(X) + b, where a and b are constants. This means: - E(2X + 5) = 2E(X) + 5 - E(X - 3) = E(X) - 3 - E(100X) = 100E(X) Linearity is one of the most useful properties in statistics. It lets you break complex expectations into simple parts. 2. **Sum of random variables**: E(X + Y) = E(X) + E(Y), even if X and Y are dependent. This is always true regardless of whether the variables are independent. 3. **Constant**: E(c) = c, where c is a constant. The expected value of a constant is just the constant. 4. **Product** (only for INDEPENDENT variables): E(XY) = E(X) × E(Y) when X and Y are independent. This is NOT true for dependent variables. **Properties of Variance**: 1. **Constant shift** does NOT affect variance: Var(X + b) = Var(X), where b is a constant. Adding a constant shifts the distribution but does not change its spread. 2. **Scalar multiplication**: Var(aX) = a² × Var(X). Multiplying the random variable by a constant multiplies the variance by the SQUARE of that constant. This is because variance has squared units. Combining these: Var(aX + b) = a² × Var(X). The constant b disappears, and the constant a gets squared. 3. **Sum of independent variables**: Var(X + Y) = Var(X) + Var(Y), but ONLY if X and Y are independent. If X and Y are dependent, there is an additional covariance term. 4. **Sum of dependent variables**: Var(X + Y) = Var(X) + Var(Y) + 2Cov(X, Y), where Cov(X, Y) is the covariance. The covariance can be positive (increasing X correlates with increasing Y) or negative (increasing X correlates with decreasing Y). **Why these properties matter**: - **Portfolio variance in finance**: the variance of a portfolio of two stocks is Var(aX + bY) = a²Var(X) + b²Var(Y) + 2ab×Cov(X,Y). The covariance term is what makes diversification work — stocks that are negatively correlated reduce portfolio variance below what individual stock variances would suggest. - **Sample mean variance**: for independent samples of size n, Var(X̄) = Var(X)/n. This is why larger samples give more precise estimates — the variance of the sample mean shrinks with n. - **Linear regression**: the expected value and variance of the slope estimator in simple linear regression depend on these properties. **Worked example**: X is the score on a math test with E(X) = 75 and Var(X) = 100 (so σ = 10). Y is the score on an English test (independent of X) with E(Y) = 80 and Var(Y) = 64 (so σ = 8). What is the expected value and variance of the total score T = X + Y? E(T) = E(X) + E(Y) = 75 + 80 = 155 Var(T) = Var(X) + Var(Y) = 100 + 64 = 164 (independent variables) σ(T) = √164 ≈ 12.8 What is the expected value and variance of 2X + 5? E(2X + 5) = 2E(X) + 5 = 2(75) + 5 = 155 Var(2X + 5) = 2² × Var(X) = 4 × 100 = 400 σ(2X + 5) = √400 = 20 Note that doubling the random variable doubled the standard deviation (from 10 to 20) but quadrupled the variance (from 100 to 400). This is consistent with the rule Var(aX) = a²Var(X). StatsIQ applies these properties automatically in problems that involve linear combinations of random variables and identifies when the independence assumption is required.

Key Points

  • Linearity: E(aX + b) = aE(X) + b. Variance: Var(aX + b) = a² × Var(X). Constant b disappears in variance.
  • Sum: E(X + Y) = E(X) + E(Y) always. Var(X + Y) = Var(X) + Var(Y) ONLY if independent.
  • Dependent: Var(X + Y) = Var(X) + Var(Y) + 2Cov(X, Y). The covariance term matters in finance (diversification).
  • Multiplying random variable by constant a: variance is multiplied by a² (not just a). Standard deviation by |a|.

4. Where Expected Value and Variance Appear in Other Topics

Expected value and variance are not isolated calculations — they are foundational concepts that appear throughout statistics and probability courses. Understanding where and how they are used helps you see why learning them matters. **Probability distributions**: every probability distribution has an expected value and variance that summarize its central tendency and spread. The formulas for E(X) and Var(X) for common distributions are memorized as part of introductory statistics: - **Binomial distribution** (n trials, probability p): E(X) = np, Var(X) = np(1-p). - **Geometric distribution** (probability p): E(X) = 1/p, Var(X) = (1-p)/p². - **Poisson distribution** (rate λ): E(X) = λ, Var(X) = λ. (A unique property: mean equals variance.) - **Hypergeometric distribution**: has specific formulas based on population size and sample size. - **Negative binomial distribution**: generalizes the geometric distribution to 'number of trials until r successes.' For each of these, the expected value and variance formulas are derived using the same principles we used for the dice example but with more complex sums. In introductory courses, you typically memorize the formulas rather than rederive them each time. **Central Limit Theorem (CLT)**: states that the sampling distribution of the sample mean approaches normality as sample size increases, regardless of the shape of the original population distribution. The CLT tells us: - The expected value of the sample mean equals the population mean: E(X̄) = μ - The variance of the sample mean equals the population variance divided by n: Var(X̄) = σ²/n - The standard error of the sample mean is σ/√n. These properties come directly from the expected value and variance rules for sums of independent random variables. If X̄ = (1/n)Σ Xi where each Xi is an independent observation, then E(X̄) = (1/n)Σ E(Xi) = (1/n)(nμ) = μ, and similarly for variance. **Hypothesis testing**: the test statistics used in hypothesis tests (z-tests, t-tests) are calculated using the expected value and variance under the null hypothesis. For example, the z-statistic: z = (X̄ - μ₀) / (σ/√n), where μ₀ is the expected value under the null and σ/√n is the standard error (standard deviation of the sample mean). **Regression analysis**: the expected value of the dependent variable conditional on the predictor — E(Y|X) — is the heart of regression. Linear regression models E(Y|X) as β₀ + β₁X. The variance of the residuals σ² captures unexplained variability. The expected values and variances of the coefficient estimators β̂₀ and β̂₁ are used for hypothesis testing and confidence intervals. **Bayesian statistics**: posterior distributions are characterized by their expected value (posterior mean) and variance (posterior variance). Bayes' theorem operates on full distributions, but the summary statistics are expected value and variance. **Decision theory**: rational decision-making under uncertainty is often based on maximizing expected value (or expected utility, which is expected value of a utility function rather than raw monetary value). Investment decisions, insurance pricing, and policy analysis all use expected value as a core concept. **Quality control**: manufacturing processes are monitored using expected values (target dimensions) and variances (process variability). Six Sigma quality programs explicitly target reducing variance to improve quality. **Key insight**: expected value and variance are not just academic — they are the foundation of probability-based reasoning in almost every applied field. Mastering them in an introductory statistics course pays off in every subsequent course and application. StatsIQ connects expected value and variance problems to their applications in more advanced topics, helping students see why these foundational concepts matter for their overall statistical understanding.

Key Points

  • Every probability distribution has known formulas for E(X) and Var(X). Memorize the common ones.
  • Central Limit Theorem: E(X̄) = μ, Var(X̄) = σ²/n. Larger n = smaller variance of sample mean.
  • Hypothesis tests use expected value and variance under the null to calculate test statistics.
  • Regression models E(Y|X). Residual variance σ² captures unexplained variability.

Key Takeaways

  • E(X) = Σ x × P(x). The probability-weighted sum of all possible values of X.
  • Var(X) = Σ (x - μ)² × P(x) = E(X²) - [E(X)]². The shortcut formula is often easier.
  • Standard deviation σ = √Var(X). Same units as X. Variance is in squared units.
  • Linearity: E(aX + b) = aE(X) + b. Variance: Var(aX + b) = a²Var(X). The b disappears.
  • Sum of independent variables: Var(X + Y) = Var(X) + Var(Y). For dependent: add 2Cov(X, Y).

Practice Questions

1. A random variable X has the following distribution: P(X=1) = 0.2, P(X=2) = 0.3, P(X=5) = 0.5. Calculate E(X), E(X²), and Var(X).
E(X) = 1(0.2) + 2(0.3) + 5(0.5) = 0.2 + 0.6 + 2.5 = 3.3. E(X²) = 1²(0.2) + 2²(0.3) + 5²(0.5) = 0.2 + 1.2 + 12.5 = 13.9. Var(X) = E(X²) - [E(X)]² = 13.9 - 3.3² = 13.9 - 10.89 = 3.01. Standard deviation σ = √3.01 ≈ 1.735.
2. If E(X) = 50, Var(X) = 25, and Y = 3X - 10, what is E(Y) and Var(Y)?
E(Y) = E(3X - 10) = 3E(X) - 10 = 3(50) - 10 = 150 - 10 = 140. Var(Y) = Var(3X - 10) = 3² × Var(X) = 9 × 25 = 225. Note that the constant -10 shifts the expected value but does not affect the variance. The multiplier 3 triples the expected value but multiplies the variance by 3² = 9. Standard deviation of Y: σ(Y) = √225 = 15, which is 3 times the original standard deviation (5), consistent with |a| = 3.

Study with AI

Get personalized help and instant answers anytime.

Download StatsIQ

FAQs

Common questions about this topic

In everyday language, 'average' usually means the arithmetic mean of a dataset. In probability, 'expected value' means the probability-weighted mean of a random variable. For a sample of observed data, the sample mean is an estimate of the population expected value. If you repeat an experiment many times and compute the sample mean, it converges to the expected value by the law of large numbers. The terms are closely related but not identical: expected value is a property of a probability distribution; average is a summary statistic of actual observations.

Yes. Snap a photo of any problem involving discrete random variables and StatsIQ identifies the probability distribution, calculates E(X) and Var(X) using both the definition and the shortcut formula, applies the properties of expectation and variance for linear combinations, and handles the common exam variations. It also covers the continuous case (where sums become integrals) for more advanced students.

More Study Guides