Question: how to calculate the variance of random variable?
Answer: For a discrete random variable X, the variance of X is obtained as follows: var(X)=∑(x−μ)2pX(x), where the sum is taken over all values of x for which pX(x)>0. So the variance of X is the weighted average of the squared deviations from the mean μ, where the weights are given by the probability function pX(x) of X.