# Variance and Expected Value Algebra

Linearity of Expected Value: Suppose $X$ and $Y$ are random variables and $a$ and $b$ are scalars.  The following relationships hold:

$E[aX+b] = aE[X]+b$

$E[aX+bY] = aE[X] +bE[Y]$

Variance:

$Var(aX+bY) = a^2Var(X)+2abCov(X,Y)+b^2Var(Y)$

Suppose $X_i$ for $i=\left\{1\ldots n\right\}$ are $n$ independent identically distributed (iid) random variables.  Then $Cov(X_i,X_j) = 0$ for $i\ne j$ and

$\displaystyle Var\left({\sum_{i=1}^n X_i}\right) = \sum_{i=1}^n Var(X_i)$

Example:

$X$ is the stock price of AAPL at market close.  $Y$ is the sum of closing AAPL stock prices for 5 days.  Then

$\begin{array}{rl} Var(Y) &= \displaystyle \sum_{i=1}^5 Var(X_i) \\ &= 5Var(X) \end{array}$.

Contrast this with the variance of $Z = 5X$.  In other words, $Z$ is a random variable that takes a value of 5 times the price of AAPL at the close of any given day.  Then

$\begin{array}{rl} Var(Z) &= Var(5X) \\ &=5^2Var(x) \end{array}$

The distinction between $Y$ and $Z$ is subtle but very important.

Variance of a Sample Mean:

In situations where the sample mean $\bar{X}$ is a random variable over $n$ iid observations (i.e. the average price of AAPL over 5 days), the following formula applies:

$\begin{array}{rl} Var(\bar{X}) &= \displaystyle Var\left(\frac{1}{n} \displaystyle \sum_{i=1}^n X_i\right) \\ &= \displaystyle \frac{nVar(X)}{n^2} \\ &= \displaystyle \frac{Var(X)}{n} \end{array}$

Filed under Probability

### 2 responses to “Variance and Expected Value Algebra”

1. I understand that E(XY) = E(X)E(Y) only if X and Y are independent. Suppose you had 3 independant random variables X,Y, and Z and you wanted E[X(Y+Z)]. Does this obey a distributive law, ie does E[X(Y+Z)] = E(X)E(Y)+E(X)E(Z)?
If so, what if it you wanted:
E{(aX+b)[(cY+d)+(mZ+n)]} ,
could you just multiply through like in regular algebra?

• uclatommy

Yes, you can distribute inside the brackets to get E[XY + XZ]. Then by linearity, this is equal to E[XY] + E[XZ]. If X and Y are independent, then E[XY] = E[X]E[Y]. And similarly if X and Z are independent, E[XZ] = E[X]E[Z].