Step 1:

Let $X$ be the random variable denoting the number that turns up when a die is thrown.

$X$ takes the values 1,2,3,4,5,6

Step 2:

Now each of these values is equally likely $P(x_i)=\large\frac{1}{6}$$(i=1,2,......6)$

Step 3:

The probability of $X$ is given by

Step 4:

$E(X)=\sum P_i x_i=1\times \large\frac{1}{6}$$+2\times \large\frac{1}{6}$$+3\times \large\frac{1}{6}$$+4\times \large\frac{1}{6}$$+5\times \large\frac{1}{6}$$+6\times \large\frac{1}{6}$

$\Rightarrow \large\frac{1}{6}$$\times 21=\large\frac{7}{2}$$=3.5$