🕌

Uniform distribution

2024/01/15に公開

Discrete uniform distribution

\begin{align*} p(X=x | N) = \frac{1}{N} , \quad x = 1, 2, \dots, N \end{align*}
\begin{align*} E[X] &= \frac{1}{N} \sum_{x=1}^N x \\ &= \frac{1}{N} \frac{N(N+1)}{2} \\ &= \frac{(N+1)}{2} \\ E[X^2] &= \frac{1}{N} \sum_{x=1}^N x^2 \\ &= \frac{1}{N} \frac{1}{6} N(N+1)(2N+1) \\ &= \frac{1}{6} (N+1)(2N+1) \\ V[X] &= E[X^2] - E[X]^2 \\ &= \frac{1}{6} (N+1)(2N+1) - \left( \frac{(N+1)}{2} \right)^2 \\ &= \frac{(N+1)(N-1)}{12} \end{align*}

Continuous uniform distribution

\begin{align*} p(X=x|a, b) = \begin{cases} \frac{1}{b - a} &\quad a \le x \le b \\ 0 &\quad \text{otherwise} \end{cases} \end{align*}
\begin{align*} E[X] &= \int_a^b x \frac{1}{b - a} dx \\ &= \frac{a + b}{2} \\ E[X^2] &= \int_a^b x^2 \frac{1}{b - a} dx \\ &= \frac{1}{b - a} \frac{1}{3}(b^3 - a^3) \\ &= \frac{1}{b - a} \frac{1}{3}(b - a)(b^2 + ab + a^2) \\ &= \frac{1}{3}(b^2 + ab + a^2) \\ V[X] &= E[X^2] - E[X]^2 \\ &= \frac{1}{3}(b^2 + ab + a^2) - \left( \frac{a + b}{2} \right)^2 \\ &= \frac{(a - b)^2}{12} \end{align*}

Discussion