# Variance in a Discrete Probability Distribution (Homework)

For my Homework I have four values: $N_1, N_2, A, C$.
Two values are chosen at random without replacement. X denotes how many N values are chosen.

$$P(x=0) = \frac16 \qquad P(x=1) = \frac23 \qquad P(x=2) = \frac16$$

find the mean and variance.

I have taken the mean to be $\frac{(0+1+2)}{3} = \frac33 = 1$ However, I think this is wrong, and that the distribution must be taken into account.

The Variance is to be determined by the equation $\text {Var}(x)=E(x^2)-E(x)^2$ However I am not certain what value to assign $x$.

-
Use capital letters, $X$ is a random variable. You are right, $E(X)=1$. Now let's deal with $E(X^2)$. The random variable $X^2$ takes on values $0$, $1$, $4$ with probabilities respectively $1/6$, $2/3$, $1/6$, so you should be able to find $E(X^2)$. – André Nicolas Sep 21 '11 at 23:40
Your mean is correct, but I suspect from your comments that this is a coincidence. You do have to take the distribution into account. The correct calculation is $0\cdot\frac16+1\cdot\frac23+2\cdot\frac16 = \frac23+\frac13=1$. You can use the same idea to calculate $E(X^2)$: multiply each possible value by its probability and add up the results. – Brian M. Scott Sep 22 '11 at 0:04
Let $W$ be a random variable that takes the values $w_1, w_2, \dots, w_n$ with probabilities $p_1, p_2, \dots,p_n$. Then $E(W)=w_1p_1+w_2p_2+\cdots +w_np_n$. – André Nicolas Sep 22 '11 at 6:09

For any function $f$, the expectation of $f(X)$ is given by: $\newcommand{\E}{\mathrm{E}}$ $$\E(f(X)) = \sum_{i=0}^2 \ \Pr[X = i] \cdot f(i) = \sum_{i=0}^2 \ p_i f(i) .$$
The expectation of $X$ is $$\E(X) = 0 \cdot p_0 + 1 \cdot p_1 + 2 \cdot p_2 = \frac{1}{6} \cdot 0 + \frac{2}{3} \cdot 1 + \frac{1}{6} \cdot 2 = 1.$$ $$\E(X^2) = 0 \cdot p_0 + 1^2 \cdot p_1 + 2^2 \cdot p_2 = \frac{1}{6} \cdot 0^2 + \frac{2}{3} \cdot 1^2 + \frac{1}{6} \cdot 2^2 = \frac{4}{3}.$$ The variance of $X$ is $$\mathrm{Var}(X) = \E(X^2) - \E(X)^2 = \frac{4}{3} - 1^2 = \frac{1}{3}.$$