Probability Calculator
Calculate combinations (nCr), permutations (nPr), factorials, and basic event probability.
Combinations vs. Permutations
The difference comes down to one question: does order matter? If you are choosing a committee of 3 from 10 people, order does not matter (Alice-Bob-Carol is the same as Carol-Alice-Bob), so use combinations (nCr). If you are assigning 1st, 2nd, and 3rd place in a race of 10, order matters (different finish orders are different outcomes), so use permutations (nPr).
C(n,r) = n! / (r! x (n-r)!) [combinations]
P(n,r) = n! / (n-r)! [permutations]
n! = n x (n-1) x (n-2) x ... x 1 [factorial]
Understanding Factorial
A factorial (n!) is the product of all positive integers from 1 to n. 5! = 5 x 4 x 3 x 2 x 1 = 120. By definition, 0! = 1. Factorials grow extremely fast: 10! is 3.6 million, 20! is over 2 quintillion, and 170! is the largest factorial that JavaScript can represent without returning infinity.
Basic Probability Formula
The probability of an event equals the number of favorable outcomes divided by the total number of possible outcomes. If a bag has 3 red balls and 7 blue balls, the probability of drawing red is 3/10 = 30%. Probability always falls between 0 (impossible) and 1 (certain). You can express it as a fraction, decimal, or percentage.
How many 5-card poker hands are there?
C(52,5) = 2,598,960 possible hands. This is a combinations problem because the order you receive the cards does not matter. A royal flush (10, J, Q, K, A of one suit) can happen in exactly 4 ways out of those 2.6 million, making the probability about 1 in 649,740.
Why does 0! equal 1?
This is a convention that makes many formulas work correctly. There is exactly 1 way to arrange zero objects (do nothing). It also follows the pattern: 3! = 6, 2! = 2, 1! = 1 (each step divides by the next number), so 0! = 1!/1 = 1.
What is the difference between odds and probability?
Probability is favorable outcomes divided by total outcomes (like 1/6). Odds compare favorable to unfavorable outcomes (like 1 to 5). A 25% probability corresponds to odds of 1 to 3. Betting odds use a different format but express the same concept.
How do you calculate probability of independent events?
For independent events (where one does not affect the other), multiply their individual probabilities. The chance of flipping heads twice in a row is 1/2 x 1/2 = 1/4 = 25%. The chance of rolling a 6 three times in a row is (1/6)^3 = 1/216.