= Solution
For the <discrete uniform distribution>, each value has <probability> $1/n$. Using the given finite sums,
$$
\mathbb E[X]=\frac1n\sum_{r=1}^n r=\frac{n+1}{2},\qquad\mathbb E[X^2]=\frac1n\sum_{r=1}^n r^2=\frac{(n+1)(2n+1)}6.
$$
Subtracting the square of the <expected value> gives the <variance>:
$$
\operatorname{var}(X)=\frac{(n+1)(2n+1)}6-\frac{(n+1)^2}4=\frac{(n+1)(n-1)}{12}.
$$
Hence
$$
\boxed{\mathbb E[X]=\frac{n+1}{2},\qquad\operatorname{var}(X)=\frac{n^2-1}{12}.}
$$
Back to article page