About this calculator
Probability gives a number from 0 (impossible) to 1 (certain). This calculator covers four common cases: the probability of an event from equally likely outcomes; two independent events (both, at least one, exactly one, neither); the binomial distribution for the number of successes in repeated independent trials — such as the number of defective parts in a sample; and counting combinations and permutations.
Formula
One event
P(E) = favourable outcomes ÷ total outcomes P(not E) = 1 − P(E)
Odds for : against = favourable : (total − favourable), reduced to lowest terms.
Two independent events
P(A ∩ B) = P(A) × P(B) P(A ∪ B) = P(A) + P(B) − P(A ∩ B)
P(exactly one) = P(A) + P(B) − 2 P(A ∩ B) P(neither) = (1 − P(A))(1 − P(B))
These hold only if A and B are independent (one does not change the chance of the other).
Binomial (k successes in n)
P(X = k) = C(n, k) pk (1 − p)n−k
P(X ≤ k) = Σi=0…k P(X = i) mean = np σ = √(np(1 − p))
Each term is worked out with logarithms, so large n does not overflow.
Combinations & permutations
C(n, r) = n! ÷ (r! (n − r)!) P(n, r) = n! ÷ (n − r)!
Both are calculated exactly with whole-number arithmetic. Results longer than 40 digits are shown in scientific form with the number of digits.
Worked example
- Drawing an ace from 52 cards: P = 4 ÷ 52 = 0.07692 (7.69%); odds 1 : 12.
- P(A) = 0.3 and P(B) = 0.5: P(A and B) = 0.15, P(A or B) = 0.3 + 0.5 − 0.15 = 0.65, P(neither) = 0.7 × 0.5 = 0.35.
- 10 fair coin tosses, exactly 3 heads: C(10, 3) × 0.5¹⁰ = 120 ÷ 1024 = 0.1171875; P(X ≤ 3) = 176 ÷ 1024 = 0.171875.
- Choosing 3 from 10: nCr = 120, nPr = 720.
Assumptions and limitations
- One event: all outcomes are equally likely.
- Two events and binomial: the events or trials are independent, and in the binomial case p is the same in every trial (sampling with replacement or from a very large population).
- Binomial probabilities are summed term by term in double precision; the cumulative sums are checked against SciPy for n up to 10,000 (n is limited to 10,000). Combinations and permutations are exact.
References
- Montgomery, D. C. & Runger, G. C. Applied Statistics and Probability for Engineers — probability and the binomial distribution.
- NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.6.6.18 (binomial distribution).
