probability set theory - probability of x out of n events I am having an issue related to probability set theory with intersection/union terms. 
When calculating the union of terms or in other words, the probability that at least one terms "fails", it can be written as the following for three terms:
P(A+B+C) = P(A)+P(B)+P(C)-P(AB)-P(AC)-P(BC)+P(ABC). 
My question is how to assess a problem similar to this when we are looking at the probability at least x terms out of n terms fail. For example, at least 2 out of 4. Or at least 7 out of 10. I thought I came up with the correct answer when looking at a system of only 4 terms. For example:
P(at least 2 out of 4) = P(AB)+P(AC)+P(AD)+P(BC)+P(BD)+P(CD)
-2*(P(ABC)+P(ABD)+P(ACD)+P(BCD))
+3*(P(ABCD))
P(at least 3 out of 4) = P(ABC)+P(ABD)+P(ACD)+P(BCD)
-3*(P(ABCD))
This works here. In fact, it works for P(at least 2 out of n) and P(at least (n-1) out of n) for all cases of n. However it does not work for the situations in between.
I am looking for an analog formula that can evaluate any case for the probability of at least x out of n failure.  Any help with be appreciate.  Thanks!
 A: Update - I figured it out.  Yes, it does have to do with the exclusion/inclusion principle but it becomes very tricky.  Basically I went through each intersection level for n = 5 events and calculated how many of each term I am subtracting and adding.  Doing this, I was able to get coefficients needed for subtracting and adding each subsequent intersection term.  There isn't a pretty formula for it, but I put it into a code to be able to populate the coefficients for each x out of n case of interest.
A: http://en.wikipedia.org/wiki/Binomial_distribution
Specfically, the cumulative distribution function (cdf).  That formula tells the probability that less than or equal to x successes have occurred, so you'd want 1 - cdf for your "at least" question.
Example: 2 or fewer successes out of 3 trials where a success has probability 1/3
F(2,3,1/3) = ({3!/[0!(3-0)!]}[(1/3)^(0)][(2/3)^(3-0)]) + ({3!/[1!(3-1)!]}[(1/3)^(1)][(2/3)^(3-1)]) + ({3!/[2!(3-2)!]}[(1/3)^(2)][(2/3)^(3-2)])
= [(6/6)(8/27)] + [(6/2)(4/27)] + [(6/2)*(2/27)]
~= .963
In this case, you could have just found the probability of exactly 3 successes in 3 trails.
Pr(X=3 | n=3, p=(1/3)) = (1/3)^3 ~= 0.037
I apologize for the lack of mathematical notation, but the formula on wikipedia is correct.  For large n (trials), the formula is cumbersome and there are other methods described on wikipedia.  There are also cumulative distribution tables for the binomial distribution.
