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} \\ &= \left(\sum_{x}^{} x^{2} p\left(X=x\right)\right) - (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} \\ &= \left(\sum_{x}^{} x^{2} p(X=x)\right) - (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\left(\sum_{j}^{} X_{j}\right) = \sum_{i}^{} \sum_{j}^{} Cov\left(X_{i}, X_{j}\right) \end{equation}