I am struggling to solve the following exercise, and I would like to know if there is a simpler way to solve it than the way I chose!
Suppose that in Maryland, on a certain day, N lottery tickets are sold and M win. To have a probability of at least ${\alpha}$ of winning on that day, approximately how many tickets should be purchased?
I started out with a concrete case:
Suppose there are $100$ tickets, and $15$ of them are winning tickets, how many tickets must I buy so that I have at least a 50% chance of winning?
and then I went case by case:
What is the probability of winning by buying $1$ ticket? Clearly the answer is:
$$\frac{15}{100}=0.15$$
Not good enough, how about by buying two tickets?:
$${2\choose{2}}*\frac{15*14}{100*99}+ {2\choose{1}}*\frac{15*85}{100*99}\approx0.279$$
Still not good enough, but I am starting to see a pattern, and so I attempt to generalize to this with:
$$\sum_{i=1}^n {n\choose i}*\frac{{_{15}}P{_i}*{_{85}}P{_{n-i}}}{{_{100}}P{_n}}$$
Now it remains to solve for $n$
$$\sum_{i=1}^n {n\choose i}*\frac{{_{15}}P{_i}*{_{85}}P{_{n-i}}}{{_{100}}P{_n}}\geq 0.5$$
It looks like monstrous calculations are needed to compute this, but then I generalize to the exercise anyway:
$$\sum_{i=1}^n {n\choose i}*\frac{{_{M}}P{_i}*{_{N-M}}P{_{n-i}}}{{_{N}}P{_n}}\geq \alpha$$
First of all, is this correct? and second of all, is there a way to simplify the calculations? I know Poisson can somehow help (so says my book) but I fail to see how, may you please explain how I can convert this into a Poisson approximation? What should I be thinking? ANY help is greatly appreciated, thank you!
BONUS: If you know any python, some tips on how I can brute force calculate this would be great too, otherwise please recommend a program with which i can do this, thank you :)
We may assume that the number of tickets $N$ and the number of winning tickets $M$ are both large. We can then do our calculations as if we are drawing with replacement (while actually it is a case of drawing without replacement). If we buy $Q$ tickets, the probability that none of them wins a prize is:
$$P = (1-M/N)^Q$$
The prize of winning at least one prize is $1-P$, which we demand to be larger than $\alpha$. Thus we arrive at the following equation, to be solved for $Q$:
$$(1-M/N)^Q < 1-\alpha$$
This is easily done by using logarithms:
$$Q > log(1-\alpha)/log(1-M/N)$$
Compute the right hand side, then round up to the next integer value.
Post Scriptum: As indicated by the OP, there is another approach possible, based on the Poisson distribution. This leads to a similar but slightly different result. It can be derived by writing the exact formula for the chance $P$, then divide each term in the numerator and dominator by $N$, yielding:
$$P =\frac {(1-M/N)(1-(M+1)/N)...(1-(M+Q-1)/N)}{(1)(1-1/N)...(1-(Q-1)/N)}$$
Now assume that $N$ is large compared to $M$ and $Q$. Then each term can be turned into an exponential. Collecting all contributions from numerator and denominator gives:
$$P = e^{-QM/N}$$
[Note that this expression can also be derived by considering $log(P)$ and making a large $N$ approximation.] The criterium that $1-P$ must be larger than $\alpha$ leads to:
$$Q > -(N/M)log(1-\alpha)$$
Numerical tests may be used to see which of the two formulas for $Q$ works best.