So I have $x\sim U(\{1,2,..., 20\})$ and I need to find $E(x^2)$. I have tried searching our textbook but could not really understand the logic behind the steps they showed. Where am i supposed to start solving something like this?
2026-04-12 22:53:44.1776034424
On
Help with finding expectancy
48 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
Method $1$:
Solving it from formula of expectation.
$$\mathbb{E}(X^2)=\sum_{i=1}^{20}i^2\frac{1}{20}=\frac{1}{20}\sum_{i=1}^{20}i^2$$
You might want to know the formula
$$\sum_{i=1}^{n}i^2=\frac{n(n+1)(2n+1)}{6}$$
Method $2$:
Suppose you know the formula for the variance for discrete uniform distribution, $X \sim Unif(a,b)$ is
$$Var(X)=\frac{(b-a+1)^2}{12}$$
and the formula for the mean is $$\mathbb{E}[X]=\frac{a+b}{2}$$
You can then use the formula
$$\mathbb{E}[X^2]-\mathbb{E}(X)^2=Var(X)$$ to solve for $\mathbb{E}[X^2]$.
$x$ is uniformly distributed on the set $\{1, 2, \dots, 20\} $, so there are the same number of $1$'s as $2$'s as $3$'s, etc. Now, the variable we are investigating to find the expected value is $x^2$. So, the set $\{1, 4, 9, \dots, 400\}$ of squares will be uniformly distributed. The expected value is the average of that set. As Siong said, that average can be calculated using the formula $$\frac 1{n}\sum_{i=1}^{n}i^2=\frac{n(n+1)(2n+1)}{6\times n}$$ where $n=20$ in this case.
The formula $\sum_{i=1}^ni=\frac{n(n+1)}2$ in your textbook works for sets of the form $\{1, 2, 3, \dots, n\} $. The logic behind that function is that the terms can be paired when summing them all, so that there are $\frac n2$ pairs, whose sums each give $n+1$ (if $n$ is odd, the middle term equals $\frac {n+1}2$). The first and last terms give $1+n$; the second and second-last terms give $2+n-1=n+1$; and so on.