## Expected value and variance of probability distribution

Let the probability distribution of random variable $X$ be

$x$ | $x_1$ | $x_2$ | $\cdots$ | $x_n$ |
---|---|---|---|---|

$P(X=x)$ | $p_1$ | $p_2$ | $\cdots$ | $p_n$ |

## Formula

The expected value of $X$ is given by

`$E(X) =\mu = \sum_x x*P(X=x)$`

The variance of $X$ is given by

`$V(X) =\sigma^2 = E(X^2) -[E(X)]^2$`

where `$E(X^2) = \sum_x x^2*P(X=x)$`