An urn contains 1 green ball, 1 red ball, and 1 yellow ball. An urn contains 1 green ball, 1 red ball, and 1 yellow ball. I draw 4 balls with replacement. What is the probability that all three colors appear in the sample?
I want to construct a table so I can use the formula for joint pmf but I'm struggling to construct the table. I have so far that $X_{g}$ denotes the number of green balls selected, similarly $X_{r}, X_{y}.$ I want $$P(X_{g}=2 X_{r}=1,X_{y}=1)+P(X_{g}=1 X_{r}=2,X_{y}=1)+P(X_{g}=1 X_{r}=1,X_{y}=2).$$ We have that the number of random variable is Bin($4,\frac{1}{3})$.
Could someone give some pointers please?
 A: Go back to the basics.
All three colours will appear in the sample exactly when one colour appears twice and two colours appear once each.
So evaluate the probability for: obtaining one from three colours that appears in two from four places , and one each from the remaining two colours appearing in some arrangement in the remaining two places, when independently selecting one from three colours in each of four places.
A: Define events $R,G,Y$ as follows . . .

*

*Let $R$ be the event of that none of the $4$ balls is red.$\\[4pt]$

*Let $G$ be the event of that none of the $4$ balls is green.$\\[4pt]$

*Let $Y$ be the event of that none of the $4$ balls is yellow.

Our goal is to find $1-P(R\cup G\cup Y)$.

By the principle of inclusion-exclusion, we have
$$
{\small{
P(R\cup G\cup Y)
=
\bigl(
P(R)+P(G)+P(Y)
\bigr)
-
\bigl(
P(R\cap G)+P(G\cap Y)+P(Y\cap R)
\bigr)
+
P(R\cap G\cap Y)
}}
$$
Then we get
$$P(R)=P(G)=P(Y)=\Bigl(\frac{2}{3}\Bigr)^4=\frac{16}{81}$$
since for example, to get no red balls, each of the $4$ draws has probability ${\large{\frac{2}{3}}}$.

and we get
$$P(R\cap G)=P(G\cap R)=P(Y\cap G)=\Bigl(\frac{1}{3}\Bigr)^4=\frac{1}{81}$$
since for example, to get no red balls and no green balls, each of the $4$ draws has probability ${\large{\frac{1}{3}}}$.

Hence, noting that $P(R\cap G\cap Y)=0$, it follows that
$$
P(R\cup G\cup Y)
=
3{\,\cdot\,}\frac{16}{81}-3{\,\cdot\,}\frac{1}{81}+0=\frac{45}{81}=\frac{5}{9}
$$
so we get
$$1-P(R\cup G\cup Y)=1-\frac{5}{9}=\frac{4}{9}$$
