Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Expectation and Variance | Section
Exploring Probability Theory

bookExpectation and Variance

Deslize para mostrar o menu

Formulas for Expectation and Variance

The expected value (or expectation) of a discrete random variable $X$ is the long-run average value of repetitions of the experiment it represents. The formula is:

E[X]=ixiP(X=xi)E[X] = \sum_{i} x_i \cdot P(X = x_i)

where xix_i are the possible outcomes, and P(X=xi)P(X = x_i) is the probability of each outcome.

The variance of a random variable XX measures how much the values of XX are spread out around the expected value. The formula is:

Var(X)=E[(XE[X])2]=i(xiE[X])2P(X=xi)\text{Var}(X) = E[(X - E[X])^2] = \sum_{i} (x_i - E[X])^2 \cdot P(X = x_i)

Step-by-Step Calculation Example

Suppose you have a random variable XX representing the outcome of rolling a fair six-sided die, so XX can be 1, 2, 3, 4, 5, or 6, each with probability 1/61/6.

  1. Calculate the expectation:

    E[X]=1×16+2×16+3×16+4×16+5×16+6×16=3.5E[X] = 1 \times \frac{1}{6} + 2 \times \frac{1}{6} + 3 \times \frac{1}{6} + 4 \times \frac{1}{6} + 5 \times \frac{1}{6} + 6 \times \frac{1}{6} = 3.5
  2. Calculate the variance:

    • First, compute (xiE[X])2(x_i - E[X])^2 for each outcome:
      • For x1=1x_1 = 1: (13.5)2=6.25(1 - 3.5)^2 = 6.25;
      • For x2=2x_2 = 2: (23.5)2=2.25(2 - 3.5)^2 = 2.25;
      • For x3=3x_3 = 3: (33.5)2=0.25(3 - 3.5)^2 = 0.25;
      • For x4=4x_4 = 4: (43.5)2=0.25(4 - 3.5)^2 = 0.25;
      • For x5=5x_5 = 5: (53.5)2=2.25(5 - 3.5)^2 = 2.25;
      • For x6=6x_6 = 6: (63.5)2=6.25(6 - 3.5)^2 = 6.25.
    • Multiply each by 16\frac{\raisebox{1pt}{1}}{\raisebox{-1pt}{6}} and sum: Var(X)=16(6.25+2.25+0.25+0.25+2.25+6.25)=17.562.92\text{Var}(X) = \frac{1}{6}(6.25 + 2.25 + 0.25 + 0.25 + 2.25 + 6.25) = \frac{17.5}{6} \approx 2.92
12345678910111213
# Compute expectation and variance for a discrete random variable in Python outcomes = [1, 2, 3, 4, 5, 6] # Possible outcomes of a fair die probabilities = [1/6] * 6 # Each outcome has equal probability # Calculate expectation (mean) expectation = sum(x * p for x, p in zip(outcomes, probabilities)) # Calculate variance variance = sum(((x - expectation) ** 2) * p for x, p in zip(outcomes, probabilities)) print("Expectation (mean):", expectation) print("Variance:", variance)
copy
question mark

What is the expected value of the random variable YY with outcomes 2, 5, and 10, having probabilities 0.2, 0.5, and 0.3, respectively?

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 9

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 1. Capítulo 9
some-alt