The expected value, denoted by $E(X)$ , of a random variable is the theoretical mean of the probability distribution for that variable, given by

$$E(X) = \sum X \cdot P(X)$$This means, to find the expected value, one multiplies each possible outcome by the probability that outcome occurs, and then adds up all of those products. The resulting sum is the expected value.

Here's the idea: Suppose that we were flipping a coin three times and X counted the number of heads seen. The probability distribution for X is shown below.

$$\begin{array}{c|c|c|c|c}X & 0 & 1 & 2 & 3\\ \hline P(X) & 1/8 & 3/8 & 3/8 & 1/8\\ \end{array}$$If we were to do this 200 times, we would "expect" to see

- 0 heads 1/8th of the time, or 200*(1/8) = 25 times
- 1 head 3/8ths of the time, or 200*(3/8) = 75 times
- 2 heads 3/8ths of the time, or 200*(3/8) = 75 times
- 3 heads 1/8th of the time, or 200*(1/8) = 25 times

The mean of this theoretical distribution would then be

$$\mu = \frac{0 \cdot 25 + 1 \cdot 75 + 2 \cdot 75 + 3 \cdot 25}{200}$$But think about where these numbers came from -- we could write instead:

$$\mu = \frac{ 0 \cdot 200 \cdot (1/8) + 1 \cdot 200 \cdot (3/8) + 2 \cdot 200 \cdot (3/8) + 3 \cdot 200 \cdot (1/8)}{200}$$We can factor out a 200 from every term in the numerator, which would then cancel with the 200 in the denominator, giving the following

$$\mu = 0 \cdot (1/8) + 1 \cdot (3/8) + 2 \cdot (3/8) + 3 \cdot (1/8)$$Notice the complete lack of 200 in the above expression! And this wasn't a coincidence -- this would have happened if the 200 was 1000, 10 million, or 13,798,235,114.

As you can see, the "expected mean" depends only on the outcome values and the probabilities those outcomes occur. We just have to multiply the outcomes together with the corresponding probabilities and add them up!

The standard deviation for a discrete pdf, $P(X)$ is denoted by the Greek letter, sigma ($\sigma$), where

$$\sigma = \sqrt{\sum [x^2P(x)] - \mu^2}$$Since the standard deviation is the square root of the variance, the variance is denoted by $\sigma^2$, where

$$\sigma^2 = \sum [x^2P(x)] - \mu^2$$So to find the variance and standard deviation of a discrete pdf, one should:

- Find the mean of the distribution
- Find the squares of the values the random variable can assume
- Multiply each one of these squares by the probability that the corresponding random variable value occurs and then add all of these products together
- Subtract from this sum the squared mean of the distribution. This is the variance.
- Take the square root of the variance. This is the standard deviation.