# 變異量數

## 定義

$\operatorname{Var}(X) = \operatorname{E}\left[(X - \mu)^2 \right]$

$\operatorname{Var}(X) = \operatorname{Cov}(X, X)$

$\operatorname{Var}(X)= \operatorname{E}\left[X^2 - 2X\operatorname{E}[X] + (\operatorname{E}[X])^2\right] = \operatorname{E}\left[X^2\right] - 2\operatorname{E}[X]\operatorname{E}[X] + (\operatorname{E}[X])^2 = \operatorname{E}\left[X^2 \right] - (\operatorname{E}[X])^2$

### 連續隨機變數

$\operatorname{Var}(X) =\sigma^2 =\int (x-\mu)^2 \, f(x) \, dx\, =\int x^2 \, f(x) \, dx\, - \mu^2$

$\mu = \int x \, f(x) \, dx\,$

### 離散隨機變數

$\operatorname{Var}(X) = \sum_{i=1}^n p_i\cdot(x_i - \mu)^2 = \sum_{i=1}^n (p_i\cdot x_i^2) - \mu^2$

$\mu = \sum_{i=1}^n p_i\cdot x_i$ .

X為有N個相等機率值的平均分布：

$\operatorname{Var}(X) = \sigma^{2} =\frac{1}{N} \sum_{i=1}^N (x_i - \mu)^2 = \frac{1}{N} \left(\sum_{i=1}^N x_i^2 - N\mu^2 \right)$

N個相等機率值的變異量數亦可以點對點間的方變量表示為：

$\operatorname{Var}(X) = \frac{1}{N^2} \sum_{i=1}^N \sum_{j=1}^N \frac{1}{2}(x_i - x_j)^2$

## 特性

$\operatorname{Var}(X)\ge 0$

$P(X=a) = 1\Leftrightarrow \operatorname{Var}(X)= 0$

$\operatorname{Var}(X+a)=\operatorname{Var}(X)$

$\operatorname{Var}(aX)=a^2\operatorname{Var}(X)$

$\operatorname{Var}(aX+bY)=a^2\operatorname{Var}(X)+b^2\operatorname{Var}(Y)+2ab\, \operatorname{Cov}(X,Y),$
$\operatorname{Var}(X-Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)-2\, \operatorname{Cov}(X,Y),$

$\operatorname{Var}\left(\sum_{i=1}^N X_i\right)=\sum_{i,j=1}^N\operatorname{Cov}(X_i,X_j)=\sum_{i=1}^N\operatorname{Var}(X_i)+\sum_{i\ne j}\operatorname{Cov}(X_i,X_j)$