ランダム変数$ x $が与えられると、その分散$ \ sigma^2 = e（x^2） -  [e（x）]^2 $、$ e（x）$は$ x $の期待値です。離散ランダム変数$ x $、$ e（x）= \ sum x_ip（x = x_i）$。連続変数の場合、$ e（x）= \ int _ {\ infty}^{+\ infty} xp（x）dx $。
たとえば、$ x $を完全なダイの転がりの結果とします。ここで、xは離散ランダム変数であり、$ p（x = 1）= p（x = 2）= ... = p（x = 6）= ...\ frac {1} {6} $。次に、$ e（x）= 1 \ times \ frac {1} {6} + 2 \ times \ frac {1} {6} + ... + 6 \ times \ frac {1} {6} = 3.5 $。$ e（x^2）= 1^2 \ times \ frac {1} {6} + 2^2 \ times \ frac {1} {6} + ... + 6^2 \ times \ frac {1}{6} = \ frac {91} {6} $。したがって、分散$ \ sigma^2 = e（x^2） -  [e（x）]^2 = \ frac {91} {6}  -  3.5^2 = \ frac {35} {12} $。
Given a random variable $X$, its variance $\sigma ^2 = E(X^2)-[E(X)]^2$, where $E(X)$ is the expected value of $X$. For a discrete random variable $X$, $E(X)=\sum x_iP(X=x_i)$. For a continuous variable, $E(X) = \int_{\infty}^{+\infty} xp(x)dx$.
For example, let $X$ be the outcome of rolling a perfect die, where X is a discrete random variable and $P(X=1) = P(X=2) = ... = P(X=6) = \frac{1}{6}$. Then $E(X) = 1 \times \frac{1}{6} + 2 \times \frac{1}{6} + ... + 6 \times \frac{1}{6} = 3.5$. $E(X^2) = 1^2 \times \frac{1}{6} + 2^2 \times \frac{1}{6} + ... + 6^2 \times \frac{1}{6} = \frac{91}{6}$. Thus the variance $\sigma ^2 = E(X^2)-[E(X)]^2 = \frac{91}{6} - 3.5^2 = \frac{35}{12}$.