Expectation and Variance

Discrete Case ($X$ with PMF $P(X=x)$)

Quantity Formula
Mean / Expected Value $\mu = E(X) = \sum x , P(X = x)$
Expectation of $g(X)$ $E[g(X)] = \sum g(x) , P(X = x)$
$E(X^2)$ $E(X^2) = \sum x^2 , P(X = x)$
Variance $\text{Var}(X) = \sigma^2 = \sum (x - \mu)^2 , P(X = x)$
Computational variance $\text{Var}(X) = E(X^2) - [E(X)]^2$
Standard deviation $\sigma = \sqrt{\text{Var}(X)}$

Continuous Case ($X$ with PDF $f(x)$)

Quantity Formula
Mean / Expected Value $\mu = E(X) = \int_{-\infty}^{\infty} x,f(x),dx$
Expectation of $g(X)$ $E[g(X)] = \int_{-\infty}^{\infty} g(x),f(x),dx$
$E(X^2)$ $E(X^2) = \int_{-\infty}^{\infty} x^2,f(x),dx$
Variance $\text{Var}(X) = \sigma^2 = \int_{-\infty}^{\infty} (x - \mu)^2,f(x),dx$
Computational variance $\text{Var}(X) = \int_{-\infty}^{\infty} x^2,f(x),dx - \mu^2 = E(X^2) - [E(X)]^2$
Standard deviation $\sigma = \sqrt{\text{Var}(X)}$

Linear Transformation Rules ($a$, $b$ constants)

Rule Expectation Variance
Constant $E(a) = a$ $\text{Var}(a) = 0$
Scaling $E(aX) = a,E(X)$ $\text{Var}(aX) = a^2,\text{Var}(X)$
Shift + scale $E(aX + b) = a,E(X) + b$ $\text{Var}(aX + b) = a^2,\text{Var}(X)$

Adding $b$ shifts the mean but does not affect variance/spread.

Procedure

  1. Find $E(X)$: Multiply each $x$ by its probability (or $x f(x)$) and sum/integrate.
  2. Find $E(X^2)$: Multiply each $x^2$ by its probability (or $x^2 f(x)$) and sum/integrate.
  3. Compute variance: $\text{Var}(X) = E(X^2) - [E(X)]^2$.
  4. For $Y = aX + b$: Apply linear transformation rules above.

Related