# Need an algorithm to compute number of elements in sample space

An urn contains $X$ red balls, $Y$ green balls, and $Z$ white balls. $N$ balls are drawn without replacement from the urn, and the colors are noted in sequence.

$N \leq X+Y+Z$

Trying to come up with algorithm to compute the number of elements in sample space.

-

## 1 Answer

Hint First treat the case when $N < \min\{X,Y,Z\}$. Then what about $X < N < Y+Z$. Keep increasing the limitations until you get the general procedure.

-
Even for the case of X=3, Y=2, Z=1 and N=3 I am not sure how to come up with an answer –  Yevgeniy Rozhkov May 7 '13 at 18:09
@YevgeniyRozhkov for this case, i would condition on $z$ - it's either there or not, and if yes, choose a place for it. Now you reduced it to 2 elements and 2 or 3 places. 2 places are easy and for 3 you condition again. –  gt6989b May 7 '13 at 19:15