A collection of tickets comes in 4 colors: Red, Blue, White, and Green. There are twice as many reds as blues, equal number of blues and whites, and three times as many greens as whites. Choose 5 tickets at random with replacement. Let $X$ be the number of different colors that appear. Find E(X).
$E(X) = \sum_{all \,x}xP(X=x)$ where $X \in \{1, 2, 3, 4\}$
$= 1P(X=1) + 2P(X=2)+3P(X=3)+4P(X=4)$
Each $P(X=x)$ calculation is fairly complicated as I need to account every combination such as for
$P(X=4) = \frac{5!}{1!1!1!2!}(2(\frac{1}{7})^3(\frac{2}{7})(\frac{3}{7}) + (\frac{1}{7})^2(\frac{2}{7})^2(\frac{3}{7}) + (\frac{1}{7})^2(\frac{2}{7})(\frac{3}{7})^2)$
However, the answer for E(X) is just
$2(1-(\frac{6}{7})^5)+1-(\frac{5}{7})^5+1-(\frac{4}{7})^5$
How did they come up with that? Is it just a simplified version of what I'm doing?
I will prove this for the general case where we have a discrete probability distribution on a finite set $\mathcal J$, defined by probabilities $(p_j)_{j \in \mathcal J}$; so in your example $\mathcal J = \{R, B, W, G\}$, with probabilities $(\frac27, \frac17, \frac17, \frac37)$.
For some integer $N$, let $X_1, \ldots X_N$ denote i.i.d. samples from $\mathcal J$, and denote $X$ to be the total number of distinct values taken by the $X_i$.
We will show that
$$\mathbf E[X] = \sum_{j \in \mathcal I} \big( 1 - (1-p_j)^M\big)$$
To see this, let $$\mathbf 1_j = \{ \, \exists \, n \text{ st. } X_n = j\}, \qquad j \in \mathcal J$$ denote the event that at least one of the $X_n = j$, and note that we can write $$ X = \sum_{j \in \mathcal J} \mathbf 1_j.$$
For each $j$ we have
\begin{align*} \mathbf E[ \mathbf{1}_j ] &= \mathbf P \left[\, \exists \, n \text{ st. } X_n = j\,\right] \\ & = 1 - \mathbf P \left[\, X_n \neq j,\, \forall \, n =1,\ldots, N\,\right] \\ & = 1 - (1-p_j)^N \end{align*} The result then follows by linearity of expectation (and the ability to exchange integration and summation)
\begin{align*} \mathbf E [ X] & = \mathbf{E} \left[ \textstyle \sum_{j \in \mathcal J} \mathbf{1}_j \right] \\ & = \textstyle \sum_{j \in \mathcal J} \mathbf E \left[ \mathbf{1}_j \right] \\ & = \textstyle \sum_{j \in \mathcal J} \big( 1 - (1-p_j)^N\big). \end{align*}
Note that finiteness of $\mathcal J$ was assumed to make it clear that we can exchange the integral and the summation; this can however be easily extended to the case of countable $\mathcal J$ by an application of the monotone convergence theorem.