均匀分布
均匀分布(Uniform Distribution)是一种常见的连续型概率分布,其中随机变量在给定区间内的每个值都有相同的概率。假设随机变量 ( X ) 在区间 ([a, b]) 上服从均匀分布,记作
均匀分布的概率密度函数(PDF)为:
f ( x ) = { 1 b − a if a ≤ x ≤ b 0 otherwise f(x) = \begin{cases} \frac{1}{b - a} & \text{if } a \leq x \leq b \\ 0 & \text{otherwise} \end{cases} f(x)={b−a10if a≤x≤botherwise
期望值
期望值(Expectation)表示随机变量的平均值。对于均匀分布 ( X ),其期望值 ( \mathbb{E}(X) ) 定义为:
E ( X ) = ∫ a b x f ( x ) d x \mathbb{E}(X) = \int_{a}^{b} x f(x) \, dx E(X)=∫abxf(x)dx
代入均匀分布的概率密度函数:
E ( X ) = ∫ a b x ⋅ 1 b − a d x \mathbb{E}(X) = \int_{a}^{b} x \cdot \frac{1}{b - a} \, dx E(X)=∫abx⋅b−a1dx
将 (\frac{1}{b - a}) 提取出来:
E ( X ) = 1 b − a ∫ a b x d x \mathbb{E}(X) = \frac{1}{b - a} \int_{a}^{b} x \, dx E(X)=b−a1∫abxdx
计算积分:
∫ a b x d x = x 2 2 ∣ a b = b 2 2 − a 2 2 \int_{a}^{b} x \, dx = \left. \frac{x^2}{2} \right|_{a}^{b} = \frac{b^2}{2} - \frac{a^2}{2} ∫abxdx=2x2 ab=2b2−2a2
因此,
E ( X ) = 1 b − a ⋅ ( b 2 2 − a 2 2 ) = 1 b − a ⋅ b 2 − a 2 2 = b + a 2 \mathbb{E}(X) = \frac{1}{b - a} \cdot \left( \frac{b^2}{2} - \frac{a^2}{2} \right) = \frac{1}{b - a} \cdot \frac{b^2 - a^2}{2} = \frac{b + a}{2} E(X)=b−a1⋅(2b2−2a2)=b−a1⋅2b2−a2=2b+a
方差
方差(Variance)表示随机变量与其期望值之间的离散程度。方差的定义为:
Var ( X ) = E [ ( X − E ( X ) ) 2 ] = E ( X 2 ) − ( E ( X ) ) 2 \text{Var}(X) = \mathbb{E}[(X - \mathbb{E}(X))^2] = \mathbb{E}(X^2) - (\mathbb{E}(X))^2 Var(X)=E[(X−E(X))2]=E(X2)−(E(X))2
首先,我们计算 ( \mathbb{E}(X^2) ):
E ( X 2 ) = ∫ a b x 2 f ( x ) d x \mathbb{E}(X^2) = \int_{a}^{b} x^2 f(x) \, dx E(X2)=∫abx2f(x)dx
代入均匀分布的概率密度函数:
E ( X 2 ) = ∫ a b x 2 ⋅ 1 b − a d x \mathbb{E}(X^2) = \int_{a}^{b} x^2 \cdot \frac{1}{b - a} \, dx E(X2)=∫abx2⋅b−a1dx
将 (\frac{1}{b - a}) 提取出来:
E ( X 2 ) = 1 b − a ∫ a b x 2 d x \mathbb{E}(X^2) = \frac{1}{b - a} \int_{a}^{b} x^2 \, dx E(X2)=b−a1∫abx2dx
计算积分:
∫ a b x 2 d x = x 3 3 ∣ a b = b 3 3 − a 3 3 \int_{a}^{b} x^2 \, dx = \left. \frac{x^3}{3} \right|_{a}^{b} = \frac{b^3}{3} - \frac{a^3}{3} ∫abx2dx=3x3 ab=3b3−3a3
因此,
E ( X 2 ) = 1 b − a ⋅ ( b 3 3 − a 3 3 ) = 1 b − a ⋅ b 3 − a 3 3 \mathbb{E}(X^2) = \frac{1}{b - a} \cdot \left( \frac{b^3}{3} - \frac{a^3}{3} \right) = \frac{1}{b - a} \cdot \frac{b^3 - a^3}{3} E(X2)=b−a1⋅(3b3−3a3)=b−a1⋅3b3−a3
我们可以利用因式分解 ( b^3 - a^3 ) 为 ((b-a)(b^2 + ab + a^2)):
E ( X 2 ) = 1 b − a ⋅ ( b − a ) ( b 2 + a b + a 2 ) 3 = b 2 + a b + a 2 3 \mathbb{E}(X^2) = \frac{1}{b - a} \cdot \frac{(b - a)(b^2 + ab + a^2)}{3} = \frac{b^2 + ab + a^2}{3} E(X2)=b−a1⋅3(b−a)(b2+ab+a2)=3b2+ab+a2
现在我们可以计算方差:
Var ( X ) = E ( X 2 ) − ( E ( X ) ) 2 = b 2 + a b + a 2 3 − ( b + a 2 ) 2 \text{Var}(X) = \mathbb{E}(X^2) - (\mathbb{E}(X))^2 = \frac{b^2 + ab + a^2}{3} - \left( \frac{b + a}{2} \right)^2 Var(X)=E(X2)−(E(X))2=3b2+ab+a2−(2b+a)2
计算 ((\mathbb{E}(X))^2):
( E ( X ) ) 2 = ( b + a 2 ) 2 = ( b + a ) 2 4 = b 2 + 2 a b + a 2 4 (\mathbb{E}(X))^2 = \left( \frac{b + a}{2} \right)^2 = \frac{(b + a)^2}{4} = \frac{b^2 + 2ab + a^2}{4} (E(X))2=(2b+a)2=4(b+a)2=4b2+2ab+a2
因此,
Var ( X ) = b 2 + a b + a 2 3 − b 2 + 2 a b + a 2 4 \text{Var}(X) = \frac{b^2 + ab + a^2}{3} - \frac{b^2 + 2ab + a^2}{4} Var(X)=3b2+ab+a2−4b2+2ab+a2
找到公分母:
Var ( X ) = 4 ( b 2 + a b + a 2 ) − 3 ( b 2 + 2 a b + a 2 ) 12 = 4 b 2 + 4 a b + 4 a 2 − 3 b 2 − 6 a b − 3 a 2 12 = b 2 − 2 a b + a 2 12 = ( b − a ) 2 12 \text{Var}(X) = \frac{4(b^2 + ab + a^2) - 3(b^2 + 2ab + a^2)}{12} = \frac{4b^2 + 4ab + 4a^2 - 3b^2 - 6ab - 3a^2}{12} = \frac{b^2 - 2ab + a^2}{12} = \frac{(b - a)^2}{12} Var(X)=124(b2+ab+a2)−3(b2+2ab+a2)=124b2+4ab+4a2−3b2−6ab−3a2=12b2−2ab+a2=12(b−a)2
结论
对于均匀分布 ( X \sim U(a, b) ),其期望值和方差分别为:
E ( X ) = a + b 2 \mathbb{E}(X) = \frac{a + b}{2} E(X)=2a+b
Var ( X ) = ( b − a ) 2 12 \text{Var}(X) = \frac{(b - a)^2}{12} Var(X)=12(b−a)2
这些结果表明,在区间 ([a, b]) 上均匀分布的随机变量的平均值是区间的中点,而离散程度由区间长度的平方决定。