A random variable W can take on values in {0,1,2,3,4} with the probabilities: $$P(W=0) = 0.5\\P(W=1) = 0.1\\ P(W=2) = 0.2\\ P(W=3) = 0.15\\ P(W=4) = 0.05\\$$ I am interested in finding the standard deviation of W.
I have two ways to calculate the standard deviation, either:$$\sigma = \sqrt{\frac{(x-\bar{x})^2}{n-1}}$$
or $$\sigma = \sqrt{\sum_{i=1}^{n}(x_{i}-\bar{x})^2 P(X=x_{i})}$$ But I cannnot get the right answer to choose. The correct answer is 1.31 while I got 1.57. Why is that? Thank you!
Your calculation of $\mu$ as $\frac{0+1+2+3+4}{5}$ is wrong. It doesn't use the probabilities you're given but instead assumes that all $5$ values are equally likely.
The actual mean is $1.15$.