<s>[INST] Probability of selecting specific balls from an urn? An urn contains seven red balls, seven white balls, and seven blue balls. A sample of 5 balls is drawn at a random without replacement. What is the probability that the sample contains three balls of one color and two of another? 
Here was what I tried doing. 
I said that the total number of ways to choose 5 balls without any restrictions is $\binom{21}{5}$. This is because there are $21$ balls and $5$ positions that you need to choose. 
Next I thought that the number of ways to select the $3$ balls of one color would be $\binom{7}{3}$ since there are $7$ balls of one color. Since there are 3 different colors I also thought you would multiply $\binom{7}{3}$ by 3.I also thought since the remaining two balls must be of a different color there are $2!$ ways to permute the remaining balls. 
So my final answer was 
$$Probability = \frac{3*2!*\binom{7}{3}}{\binom{21}{5}}$$
Only thing is I'm not sure If my answer is right. One problem that I had dealing with was if the two remaining balls are of the same color then I'm not sure multiplying by $2!$ is right but I'm not really sure how to deal with these cases.
==================================================================
Comment: I was wondering if instead of having the same number of balls lets say you had 7 red balls, 8 white balls, and 9 blue balls. Then how would the formula for probability be affected. 
 [/INST] Your denominator is correct.  For the numerator, we must select one of the three colors from which three balls will be selected, select three of the seven balls of that color, select one of the two remaining colors from which two balls will be selected, and select two balls of that color.  Hence, the probability of selecting three balls of one color and two balls of another color when five balls are selected is 
$$\frac{\dbinom{3}{1}\dbinom{7}{3}\dbinom{2}{1}\dbinom{7}{2}}{\dbinom{21}{5}}$$
Addendum:  If you instead have seven red balls, eight white balls, and nine blue balls, you have six cases.  They are 


*

*three red, two white $\binom{7}{3}\binom{8}{2}$

*three red, two blue $\binom{7}{3}\binom{9}{2}$

*two red, three white $\binom{7}{2}\binom{8}{3}$

*two red, three blue $\binom{7}{2}\binom{9}{3}$

*three white, two blue $\binom{8}{3}\binom{9}{2}$

*two white, three blue $\binom{8}{2}\binom{9}{3}$


Hence, the probability of selecting three balls of one color and two balls of a different color when five balls are selected from the $7 + 8 + 9 = 24$ balls in the bag is 
$$\frac{\dbinom{7}{3}\dbinom{8}{2} + \dbinom{7}{3}\dbinom{9}{2} + \dbinom{7}{2}\dbinom{8}{3} + \dbinom{7}{2}\dbinom{9}{3} + \dbinom{8}{3}\dbinom{9}{2} + \dbinom{8}{2}\dbinom{9}{3}}{\dbinom{24}{5}}$$
</s>