若随机变量\(X\)服从二项分布,即\(X\sim B(n,p)\), 则有\(P(X=k)=C_n^kp^k(1-p)^{n-k}\),其均值和方差分别是
\(E(X)=np\)
\(D(X)=np(1-p)\)
之前学二项分布的时候看到它的期望和方差觉得形式很简单,就没怎么细看推导过程。但是自己去推导的时候发现也没那么简单。。。本文做个总结
整个推导过程如下
\[\begin{align} E(k) &=\sum_{k=0}^{n} k p(k) \\ &=\sum_{k=0}^{n} k\left(\begin{array}{l} n \\ k \end{array}\right) p^{k}(1-p)^{n-k} \\ &=\sum_{k=1}^{n} k\left(\begin{array}{l} n \\ k \end{array}\right) p^{k}(1-p)^{n-k} \\ &=\sum_{k=1}^{n} k \frac{n !}{k !(n-k) !} p^{k}(1-p)^{n-k} \\ &=\sum_{k=1}^{n} k \frac{n !}{k !(n-k) !} p^{k} q^{n-k} \\ &=n p \sum_{k=1}^{n} \frac{(n-1) !}{(k-1) !(n-k) !} p^{k-1} q^{\frac{(\mathrm{n}-1)-(\mathrm{k}-1)}{}=(n-k)} \\ &=n p \end{align} \]\(D(X)=E[X-EX]^2=E[X^2-2XEX+(EX^2)]\)
注意\(EX\)可视为一个常数,所以\(E[2XEX]=2EX E[X]=2(EX)^2\),同理\(E[(EX)^2]=(EX)^2\),综上 \(D(X)=EX^2-(EX)^2\)
下面我们只需要在计算\(EX^2\)即可,推导过程如下:
\[\begin{align} E\left(k^{2}\right) &=\sum_{k=0}^{n} k^{2} p(k) \\ &=\sum_{k=1}^{n} k^{2}\left(\begin{array}{l} n \\ k \end{array}\right) p^{k} q^{n-k} \\ &=\sum_{k=1}^{n}[\mathrm{k}(\mathrm{k}-1)+\mathrm{k}]\left(\begin{array}{c} n \\ k \end{array}\right) p^{k} q^{n-k} \\ &=\sum_{k=1}^{n} k(k-1)\left(\begin{array}{c} n \\ k \end{array}\right) p^{k} q^{n-k}+\sum_{k=1}^{n} k\left(\begin{array}{c} n \\ k \end{array}\right) p^{k} q^{n-k} \\ &=\sum_{k=1}^{n} k(k-1) \frac{n !}{k !(n-k) !} p^{k} q^{n-k}+n p \\ &=n(n-1) p^{2} \sum_{k=1}^{n} \frac{(n-2) !}{(k-2) !(n-k) !} p^{k-2} q^{(n-2)-(k-2)}+n p \\ &=n(n-1) p^{2}+n p \end{align} \]所以\(DX=EX^2-(EX)^2=n(n-1) p^{2}+np-(np)^2=np(1-p)\)