TITLE: Calculate the probability of an event occurring AT LEAST x times over n trials?
QUESTION [8 upvotes]: Forgive me if this is simple, but I've been twisting around this problem for a bit.
I know how to calculate if a given event happens exactly $x$ times over $n$ trials (where $p$ is the probability of the event occurring during a single trial):
$$p^x (1-p)^{n-x}$$
It seems like I could get the result of it occurring at least $x$ times by doing a sum...
$$\sum_{q=0}^{n-x} p^{x+q}  (1-p)^{n-(x+q)}$$
... But I'm assuming there's a simpler way, mathematically, to go about calculating this.  Can anyone enlighten me?

REPLY [4 votes]: The formula you are using is the same as 1 minus the cumulative binomial distribution function. If you are have a calculator/programming-language you can use that, without doing any iterative calculations yourself.
Cumulative binomial distribution function is at most k events
$$\texttt{atMost}(k,n,p) = \texttt{cumBinomDist}(k,n,p) \\
 = \Pr(X \le k) = \sum_{i=0}^{\lfloor k \rfloor} {n\choose i}p^i(1-p)^{n-i}$$
So if you want to find the probability of at least x events you do
$$\texttt{atLeast}(x,n,p) = 1 - \texttt{cumBinomDist}(\texttt{ceil}(x) - 1,n,p) \\
 = 1 - \Pr(X \le \lceil x\rceil - 1) = 1 - \sum_{i=0}^{\lceil x\rceil - 1} {n\choose i}p^i(1-p)^{n-i} \\
 = \sum_{i=\lceil x \rceil}^{n} {n\choose i}p^i(1-p)^{n-i} = \Pr(X \ge x) \\
$$