Small correction. You are very rarely going to be able to get equality to hold, so you should look for for when $q$ is greater than or equal to the expression on the right. Also, you have an $n$ when you mean to have $N$. Finally, and almost completely off topic, when you have a variable that only takes integer values, it is a somewhat standard convention to use one of the variables $i,j,k, \ell, m$, or $n$ (or $N$, in some cases). Seeing $p^x$ and then realizing that $x$ has to be an integer made me twitch for a few seconds.
–
AaronOct 17 '12 at 10:01

@Aaron: Thanks, corrected the problems. And it is indeed obvious that matching probabilities with equality operator wouldn't make much sense.
–
Violet GiraffeOct 17 '12 at 10:13

Small correction to my comment. I wrote greater where I meant less than. I hope no great confusion arose. Also, thank you for changing the $x$'s to $k$'s. The formula looks a lot less confusing when I casually glance at it.
–
AaronOct 17 '12 at 10:48

2 Answers
2

This is not a solution, per se, but rather a heuristic you can use to narrow your search for the smallest number of trials you need. I do not think that there is an analytic solution, but rather just a large scale approximation which is quite useful.

Your trials can be viewed as a random variables which take the value $1$ with probability $p$ and the value $0$ with probability $1-p$. These have expected value $p$ and variance $p(1-p)$. By the central limit theorem, the sum of $k$ independent trials (i.e., the number of successful trials you've had) will be approximately normally distributed, with mean $kp$ and variance $kp(1-p)$. We want the probability that we have at least $N$ successes to be $q$ or greater. We can phrase this in terms of the standard error function.

However, $P(\mathcal N(0,1)>x)=\frac{1}{2}-\frac{1}{2}\operatorname{erf}(x/\sqrt{2})$, so we need to solve

$$\operatorname{erf}^{-1}(1-2q)=\frac{N-kp}{\sqrt{2kp(1-p)}}.$$

The left hand side is a constant which can be computed easily using many different computer packages. This reduces the problem to something more computationally feasible than computing the sum in the problem for various values of $k$.