variance (also known as second central moment) is a way of measuring spread:
\begin{align} Var(X) &= E[(X-E(X))^{2}] \\ &= E[X^{2}] - (E[X])^{2} \\ &= \qty(\sum_{x}^{} x^{2} p\qty(X=x)) - (E[X])^{2} \end{align}
“on average, how far is the probability of \(X\) from its expectation”
The expression(s) are derived below. Recall that standard deviation is a square root of the variance.
computing variance:
\begin{align} Var(X) &= E[(X - \mu)^{2}] \\ &= \sum_{x}^{} (x-\mu)^{2} p(X) \end{align}
based on the law of the Unconscious statistician. And then, we do algebra:
So, for any random variable \(X\), we say:
\begin{align} Var(X) &= E[X^{2}] - (E[X])^{2} \\ &= \qty(\sum_{x}^{} x^{2} p(X=x)) - (E[X])^{2} \end{align}
based on the law of Unconscious statistician.
Sum of Variance
\begin{equation} Var(X + Y)=Var(X)+Var(Y)+2Cov(X+Y). \end{equation}
\begin{equation} Var\qty(\sum_{j}^{} X_{j}) = \sum_{i}^{} \sum_{j}^{} Cov\qty(X_{i}, X_{j}) \end{equation}