# 變異數

## 定義

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

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

${\displaystyle \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}}$

### 離散隨機變數

${\displaystyle \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}}$

${\displaystyle \mu =\sum _{i=1}^{n}p_{i}\cdot x_{i}}$ .

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

${\displaystyle \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個相等機率值的變異數亦可以點對點間的方變量表示為：

${\displaystyle \operatorname {Var} (X)={\frac {1}{N^{2}}}\sum _{i=1}^{N}\sum _{j=1}^{N}{\frac {1}{2}}(x_{i}-x_{j})^{2}}$

### 連續型隨機變數

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

${\displaystyle \mu =\int x\,f(x)\,dx\,}$

## 特性

${\displaystyle \operatorname {Var} (X)\geq 0}$

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

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

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

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

${\displaystyle \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\neq j}\operatorname {Cov} (X_{i},X_{j})}$